Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the difference between mq and redis

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces what is the difference between mq and redis, which can be used for reference by friends who need it. I hope you will learn a lot after reading this article. Next, let the editor take you to learn about it.

Use the redis publish and subscribe model as the difference between message queuing and rabbitmq:

Reliability.

Redis: there is no corresponding mechanism to guarantee the reliable consumption of messages. If the publisher publishes a message without a corresponding subscriber, the message will be lost and will not be stored in memory.

Rabbitmq: there is a message consumption confirmation mechanism. If a message is released and no consumer consumes the queue, the message will be stored in the queue until a consumer consumes the message, thus ensuring reliable consumption of the message.

Real-time performance

Redis: high real-time, redis as an efficient cache server, all the data are stored in memory, so it has higher real-time performance

Consumer load balancing:

Rabbitmq queues can be monitored by multiple consumers at the same time, but each message can only be consumed once. Because of rabbitmq's consumption confirmation mechanism, it can adjust its load according to consumers' spending power.

In redis publish and 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 broadcast form of message, and redis itself does not balance the load of consumers, so there is a bottleneck in consumption efficiency.

Persistence

Redis:redis persistence is for the content of the entire redis cache. It has two persistence methods: RDB and AOF (redis persistence and subsequent updates). The entire redis instance can be persisted to disk for data backup to prevent data loss under abnormal circumstances.

Rabbitmq: queue, each message can be selectively persisted, with smaller persistence granularity and more flexibility

Queue monitoring

Rabbitmq implements the background monitoring platform, where you can see the details of all the queues created. A good background management platform can be better used by us.

There is no so-called monitoring platform for redis.

Summary

Redis: lightweight, low latency, high concurrency, low reliability

Rabbitmq: heavyweight, highly reliable, asynchronous, no guarantee of real-time

Rabbitmq is a special AMQP protocol queue, its advantage is to provide reliable queue services, and can achieve asynchronous, while redis is mainly used for caching, redis publish and subscribe module, can be used to achieve timely, and low reliability functions.

Thank you for reading this article carefully. I hope it is helpful for everyone to share the difference between mq and redis. At the same time, I also hope you can support us, pay attention to the industry information channel, and find out if you encounter problems. Detailed solutions are waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report