RabbitMQ vs Kafka | Trade-off's to choose one over other | Tech Primers

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 พ.ค. 2024
  • This video covers the differences between RabbitMQ & Kafka by using an Event Driven Architecture case study
    Join this channel by contributing to the community:
    / @techprimers
    🔗 Case Study: jack-vanlightly.com/blog/2018...
    💥 Join TechPrimers Slack Community: bit.ly/JoinTechPrimers
    💥 Telegram: t.me/TechPrimers
    💥 TechPrimer HindSight (Blog): / techprimers
    💥 Website: techprimers.com
    💥 Slack Community: techprimers.slack.com
    💥 Twitter: / techprimers
    💥 Facebook: TechPrimers
    💥 GitHub: github.com/TechPrimers or techprimers.github.io/
    🎬Video Editing: FCP
    ---------------------------------------------------------------
    🔥 Disclaimer/Policy:
    The content/views/opinions posted here are solely mine and the code samples created by me are open sourced.
    You are free to use the code samples in Github after forking and you can modify it for your own use.
    All the videos posted here are copyrighted. You cannot re-distribute videos on this channel in other channels or platforms.
    #RabbitMQ #Kafka #TechPrimers
  • แนวปฏิบัติและการใช้ชีวิต

ความคิดเห็น • 91

  • @manojBadam
    @manojBadam 3 ปีที่แล้ว +37

    Thanks for the nice video. I'm new to rabbitMq couple of questions to understand it better
    1. What happens in RabbitMQ if all the consumer apps are down? will the queue persist the message until one of the consumer comes online?
    2. In rabbitMQ, how does broker knows about the eventType? does it read the. payload or there are any headers to define the eventType?
    3. If i were to have a blue-green deployment model for my consumer apps. Can we define smart rules in rabbitMq broker to send events to blue or green stack dynamically ?
    4. If my rabbitmq queue consumer died during the processing, can another consumer re-process the same message ?

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว +52

      Hi Manoj,
      Please find my response:
      1. Yes. Queue does persist and they will keep on pilling messages until the consumer drains the messages out of them.
      2. Usually this is done using the routing key. RabbitMQ uses this key to route to specific consumer queues. Using wildcard, we can easily configure one or more event Type to be consumer in a specific consumer side queue.
      3. Unfortunately, once a message is consumed its drained from the queue. You can have multiple instance of the app to consume from the same queue. that works. But you wont be able to replay the message if something goes wrong in your green instance and you want to roll back. You will have to take care of those messages from your app's end.
      4. There is a Commit message which the consumer has to send to remove that particular message from the queue. If the consumer died and did not send commit for a particular message, then yes another consumer can re-process the same message

    • @manojBadam
      @manojBadam 3 ปีที่แล้ว +3

      @@TechPrimers Thank you so much.. really appreciate your time. I see some similarities between rabbitMq and AWS SQS.

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว +3

      Not exactly but sort of. If you merge SNS with SQS you can get routing features. :)

  • @cheequsharma7391
    @cheequsharma7391 ปีที่แล้ว +2

    I was searching about the difference at so many places, but you made the search a full stop. This is no concrete and to the point Explanation. Thanks a lot mate. Subscribed for more. Thanks again , this take a lot of efforts to make such content, much appriciated . :)

  • @haleemafatima2565
    @haleemafatima2565 ปีที่แล้ว +1

    You've an excellent understanding Sir! Thank you for simplifying this

  • @mayurdugar03
    @mayurdugar03 ปีที่แล้ว +1

    Thanks man! concisely put.

  • @BrianStDenis-pj1tq
    @BrianStDenis-pj1tq 2 ปีที่แล้ว +9

    Liked. Well done, and well spoken. Question about your last point on the Kafka limitations about producer coordination regarding partitions. In my experience, producers produce to a topic, not to a partition. And, Kafka evenly distributes the messages across the partitions within the topic. In that scenario, producers don't know or care about how many partitions there are. Are you referring to a mode where producers specify or know about the partitions?

  • @bautistabaiocchi-lora1339
    @bautistabaiocchi-lora1339 2 ปีที่แล้ว +1

    thanks for the video, its exactly what I was looking for.

  • @devashishrana1637
    @devashishrana1637 7 หลายเดือนก่อน +1

    Appreciate the video :D
    I think for event distribution in case the events are decoupled you can create two separate topics in KAFKA
    1. TOPIC_EVENT_1
    2. TOPIC_EVENT_2
    Once created, you can create two consumer groups
    1. CONSUMER_TOPIC_EVENT_1_AND_2
    2. CONSUMER_TOPIC_EVENT_2
    Hence, you can add first consumer group to both 1st and 2nd topics, second to only the 2nd topic

  • @abhilash438
    @abhilash438 3 ปีที่แล้ว +4

    very well explained. You are really doing a wonderful job. These videos help a lot in understanding the concepts. I wish you good health and lots of success.

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว

      Thank you abhilash. Glad it's helpful

  • @mkbhd2
    @mkbhd2 3 ปีที่แล้ว +8

    Thanks much for putting efforts to explain things in a simpler way as always. I wish you get more viewers/subscribers that what you have right now. Only one suggestion from my end is please try to post more videos. I know it's not easy as I said, as it takes lot of your time. Thanks again!

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว +7

      Glad you found it useful Nishanth.
      Viral content is not why I'm here on youtube. :)
      Even if 5 people watch and found it useful and "relevant", thats my success. Thanks for staying connected and providing feedback.
      You should see improvements in frequency and quality soon. ;)

  • @HariHaraKumar88
    @HariHaraKumar88 3 ปีที่แล้ว +5

    Thank you for your continues efforts to educate others.

  • @CyberGenious24
    @CyberGenious24 10 หลายเดือนก่อน +1

    definitely a good comparision for a beginner to understand . thank you very much for your efforts.

    • @TechPrimers
      @TechPrimers  5 หลายเดือนก่อน

      Glad it was helpful!

  • @anuragagnihotri5238
    @anuragagnihotri5238 2 ปีที่แล้ว +3

    Thanks for the detailed video. At 07:57 , Kafka has high throughput and highly scalable. What is the comparison with Mb/sec and Req/sec and also what makes RabbitMQ having less throughput is it handling of new messages or storage layer?

  • @harbaapkabaap2040
    @harbaapkabaap2040 2 ปีที่แล้ว +3

    Thanks for the nice video! One thing is not clear, what do you mean by "streaming" in kafka? Can you show some messages in action with and without streaming? TCP/IP always streams data, so what do you mean by streaming in kafka? Also RabbitMQ also support pub/sub so the pub/sub example you showed can fit to both the tools.

  • @rhexcasas8452
    @rhexcasas8452 2 ปีที่แล้ว +1

    Thanks nice video. Easy to understand.

  • @chilukabharath4809
    @chilukabharath4809 3 ปีที่แล้ว

    the point what i am searching for 3:22 to 3:44 thank you!...

  • @sukanya4498
    @sukanya4498 2 ปีที่แล้ว +2

    Good example ! 👍🏼

  • @fdsshhfs
    @fdsshhfs 2 ปีที่แล้ว +1

    Excellent presentation

  • @chitthiaayeehai
    @chitthiaayeehai 3 ปีที่แล้ว +6

    I have not worked on RabitMQ just have done a few pocs, but Kafka hands down is the most powerful tool i have seen in my career. Spring gives out of the box integration with Kafka and u can plan ur fill application on these two monsters. Kudos !!! to u dude as always :-)

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว +12

      Yes can’t agree more. Unknown fact: RabbitMQ also is owned by Pivotal which own spring 😁

  • @haroldmurillo5165
    @haroldmurillo5165 4 หลายเดือนก่อน

    Hello! Which one would you use in a case where changes in a specific field in an Oracle database table need to be captured (Change Data Capture) and forwarded to a push notification system like Firebase? Any advices will be appreciated. Thank you.

  • @mallikarjunmannam8225
    @mallikarjunmannam8225 9 หลายเดือนก่อน +1

    Very nice explaination

  • @repotek
    @repotek 28 วันที่ผ่านมา

    Regarding RabbitMQ limitation. RabbitMQ introduced Quorum Queue for streaming

  • @sagartyagi2450
    @sagartyagi2450 2 ปีที่แล้ว +2

    About the coupling n decoupling part...how about using consumer groups?

  • @B-Billy
    @B-Billy 3 ปีที่แล้ว +1

    Thank you very much....

  • @auroshisray9140
    @auroshisray9140 2 ปีที่แล้ว +1

    Thank you !!

  • @guidogranobles
    @guidogranobles 2 ปีที่แล้ว

    Thanks for your effort creating and sharing this video. Why do you say that RabbitMQ only works with push based approach ?, as far as I know RabbitMQ supports pull based approach too.

  • @messi173xpi
    @messi173xpi 2 ปีที่แล้ว +1

    and what is better with Kafka, 1rst or 2nnd option?

  • @tayibahmed6440
    @tayibahmed6440 2 ปีที่แล้ว +9

    In the example at 6:05, you mentioned Kafka would store different event in different partitions - I guess you meant different Topics?

    • @MrXperx
      @MrXperx 2 ปีที่แล้ว +1

      Yeah, I guess he meant topic as well. Partitions for a message is decided on basis of the key provided by the producer and assigned to consumers randomly inside a consumer group.

    • @kps4881
      @kps4881 ปีที่แล้ว +1

      @@MrXperx Partitions are part of a topic. One topic can have many partitions. If we want to separate events into different partitions for a single topic we can use the event type as the hash key to ensure different event types go into different partitions. This way different consumers of a consumer group can consume different event types from different partitions.

  • @EtzMe
    @EtzMe ปีที่แล้ว

    Great.

  • @shivangitomar5557
    @shivangitomar5557 2 ปีที่แล้ว

    Great video,
    I had a question, how would you decide between choosing rabbitmq with multiple queues vs rabbitmq with direct exchange (where we can specify routing keys)?

    • @ricardotrejoruiz5776
      @ricardotrejoruiz5776 2 ปีที่แล้ว

      Rabbit is mostly used for doing async services inside the microservice ecosistem (same subnet or namespace in kubernetes) with multiple queues. Between ecosistems (different subnets) is where rabbitmq topics are used. Remember inside the same ecosistem using topics increase the amount of compute you need and the risk of crash

  • @akshay151993
    @akshay151993 2 ปีที่แล้ว

    Why can't we use RabbitMQ for a streaming use case?

  • @sanjaykumardash
    @sanjaykumardash 2 ปีที่แล้ว

    Can you please share the PPT

  • @alejandropereira
    @alejandropereira 3 ปีที่แล้ว

    I think the example for RabbitMQ in the 10:40 minute is not right. You mentioned that "Sales & Inventory" sends the "order.cancelled" and can be consumed by "billing" and "fulfillment". But, isn't that RabbitMQ cannot replay messages? My understanding says to me that if, for example, "billing" reads the event order.cancelled, then "fullfullment" will miss the message since is not going to be there anymore.

    • @deepanshu_bansal
      @deepanshu_bansal 3 ปีที่แล้ว +1

      i also have same doubt unless we use a dead letter queue for it form where replay is possible.

  • @sriaya1743
    @sriaya1743 3 ปีที่แล้ว +2

    Nice video sir, with spring cloud stream we can configure in a generic way so that we can change from rabbitmq to Kafka and vice-versa.

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว

      #Mediator 😁

    • @blasttrash
      @blasttrash 3 ปีที่แล้ว

      what about spring cloud stream?

    • @sriaya1743
      @sriaya1743 3 ปีที่แล้ว +1

      @@blasttrash oops it's cloud stream only...

  • @suhassuvvi5777
    @suhassuvvi5777 3 ปีที่แล้ว +1

    Nice video..We have one use case of using both queue and message streaming Platform..Since Kafka provides smart consumer and doesn't provide queue capability..so we are in process of deciding azure event hub for streaming and azure service bus for queue..But we are also thinking for an option of apache pulsar since it it heavy and not widely used,,we are not thinking for it..What is your suggestions for this use case please? Highly appreciate your response..

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว

      Thanks for sharing Suhas. Can you elaborate more on why you need Streaming/Queue both? Any specific reason/requirement?

    • @suhassuvvi5777
      @suhassuvvi5777 3 ปีที่แล้ว

      @@TechPrimers Thanks for the response.. We need Kafka for high throughput requirements and we need queue to have large no queue for customer specific.

  • @MA-zo6tb
    @MA-zo6tb ปีที่แล้ว

    Very good background. However I think it comes to the scenario you presented (good choice of scenario), the options presented are NOT close to real world scenarios being implemented. If someone is doing that, they don't understand the cost and technical implications from choosing either Kafka option 1 and option2. ... It would be good if you can dig deeper into the situations where there is combination, failures, and you are not offloading everything into Kafka.

  • @alirezanet
    @alirezanet 2 ปีที่แล้ว

    In a scenario where we have multiple publishers and a single consumer (2type of events only) what is your suggestion? Kafka or rabbitMQ or neither one just something like grpc.
    I am researching to choose a good tech for Log gathering system. we have a lot of loggers and the server should store all logs in the database.

    • @TechPrimers
      @TechPrimers  2 ปีที่แล้ว

      For log gathering, kafka is the best choice. Infact kafka got created as a steaming log platform

  • @ashutoshpanda3252
    @ashutoshpanda3252 3 ปีที่แล้ว +2

    Thnx bro for ur efforts to help us with latest trends in technologies.
    Would be great to have some career based video in IT.
    ♥️♥️♥️♥️♥️Luv ur work... Keep it up bro.

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว +2

      I'm just another developer like you Ashutosh. :)
      If i create career based videos, it will digress from the channel's core ideology of learning new Technologies.
      Appreciate you requesting it.

    • @ashutoshpanda3252
      @ashutoshpanda3252 3 ปีที่แล้ว

      Agree bro !

  • @invalidred
    @invalidred 2 ปีที่แล้ว

    Kafka has topics and topics have configurable amount of partitions, not sure what the video said regarding partition wrapping events, sounds technically incorrect. Also rabbit mq can be durable.

  • @stiffyBlicky
    @stiffyBlicky 2 ปีที่แล้ว

    Does RabbitMQ have some form of persistence?

  • @nghiaminh7704
    @nghiaminh7704 ปีที่แล้ว

    I still can't find any reason to not use Kafka. Not that I'm biased towards it, I'm actually trying to find a use case that Kafka doesn't fit but other message queues do. But the reasons listed here and elsewhere don't satisfy me.

  • @babe2274
    @babe2274 2 ปีที่แล้ว +3

    Thanks for the very well summed up video. Here are few queries for me
    1.Since kafka is cluster, we have high availability.Is there a way of having high availability for Queue?
    2.If kafka is down for a while,even with 1 broker,it can get all messages from the saved files of local system ,is it possible to recover mssgs if quqe is down for a while ?

    • @kps4881
      @kps4881 ปีที่แล้ว

      RabbitMQ also supports clusters for HA.
      Rabbit MQ also has persistence. So if a broker goes down and comes back up it can pick up the messages from the persistent store and start processing them.

  • @dreamcode4204
    @dreamcode4204 2 ปีที่แล้ว

    My instinct tells me for the sample study case, Kafka option 1 is the best. Agree?

  • @kamalhm-dev
    @kamalhm-dev 3 ปีที่แล้ว +2

    Can Kafka be configured to act like rabbitmq, i.e consuming event only once and will never re-consume previous events?

    • @qh97229
      @qh97229 3 ปีที่แล้ว +2

      Yes, google "kafka exact once consumer"

    • @chilledoutarmix
      @chilledoutarmix 5 หลายเดือนก่อน

      No it cannot. Apache Pulsar would be a better option for this

  • @manikantamaddipati1090
    @manikantamaddipati1090 3 ปีที่แล้ว +1

    Can you plz make a video on what the meaning of streams

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว

      Yes Mani, I did it already. Check it out here - th-cam.com/video/A3Mvy8WMk04/w-d-xo.html

  • @ShariqueMasoodplus
    @ShariqueMasoodplus 2 ปีที่แล้ว

    RabbitMq support both pull and pushed

  • @1225maddy
    @1225maddy 3 ปีที่แล้ว +1

    Need little more info. Where you said rabbit mq has smart broker and Kafka does not any rules at the broker

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว

      If you see the example i explained in between, where app2 can have separate queue with its own event topics. That’s what i mean by smart broker with routing rules

    • @1225maddy
      @1225maddy 3 ปีที่แล้ว

      Thank you.

  • @royalbhati7837
    @royalbhati7837 3 ปีที่แล้ว +1

    How are topics in Kafka different from Queues in RabbitMq?

    • @TechPrimers
      @TechPrimers  3 ปีที่แล้ว +5

      In theory both are more or less the same. However, Queues once drained, you cannot get the messages back. But in Kafka, you can get the messages if you have them retained. Kafka uses consumer groups to differentiate different consumers. RabbitMQ uses Queues to segregate consumers. This mean each consumer can get their own copy of messages (in both these platforms)

  • @nbktube1171
    @nbktube1171 3 ปีที่แล้ว

    Rabbit can also be configured to be durable... don't know why you ignored that?

  • @digisecureagent7679
    @digisecureagent7679 2 ปีที่แล้ว

    In 6:02 you can't guarantee which event goes to which partition in Kafka, so you may also have event 1 and event 2 in partition 2
    The default is round-robin fashion when key is not set, once can use specific client implementation that sets the partition, so it is not possible to do it via producer-console

    • @mohitgawande5560
      @mohitgawande5560 2 ปีที่แล้ว

      producer can generate a key per event type, which is used to select partition onto which message/event will go...

  • @rishiraj2548
    @rishiraj2548 ปีที่แล้ว

    👍

  • @niranjanyadav6454
    @niranjanyadav6454 3 ปีที่แล้ว +1

    🥰

  • @Truformable
    @Truformable 2 ปีที่แล้ว +1

    I liked this video not only because it is straight to the point made, but also because there were 666 likes and this number needs to be broken...

  • @vijayjayaram606
    @vijayjayaram606 2 ปีที่แล้ว +1

    Somehow my thinking does not go beyond kafka
    Opinionated

  • @maplebob23
    @maplebob23 3 ปีที่แล้ว +3

    What’s the easiest I
    One? The most human friendly? That’s all I care about.

  • @surajpr2521
    @surajpr2521 2 ปีที่แล้ว

    At 6min, I believe consumer cant tell kafka I read messages only from specific partition.

  • @igorshingelevich7627
    @igorshingelevich7627 ปีที่แล้ว

    Is there any "no indian education filter" in TH-cam search?

  • @jayak3768
    @jayak3768 2 ปีที่แล้ว

    Sorry your explanation does not go the depth of the use cases. For example what do you mean by Rabbit MQ is pub sub kind of model 1:18, then u say used for point to point communication and request response. If it is pub sub it is not point to point, it is publisher publishing to a specific end point with many subscribers consuming from it. So u need to elaborate on than that before moving on.
    Similarly u need to explain how smart broker works for routing the traffic in Rabbit MQ. Kafka has topics, and brokers, so what do brokers do in KAFKA, they do not route the messages/traffic.

  • @rajatmishra9993
    @rajatmishra9993 3 ปีที่แล้ว

    Rabbit MQ should not be used. It has concept of back pressure. My organization migrated all the things from RMQ to Kafka.

  • @niranjanyadav6454
    @niranjanyadav6454 3 ปีที่แล้ว

    first to like comment

  • @ziadirida
    @ziadirida 2 หลายเดือนก่อน

    Not correct

  • @desh_videsh_story
    @desh_videsh_story 12 วันที่ผ่านมา

    Bhai agar padhna hota to pdfs se padh lete thoda samjhao acche se