What is a MESSAGE QUEUE and Where is it used?

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 พ.ย. 2024

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

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

    Notes to self:
    * Servers are processing jobs in parallel.
    * A server can crash. The jobs running on the crashed server still needs to get processed.
    * A notifier constantly polls the status of each server and if a server crashes it takes ALL unfinished jobs (listed in some database) and distributes it to the rest of the servers. Because distribution uses a load balancer (with consistent hashing) duplicate processing will not occur as job_1 which might be processing on server_3 (alive) will land again on server_3, and so on.
    * This "notifier with load balancing" is a "Message Queue".

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

      Very good notes 👍

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

      I don't understand why there might be a duplicate ?
      the notifier will just query the tasks that handled by the cracked server and distribute them!

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

      @@mahmoudelrabee2456 That is true if we store the server id also. This is explained as the first approach at @4:52

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

      Consistent hashing and load balancer are 2 different things not same

    • @석상주
      @석상주 2 ปีที่แล้ว +17

      The alternative approach is, instead of assigning individual task to server, you can let servers poll from the queue. In this case, your message queue is decoupled from application servers since message queue doesn't need to know anything about servers.

  • @Montisero
    @Montisero 5 ปีที่แล้ว +910

    This guy reminds me of that friend that tries to explain and wrap up the whole semester for you 30 minutes right before the exam, because you didn't attend any lecture since the beginning.

    • @dipak2704
      @dipak2704 5 ปีที่แล้ว +19

      great comment.... the way he is explaining its really wonderful

    • @cizzlen07
      @cizzlen07 4 ปีที่แล้ว +6

      Lmao

    • @sweet1251
      @sweet1251 4 ปีที่แล้ว

      dipak sonawane r

    • @hrishihatolkar1944
      @hrishihatolkar1944 4 ปีที่แล้ว

      Exactly :)

    • @sammcalilly107
      @sammcalilly107 4 ปีที่แล้ว +10

      those people are saints

  • @anulik1985
    @anulik1985 5 ปีที่แล้ว +95

    Great job explaining everything in a way anyone can understand. You are a natural teacher! Please continue teaching and sharing your knowledge!

    • @gkcs
      @gkcs  5 ปีที่แล้ว +6

      Thank you!

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

    Former teacher turned Linux engineer here. Very well done explanation of this concept. Easy to follow with great usage of visuals and ongoing metaphor!

  • @stillthinking6357
    @stillthinking6357 11 หลายเดือนก่อน +3

    know a days People like Bhaiya and didi on linkdln those who are giving lecture on system design other bla bla.. even don't know how to code, have more subscribers than this genuine talent. Hats of bro.😃

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

      👍

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

    Explained the whole thing in literally the first 40 seconds. Truly amazing work!

  • @AhmadSayeed-plus
    @AhmadSayeed-plus 4 ปีที่แล้ว +3

    I am a java dev. For learning purpose I am planning to make queue system. But from your video i got idea that JMS is something I should learn now. Thanks Gaurav.

  • @mahendrajadav2286
    @mahendrajadav2286 8 หลายเดือนก่อน +3

    "Now I know everything about how to run a restaurant; I will be starting my own restaurant very soon."
    Thanks to the legend Gaurav.

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

    Brother, I've been researching about message queues and I was so confused until I saw your video, thanks alot!

  • @himanshuchawla6754
    @himanshuchawla6754 4 หลายเดือนก่อน +1

    As I am watching the videos , I am able to predict what you are going to say/do now, like a movie, Awesome explanation !! more power to you Chap !!

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

    kya to samjaya hai Gaurav, maza aa gaya.. Such precise explanation is so rare on online tutorials.

  • @hfontanez98
    @hfontanez98 4 ปีที่แล้ว +28

    EXCELLENT job in all areas: Simplifying the use cases for explaining easily to non-experts, very VERY close examples to real-world instead of using hypothetical cases, starting from simple (in memory) to more complex approach (with database), and avoiding super technical jargon; yet not shying away from technical details (i.e. load balancing, hashing, etc.)
    Well done Gaurav!! I enjoyed this video.

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

      well said.

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

    When to use a Topic vs a Que would have been a nice addition.

  • @ish1285
    @ish1285 4 ปีที่แล้ว +28

    This was the best video so far. The way you explained the entire stuff without saying Message Queue the whole time awakened my grey cells. Thanks a lot!

  • @rishabhagarwal9871
    @rishabhagarwal9871 6 ปีที่แล้ว +14

    Hi Gaurav, This is the one of the best real life example (with pizza shop) showing the need of asynchronous request/response system. Thanks for the great video. Really loved it.

    • @gkcs
      @gkcs  6 ปีที่แล้ว

      Thanks!

  • @dilawarmulla6293
    @dilawarmulla6293 6 ปีที่แล้ว +72

    There are very less resource available for system design in youtube so please complete series . I like the way you teach. Thanks for making videos for us. God bless you

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

      Thanks Sameer :)

    • @Thrillseeker666
      @Thrillseeker666 5 ปีที่แล้ว +4

      "Very less", Very few. Indian English is hilarious though.

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

    I like the sheer excitement with which the topic is delivered!! Kudos!!

  • @mokonzi2K6
    @mokonzi2K6 6 ปีที่แล้ว +5

    Message queue is getting lots of spot light in the industry, please keep making the video on this topic i like you way of teaching. thanks again.

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

    As a European developer that has seen too much low-quality programming disasters from projects outsourced to low-wage Asian country developers, I must say that it's refreshing to see an Indian engineer that has actually studied for this stuff and knows what he's talking about, using the correct terminology... I'm subscribing; you're creating great content.

    • @srinathrachapudi
      @srinathrachapudi 5 ปีที่แล้ว

      Low-quality programmers are everywhere not just in Asia.

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

    Owsome👌👌 keep it up. Thank you🙏

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

      Thank you!

  • @irynasherepot9882
    @irynasherepot9882 4 ปีที่แล้ว +19

    Thank you! Your tutorials are great! My college did not have System Design and Analysis class, and your videos helped to learn a lot.

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

    The concept has been explained very clearly. It would be great if you would come with practical implementation using NodeJS with any MQ

  • @pratikbhandarkar25
    @pratikbhandarkar25 5 ปีที่แล้ว +16

    Great video! This video explains the system design of a pizza shop very well. However, it spends a lot of time explaining load balancers and the notifier and very few minutes are dedicated to discussing message queues. I am more interested in the actual use of message queues in real-world systems like pizza shop here.

  • @iitgupta2010
    @iitgupta2010 5 ปีที่แล้ว +7

    this is the first time I found the wrong explanation.
    1. Once you have notified and it found that server 3 is dead then it can give that specific task to "assigner" node which basically divides the task and share between other nearest server to that location (it is important).
    2. Each shop has to maintain his own task queue and "assigner node" would add those task in that queue based on priority ( but this will be least among its own task, as it requires to completes own task first then other. )
    3. there is no use of centralized queue, until n unless you provide a feature to the pizza shop and based on user location pizza shop automatically (user did not select the shop which is always the case in dominoes at least) assign this task to the nearest shop.
    4. Load balancer (if you were talking about the actual load balancer between servers) is no use for the assignment, as its responsibility to just equally divides the task across multiple servers within the same region for which this load balancer responsible for.

  • @mamiferuD
    @mamiferuD 4 ปีที่แล้ว

    not trying anything but a lot of indians are really smart. keep it up bro.

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

    Nice narration..!! My pizza just got delivered under 30min

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

    Amazing explanation Gaurav. The best way to explain any concept is with practical examples, and you did the same.

  • @AshitaAgrawal-j7g
    @AshitaAgrawal-j7g 10 วันที่ผ่านมา

    One of the best explanations. Thank you so much

    • @gkcs
      @gkcs  10 วันที่ผ่านมา

      Thank you!

  • @MubashirAR
    @MubashirAR 5 ปีที่แล้ว +43

    The only youtuber that keeps his video at 9:59

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

      Hahaha

    • @danielk8452
      @danielk8452 5 ปีที่แล้ว

      HAHAHAHAHAHAHA

    • @rtwkkumar20
      @rtwkkumar20 5 ปีที่แล้ว

      haha :?

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

      back in the golden days of youtube everybody made videos to make videos, not to make money

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

    great clear presentation!
    one tip: use higher contrast ink and board.
    So that means more lighting to make the board more lighter/white
    and/or using dark ink like black or brown so we can see it more clearly.
    great content. subscribed. keep up the good work!

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

    I've learnt a heck of a lot about how pizza shops work

  • @NohandleReqd
    @NohandleReqd 4 ปีที่แล้ว +172

    Are we just going to ignore the fact that 9 / 11 were pointing at the same server and THAT was the server that crashed! :P Your lectures are fun man!

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

      Illuminati confirmed! Well done.

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

      nahh bro!
      no way u noticed this lol
      I didn't even think of this 😂

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

    Hi Gaurav, loved your explanation. But I think, here you've mixed up related but different concepts.
    You are actually creating a storm topology with input from a kafka queue. The order queue is a message queue (say kafka). Storm topology is polling messages from the order queue & is assigning the tasks to one of the worker nodes (pizza shops) & is internally keeping track of task status using a task queue & using hearbeats (by using a zookeeper) to check whether nodes (pizza shops) are alive or not & if not assign the unfinished tasks on that worker node to a different worker node.

    • @gkcs
      @gkcs  4 ปีที่แล้ว

      Yes. What about the reallocation of tasks though?

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

    Hey Gaurav, appreciate your awesome work. my point is as you gave example if a pizza shop is down. what i think there will be no server on shop side and a shop has a client id only
    servers must be at remote location.
    orders object must have a client id.
    there must be process on server side that check heartbeat of client with an associated client id. if that client id down ( clients spawn a heartbeat thread to server and server checks heartbeat from client) then it will do the rest of things your explained done by your notifier component to assign the orders ( to client having nearest to client which is down)

    • @gkcs
      @gkcs  5 ปีที่แล้ว

      Thanks Vishal! Have a look at the full playlist. I do speak of it as you mentioned

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

    Your channel is amazing. Your explanations are some of the best I’ve ever heard/seen. Good job man.

  • @destructaphoenix6679
    @destructaphoenix6679 11 หลายเดือนก่อน +2

    4:42 hmmmmmm interesting choice of numbers and words

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

    Dude, you should get a Ph.D. for this... made it easy to understand. Thanks for sharing.

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

    Everyday you learn something new!
    I always thought PS3 stood for PlaStation 3, but here I learn that it stands for PizzaShop 3.

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

    You don't necessarily need to assign a task to a specific server. A server that is ready can go and pull the pizza order from the queue and process it.
    It is much faster

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

      But what if a task was pulled , was in progress and then the server crashes , how do we make sure that this task, is again pulled by any up & running servers ?

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

      @@kanishkamakhija9046 Notifier(which does the heartbeat check) could detect whether a server has crashed and mark the corresponding tasks to be unassigned.
      Alternatively, a timeout could be added to each assigned task and if the in process task times out we remark it as unassigned and pick some alive server to handle it.

    • @석상주
      @석상주 2 ปีที่แล้ว

      I also saw another approach where you can maintain a separate queue that holds in-progress tasks. If the server crashes, any other server can pick up tasks from the corresponding queue.

  • @rajeev812
    @rajeev812 5 ปีที่แล้ว +11

    Gaurav, this is really a nice and knowledgeable tutorial you have made, in very sort time you have explained this topic very clearly. Can you try to make it as a practical ( how to implement RabbitMQ)

  • @Llink4n
    @Llink4n 11 หลายเดือนก่อน +1

    You explained it so well, thank you

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

    It's an amazing talk.
    Here's a follow-up question.
    What if the message queue goes down to be a single failure? Should we have the message queue with hot backup such as Active-Passive mode?

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

      That is where the persistence of data comes into play. In order to keep reliability of the messages high, most message queues offer the ability to persist all messages to disk until they have been received and completed by the consumer(s). Even if the applications or the message queue itself happens to crash, the messages are safe and will be accessible to consumers as soon as the system is operational.

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

    Gaurav, fantastic job with explaining the key tenants of high-level system design; how about bringing in some tooling and technology stack to support each of the architectures.

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

    thanks for the informative presentation

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

      Glad it was helpful!

  • @dianecoffee4467
    @dianecoffee4467 4 ปีที่แล้ว

    Excellent and lite tutorial on messaging and load balancing

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

    for each system design if a detailed explaination is there, then, it will be helpful for all becoz i think i can learn system designs from you
    thank you for your extraordinary work

    • @gkcs
      @gkcs  6 ปีที่แล้ว

      Thanks David :)

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

    Your charisma and you way of teaching gain me to be your subscriber :)

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

    great explantaion!

  • @thatonichan
    @thatonichan 27 วันที่ผ่านมา

    4:43 is my most favourite part of the video

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

    Nice explanation. You are actually doing excellent work. Thank you.

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

    Dear Gaurav Sir, please clarify 2 things please:
    (1) can you give a practical implementation of RabbitMQ or JMS or any one of the Message Queues?
    (2) Also, please explain more on Load Balancer with consistent hashing and notifier, with a practical example please?
    Please kindly reply to this.

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

      th-cam.com/play/PLMCXHnjXnTnvo6alSjVkgxV-VH6EPyvoX.html

  • @amruthlal1394
    @amruthlal1394 5 ปีที่แล้ว +4

    Hey Gaurav, you explained the concepts behind services provided by a message/task queue neatly. Your system design series is extremely useful for beginners like me. Keep up the good work.
    I have a small suggestion regarding the pizza example. In the scenario of a pizza shop node failure, the load balancer may consider other factors such as geographic proximity of a particular shop to the clients location. Hence the dynamic reallocation of requests by load balancer also includes some business logic. This makes the example a little bit complex for explaining the purpose of message queue. Please do consider finding out more simple examples which serves the purpose without additional complexity in future videos

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

      That's a good point.
      I took up the example since I wanted to point the simple way of going about designing a system. 😁

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

    Again, thanks so much for taking the time to make this video. I've learned a lot from you. Keep it up!

    • @gkcs
      @gkcs  5 ปีที่แล้ว

      😁

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

    If you could cover on the concepts of real time operating systems- which includes tasks, task states, ,message queues and mailboxes etc..., It will be definetely helpful for me and for those who are interested in embedded computing and RTOS...

  • @akshadrathod9203
    @akshadrathod9203 5 หลายเดือนก่อน +1

    Nicely explain

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

    Nicely done Gaurav!! Once again... :)

  • @barimohammedabdul5166
    @barimohammedabdul5166 4 ปีที่แล้ว

    Explained the concept really well , easy to understand

  • @SandhyaSubramani14
    @SandhyaSubramani14 8 หลายเดือนก่อน +1

    Haha, all this talk of food is giving me pizza cravings!

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

    Very well explained👍 ..If possible please make a video or two on Kafka Queues( involving Producer n Consumer ) ..This would serve as an example for for few of your previous videos on MQ,Load Balancing,Event Driven Systems..This would help them put together..

    • @gkcs
      @gkcs  6 ปีที่แล้ว

      I have this in my task list. It'll take time to get to it though :)

    • @vaibhavkulkarni7932
      @vaibhavkulkarni7932 6 ปีที่แล้ว

      Cool!!!!

  • @mukeshbarman
    @mukeshbarman 5 ปีที่แล้ว +21

    In a typical System design interview: Dabbe banao dabbe.. :D

  • @TheNumberEight
    @TheNumberEight 6 ปีที่แล้ว

    I'm self taught and system design is not an area that I seem to be learning from documentation (and that makes sense, it isn't relevant to synatx or features of most technologies). Thank you for providing this material! You're decent to good at teaching, but mostly you're providing resources that are difficult to acquire outside a classroom or without a mentor.

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

    banks, thats a fairly common use case that uses messaging services/queues extensively.
    batch processing transactions, after the card scheme authorises your tx and the request is send to the issuing bank, the entire xml message is stacked up on a messaging queue that is being constantly listened to by the issuing bank messaging service

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

    @Gaurav Sen Very informative video! I request you to make a video or videos about every component of any system design. Different problems employ different components. If we first study all the different components and their properties then at least we can stay thinking in right direction. Thanks for your video series!

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

    Very good job. I had so many confusion you just cleared

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

    Thanks for the valuable video! It really helps me to understand what the message queue is :)

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

    so smart the way he is explaining. keep it up man

  • @AnirbanRoyChowdhury1987
    @AnirbanRoyChowdhury1987 4 ปีที่แล้ว

    Really good video. Khub valo laglo dekhe.

  • @anindachatterjee8904
    @anindachatterjee8904 4 ปีที่แล้ว

    Nicely and simply explained

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

    Short.. To the point.. Brilliant 👍

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

    Very giid analogies and articulation of topics..gr8 wrk.

  • @amanbhardwaj5318
    @amanbhardwaj5318 6 ปีที่แล้ว +167

    Hi Gaurav , can we have server id as one of the columns in the table and use that also while querying the DB , so that it picks only the undone orders by that server(dead server) only, and rest can be taken care by the load balancers which is distributing the load ?

    • @gkcs
      @gkcs  6 ปีที่แล้ว +298

      We could, but wouldn't that complicate things? For example: A job is initially assigned to S0, then reassigned to S1 after S0 crashes. Now S1 crashes. The way to keep track of S1's jobs would be to update the server id on the DB. It's an extra update operation.
      Now let's say a new requirement comes of evenly distributed load. In this case, when a new server comes up, it will take jobs from others. The db will again have to be updated.
      Consistent Hashing seems like a cleaner solution :)

    • @Chan123mishra
      @Chan123mishra 6 ปีที่แล้ว +17

      Nice explanation Gaurav, I was stuck on this only.

    • @amanbhardwaj5318
      @amanbhardwaj5318 6 ปีที่แล้ว +18

      Yes, may be it requires querying DB more often to update the server ids. Its better to follow the principle of load balancing which implements the uniqueness.
      Thanks. :)

    • @shiwanggupta8608
      @shiwanggupta8608 6 ปีที่แล้ว +11

      But, if we are not maintaining system id along with each order, then whenever a server dies, we have to again see for all the orders, their nearest server. But, if we have server ids along with them then we would only have to assign the orders which are initially handled by the server that died.
      If a new server is added, then we have to anyway check all the entries, then its fine but when a server dies wouldn't maintaining server id's would reduce our work. Anyways great video..!! thanks.

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

      @@shiwanggupta8608 I agree, also let's say you are very large chain, and have thousands of orders in process at any given time, going though all of them seems a waste of time, when you can differentiate by just the server id.

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

    4:42 I'd never thought I would hear the number 9, 11, and the word crash in the same sentence

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

    Very clear explanation. Thank you

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

    Really nice explanation, impressive.

  • @ShubhamSingh-ku2ow
    @ShubhamSingh-ku2ow 6 ปีที่แล้ว +26

    Bro, keep bringing up more videos like this. We are all such a big fan of yours. ALL the best! 👍
    PS: Amazon has SQS ;)

  • @manaswitadatta
    @manaswitadatta 5 ปีที่แล้ว +54

    Please make one video on Kafka. Appreciate your work.

    • @mahesh_kndpl
      @mahesh_kndpl 5 ปีที่แล้ว

      Check learning journal challenge for Kafka video.

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

    Thanks for the video. How RabbitMQ handles messages in the Kubernetes cluster? Please create a video on this topic.

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

    Good Teaching!!! Keep it up with great work

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

    We would like to have videos on object-oriented design patterns too like observer pattern etc.
    Please keep making videos. :D

    • @redpillsatori3020
      @redpillsatori3020 4 ปีที่แล้ว

      OOP is overrated and people are finally moving towards functional programming with NodeJS and React as some common examples

  • @gauravmaithani4707
    @gauravmaithani4707 4 ปีที่แล้ว +28

    "Filling up the coke can" 2:20 haha. Love your videos bro.

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

      his expressions are hilarious !

  • @timetogrow1306
    @timetogrow1306 4 ปีที่แล้ว

    Dude your voice nd communication soo good

    • @gkcs
      @gkcs  4 ปีที่แล้ว

      😁

  • @Waruto
    @Waruto 5 ปีที่แล้ว +17

    Hey Guarav, I am curious. If S3 (server 3) went down, can't traffic 9 and traffic 11 be identified as the ones that need rerouting if the database table had a column specifying which server it was routed to? That way we can query in the DB for requests that were lost by losing S3 instead of querying for all requests that have not finished yet.

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

      IMHO, the main reason is we don't need to store server to tasks "permanently", the info is not useful comparing to task state/description, .etc, or in short, it's unrelated to the task itself.
      If we really want to identify server tasks, we could introduce another DB to store a map from server to in progress tasks, but it's an overkill and more complicated than using a timeout on each task in the queue.

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

      @@bozhang8910 don't you want to see the report who failed frequently and tracking who's serving which item which can help to identify the poor performing outlets.. in case of other use cases where the customer does not need to know which server it delivers the request then your justification is good but incase of pizza deliver i dont think so

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

      @@bozhang8910 You don't need another database, just another column. And there are other reasons to do this. Consider three pizza shops, p1, p2, and p3 where p1 and p2 are very close to each other and p3 is on another continent. If p1 goes down, sending its jobs to p3 would be a disaster, so if the table has a column for the server and a column for its nearest neighbor, the queue can dispatch in a way that doesn't involve transoceanic pizza delivery. A real life example would be CDNs for which the entire point is to find a replica of an asset which is closest to the client for performance reasons. Others would be geographic (like maps) or internationalized/localized services where the location can be inferred from the language.

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

    Hello Gaurav, nice and informative video. I have couple of questions:
    Q1: Fi sysA publishes a message to a queue, SysB and sysC are clients. If sysC restarted and missed few messages, When it recovers how can it claim the missed messages? without having sysB receiving duplicate messages.
    Q2: SysA publishes messages but sometimes not in order.
    SysB consumes messages.
    How we guarantee sysB gets them in order?
    looking forward to hearing your thoughts.
    Cheers

  • @137601
    @137601 5 ปีที่แล้ว +4

    Great video! One minor tweak I'd make, rather than pushing tasks to the server why not have the servers pull tasks from the queue. No need for a load balancer and you can spin up new server instances without any bookkeeping or overhead.

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

      Thanks Kyle!
      Having subscribers pull from the queue would make it (more or less) stateless, which is great. However, when you want your subscribers to immediately be notified on a new task, I'd have the queue pushing messages.
      I think a hybrid model is best, where most servers poll for messages while some expect them to be pushed to them.

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

      @@gkcs That makes sense

  • @SudeepDasguptaiginition
    @SudeepDasguptaiginition 5 ปีที่แล้ว

    messaging queue needs more channels to execute vast messages, if you use kafka then you need more partition or topics to handle huge messages execution per second. In stock broking we get more and more vast messages per seconds from lots of dealers and customers.

  • @VikramThakur8
    @VikramThakur8 4 ปีที่แล้ว

    Gaurav! Its good conceptually. Thanks

  • @cyrilrajc
    @cyrilrajc 4 ปีที่แล้ว

    Thats an excellent explanation Gaurav.. Thank you.

  • @mistercakes
    @mistercakes 4 ปีที่แล้ว

    Hi Gaurav,
    Love all the videos and the easily contextualized examples. When you mention load balancing as a solution for deduplication, it wasn't clear how load balancing does solve for this issue. You mention that there are 5 items in the list (3, 8, 20, 9, 11) and 9 and 11 need to be rerouted. The notifier identifies that a server is down and the database is queried to identify which items have not been finished.
    1) instead of using a load balancer, couldn't we just have additional field in the database for pending? then only items with pending = 0 could be rerouted. (my guess is you'll mention that it's not necessary based on your load balancing solution, or that we will need load balancing regardless.
    2) i'm not sure how the load balancing prevents items that are already pending in the still functioning servers are not deduplicated. (one pizza order made two times) could you go into a little more detail on how the load balancing prevents that?
    Thanks again!

    • @mistercakes
      @mistercakes 4 ปีที่แล้ว

      to better my question, when balancing the load -> how does it know which requests don't need to be redistributed (eg, the items from servers 0, 1, 2)? is it querying all the servers first to know where the remaining load needs to be distributed?

  • @muhammedshafeeh9133
    @muhammedshafeeh9133 4 ปีที่แล้ว

    Oh manh you are better than IIT professors

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

    Hi Gaurav,
    In the video you mentioned that we can prioritise the list within the queue based on the request.. My question is how and on what basis we can rearrange the elements in the queue and what collection are we using for implementing such scenarios..
    Thanks

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

      PriorityQueue in Java
      A PriorityQueue is used when the objects are supposed to be processed based on the priority. It is known that a Queue follows the First-In-First-Out algorithm, but sometimes the elements of the queue are needed to be processed according to the priority, that’s when the PriorityQueue comes into play.

  • @ShaanGola
    @ShaanGola 5 ปีที่แล้ว

    Hi Gaurav,
    I'm glad you have discuss about RabbitMq. I just came over to explore more about this topic ...I just want to know more about how to monitor microservices in rabbitmq..I'm able to know more about the application architecture and implementation after watching your videos. can we have ellaborate discussion over this i'm stuck somewhere in rabbitmq.

  • @大盗江南
    @大盗江南 5 ปีที่แล้ว +2

    Hello, really grateful for ur video, really. But May I give u little suggestion ? I’m backend dev, and new to system design. Sometimes I can’t understand what u r trying to explain. U speak then u stop then speak then stop. I think maybe things would get better when u try to explain things more fluently ? Again, really grateful for ur videos. Just really want to understand every video u shares with us😬 thx!

    • @gkcs
      @gkcs  5 ปีที่แล้ว

      Thanks! I'll try and keep that in mind :)

  • @pratyush2604
    @pratyush2604 5 ปีที่แล้ว +190

    I was disappointed to not see anyone appreciating the 9/11 crashing pun at 4:36 lolll

    • @gkcs
      @gkcs  5 ปีที่แล้ว +32

      🙈😂

    • @amber11
      @amber11 5 ปีที่แล้ว +12

      same. came to see if anyone commented :D

    • @darshanbari2439
      @darshanbari2439 5 ปีที่แล้ว +14

      @@gkcs i assume it was unintentional

    • @628sonu
      @628sonu 5 ปีที่แล้ว +1

      omg 😂😂😂😂

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

      Lmao.

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

    Please create a video over HermesJMS. This video was really helpful in getting the basics of MQ

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

    Excellent explanation.
    Thanks

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

    Amazing explanation! Thanks!

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

      You're welcome!

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

    Hi Gaurav, great explanatory video.
    We used rabbitMQ to build sort of a cron scheduler.
    The issue previously was in case of multiple instances of the same app server how do you ensure a cron job is executed only once irrespective of which instance executes it. Do you think we made the right choice?

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

      I think it's a good choice. Does RabbitMQ give an exactly-once delivered feature?

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

      @@gkcs Yes, it provides acknowledgement and also an option to send message to only one or all subscribers to a queue.
      We had to choose between this or using redis and implementing some sort of semaphore.
      Thanks for responding :)

  • @AmanSharma-hi3fd
    @AmanSharma-hi3fd 3 ปีที่แล้ว

    Thanks a lot for the content. Even I discussed the same heartbeat like mechanism (Got the idea from the video :P) in an interview. It was really helpful!

  • @sat1478
    @sat1478 5 ปีที่แล้ว

    You are the best teacher. Thank you very much.