Home > Database > Redis > body text

The difference between mq and redis

(*-*)浩
Release: 2019-06-18 11:00:03
Original
6222 people have browsed it

The difference between using redis publish and subscribe mode as message queue and rabbitmq:

The difference between mq and redis

##Reliability

redis: No response The mechanism ensures reliable consumption of messages. If the publisher publishes a message and there is no corresponding subscriber, the message will be lost and will not be stored in the memory;

rabbitmq: has a message consumption confirmation mechanism. If When a message is published and no consumer has consumed the queue, the message will remain in the queue until a consumer consumes the message. This ensures reliable consumption of the message. (Recommended learning:

Redis video tutorial)

Real-time performance

redis: High real-time performance, redis serves as an efficient cache server, and all data is exists in memory, so it has higher real-time performance

Consumer load balancing:

rabbitmq queue can be monitored and consumed by multiple consumers at the same time, but each Messages can only be consumed once. Due to rabbitmq's consumption confirmation mechanism, it can adjust its load according to the consumer's consumption ability;

redis publish-subscribe mode, a queue can be subscribed by multiple consumers at the same time , when a message arrives, the message will be sent to each subscriber in turn. It is a form of message broadcast. Redis itself does not load balance consumers, so there is a bottleneck in consumption efficiency;

Persistence

redis: The persistence of redis is for the entire redis cache content. It has two persistence methods: RDB and AOF (redis persistence method, subsequent updates), which can Persist the entire redis instance to disk for data backup to prevent data loss in abnormal situations.

rabbitmq: Queue, each message can be selectively persisted, the persistence granularity is smaller and more flexible;

Queue monitoring

rabbitmq A background monitoring platform has been implemented, where you can see the details of all created queues. A good background management platform can be used better by us;

redis does not have a so-called monitoring platform.

Summary

redis: lightweight, low latency, high concurrency, low reliability;

rabbitmq: heavyweight, high reliability, asynchronous , does not guarantee real-time;

rabbitmq is a specialized AMQP protocol queue. Its advantage lies in providing reliable queue services and being asynchronous, while redis is mainly used for caching and redis publish and subscribe. Modules can be used to implement timely and low-reliability functions.

For more Redis-related technical articles, please visit the

Introduction to Using Redis Database Tutorial column to learn!

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

Related labels:
mq
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!