Home > Common Problem > The difference between rabbitmq and kafka

The difference between rabbitmq and kafka

(*-*)浩
Release: 2020-01-09 11:41:09
Original
8718 people have browsed it

The difference between rabbitmq and kafka

# In terms of application scenarios (Recommended Learning: PHPSTORM )

Rabbitmq, follow the AMQP protocol, from the inside high concurrency The erlanng language is developed and used in real-time messaging that requires relatively high reliability.

kafka is Linkedin's open source message publishing and subscription system in December 2010. It is mainly used to process active streaming data and large amounts of data processing.

1) In terms of architectural model

RabbitMQ follows the AMQP protocol. RabbitMQ’s broker consists of Exchange, Binding, and queue, where exchange and binding constitute the routing key of the message. ;

The client Producer communicates with the server by connecting the channel, and the Consumer obtains messages from the queue for consumption (long connection, if there is a message in the queue, it will be pushed to the consumer side, and the consumer loop reads data from the input stream). rabbitMQ is broker-centric; it has a message confirmation mechanism.

Kafka follows the general MQ structure, producer, broker, consumer, with the consumer as the center. The consumption information of the message is saved on the client consumer. The consumer pulls data in batches from the broker according to the consumption point; no message Confirmation mechanism.

2) In terms of throughput

kafka has high throughput, internally uses message batch processing, zero-copy mechanism, and data storage and acquisition are local disks Sequential batch operations have O(1) complexity, and message processing is very efficient.

rabbitMQ is slightly inferior to kafka in terms of throughput. Their starting points are different. rabbitMQ supports reliable delivery of messages, supports transactions, and does not support batch operations; based on storage reliability requirements, storage can be used memory or hard drive.

3) In terms of availability

rabbitMQ supports mirror queue. When the main queue fails, the mirror queue takes over.

Kafka’s broker supports active and backup modes.

4) In terms of cluster load balancing

kafka uses zookeeper to manage the brokers and consumers in the cluster, and you can register topics to zookeeper;

Through the coordination mechanism of zookeeper, the producer saves the broker information corresponding to the topic, which can be sent to the broker randomly or in a poll;

And the producer can specify shards based on semantics, and the message is sent to a certain shard of the broker.

RabbitMQ's load balancing requires a separate loadbalancer for support.

The above is the detailed content of The difference between rabbitmq and kafka. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template