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 are the differences between redis and kafka

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article is to share with you about the differences between redis and kafka. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.

The big difference between Kafka and Redis PUB/SUB is that Kafka is a complete system, while Redis PUB/SUB is just a utility-no offense to Redis, since its main function is not PUB/SUB.

Redis message push (based on distributed pub/sub) is mostly used for real-time message push and does not guarantee reliability.

Other mq and kafka are guaranteed to be reliable but have some latency (non-real-time systems have no guaranteed latency). Redis-pub/sub is emptied when power is off, and using redis-list as a message push is persistent, but it is too retarded and not completely reliable to lose.

In addition, redis publish subscriptions do not support grouping except for different topic. For example, when a thing is published in kafka, multiple subscribers can be grouped, and only one subscriber in the same group will receive the message, which can be used as a load balancer.

Redis, which is first of all an in-memory database, provides PUB/SUB function to store messages in memory (based on channel), so if your message persistence requirements are not high and the consumption capacity of back-end applications is strong, using Redis PUB/SUB is a more appropriate scenario. For example, the official website said to provide an example of an online chat room: simulate IRC, because channel is the server in IRC. Users initiate a connection, post messages to channel, and receive messages from other users. These requirements for persistence are not high, and using Redis PUB/SUB is sufficient.

Kafka is a complete system, which provides a high-throughput, distributed submission log (due to the provision of Kafka Connect and Kafka Streams, the official website of Kafka has modified itself to a distributed streaming platform, here you can also see the ambition of Kafka: -). In addition to P2P message queues, it certainly provides a PUB/SUB-style message model. Moreover, Kafka provides message persistence by default to ensure that messages are not lost (at least in most cases). In addition, because the consumption metadata is stored on the client side, consumer is given a great deal of freedom for consumption. Consumer can consume messages sequentially or re-consume previously processed messages. These are things that Redis PUB/SUB can't do.

Redis PUB/SUB usage scenarios:

1. The need for message persistence is not high

two。 Throughput requirements are not high.

3. Can tolerate data loss

4. The amount of data is small.

Kafka usage scenarios:

Scenarios other than the above:)

1. High reliability

two。 High throughput

3. High persistence

4. Diversified consumption processing model

Thank you for reading! What is the difference between redis and kafka to share here, I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.

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

Database

Wechat

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

12
Report