How load balancers work - System Design Interview knowledge [Beyond the interview]

Поделиться
HTML-код
  • Опубликовано: 10 сен 2024
  • Knowing about how a load balancer works is important for most software engineers. Load balancing algorithms and techniques can be useful for your next system design interview too. Besides that, it quite interesting!
    This video covers load balancing algorithms, how Google uses load balancing and traffic routing, a real word load balancing example for a web application, stateful load balancing and consistent hashing for load balancing.
    Google book about site reliability engineering: landing.google...
    Consistent hashing paper: www.akamai.com...
    The SiT is also on IG TV / successintech
    -- SOCIAL MEDIA --
    / successintech
    / successintech
    www.successint...
    / successintech
    Music: Koalips
    Music: Night Owl - Broke For Free
    Music: Bensound

Комментарии • 82

  • @SuccessinTech
    @SuccessinTech  5 лет назад +36

    You all got it right, network is layer 3 in OSI. My bad! ;)

    • @AhmadAli-xy8pm
      @AhmadAli-xy8pm 5 лет назад

      Need help regarding Final Year Project "Soft Load balancer (SLB)" using open flow SDN. Please reply

    • @monafarhangi3516
      @monafarhangi3516 2 года назад

      but you were right that we have layer 4 or 7 LBs. Layer 4 LBs are transport layer LBs. They work based on Network/transport (IPs/Ports)

  • @melihmtl
    @melihmtl 5 лет назад +10

    I was just asked this question in an interview. RUclips recommended that video just after my interview. I wish I would have seen it before 😬

    • @TheIaluma
      @TheIaluma 5 лет назад +1

      What was the question, they ask you again, if you still remember exactly.
      I was in an interview where the interviewer himself download the questions & answers online, so this guy himself doesn't know shit but relied on online technical questions & answers. Very frustrating for men that day.

  • @yodude2493
    @yodude2493 2 года назад

    that purest contend I've ever seen in the Universe

  • @mohmedishak8853
    @mohmedishak8853 3 года назад +1

    Late to the party but this guy is genius!

  • @JoyLong
    @JoyLong 5 лет назад +3

    Network is layer 3 on OSI model , TCP/IP layer 4 is transport

  • @pharaoh9483
    @pharaoh9483 6 месяцев назад

    1:31 layer 4 is Transport, Layer 3 is Network

  • @sunny-14689
    @sunny-14689 2 года назад

    What is difference berween L4 and L7 if both are routing based on clientIp, just that L4 maintains ip tables and L7 hashes client IP ? So won't both doing same thing eventually ?

  • @vadymmishchenko67
    @vadymmishchenko67 3 года назад +1

    3:20 "both http servers on same ip and port" ? how is that possible ?

    • @amitb2921
      @amitb2921 3 года назад

      Same question here. This is not possible

    • @sunny-14689
      @sunny-14689 2 года назад

      Same question +1

  • @uttampankaj
    @uttampankaj 6 лет назад +1

    Great intro. Please make a video on how database work internally. How data is stored in database? Which data structures are used ?

  • @yuganderkrishansingh3733
    @yuganderkrishansingh3733 4 года назад

    3:27 IMHO is incorrect. It's not possible for two servers to run on same port unless the protocol is different. So two HTTP servers cannot bind to same port on a single backend server. The second HTTP server trying to bind to port will get the error - Address already in use.

  • @bzaruk
    @bzaruk 2 года назад

    Great video! thank you!! - one note though, and pls correct me if I'm wrong, two applications (servers) can listen to the same port at the same server instance as you mentioned 3:20

  • @MrOdedherbst
    @MrOdedherbst 3 года назад

    Thank you :) Good work, very good presentation, clean and to the point !!!

  • @christophersanders7483
    @christophersanders7483 4 года назад

    Great video like all the others which have taught me more than many others

  • @SatyaprasadMr
    @SatyaprasadMr 4 года назад

    Nice Explanation. Really helpful. It would be helpful If you can make a video on "how to implement custom Load Balancer?" Now a days I could see it's a one of the interview question. Thanks for your support.

  • @diehardspidey
    @diehardspidey 6 лет назад +9

    Network is level 3? If I am not wrong ?

    • @gleventhal
      @gleventhal 5 лет назад +1

      Yes, 4 is Transport, I came here to say that and found your comment first.

    • @abcvictro
      @abcvictro 5 лет назад

      but he is talking about the ports which operates at layer 4

    • @danielbenisti3664
      @danielbenisti3664 5 лет назад

      in the second i herd it .
      i stopped the video and was ready to leave a comment until i saw all the comments about this lol

    • @prasadshelar7498
      @prasadshelar7498 5 лет назад

      Hi deepesh load balacer is work on layer 4 because it forward traffic based on IP plus TCP or UDP port . if traffic is http then it will forward traffic based on http request ip plus port no 80 . so LB consider IP plus http port no so it is layer 4

  • @jacob5253
    @jacob5253 5 лет назад +3

    How to avoid single point failures? Replica with a master and slave model?

  • @cherie12112
    @cherie12112 6 лет назад

    thanks for all your amazing informational videos!

  • @talivanov93
    @talivanov93 4 года назад

    Thank you for the great explanation!

  • @rafiresearchgroup3994
    @rafiresearchgroup3994 4 года назад +1

    How to avoid single point failures? I was also wondering what is the solution....

    • @anujverma1187
      @anujverma1187 4 года назад

      I think the solution will be .. the use of redundant load balancers

  • @yuganderkrishansingh3733
    @yuganderkrishansingh3733 4 года назад

    Best video. Learned a lot.

  • @maxwelltaylor3544
    @maxwelltaylor3544 6 лет назад +1

    Great introduction. Leads me in the right direction.!

  • @tacowilco7515
    @tacowilco7515 4 года назад

    What do you mean when you say that Front End take an RPC call?
    This is confusing

    • @mkhantxut
      @mkhantxut 4 года назад

      Please review this. grpc.io/

  • @Sandermatt87
    @Sandermatt87 6 лет назад

    12:20 You say the hash function depends on the available servers. What if the same users connects again, but the available servers have changed? Will the user now be hashed to a new server, despite his originally assigned server maybe still being available.
    Edit: solved later on in the video.

  • @Jack-bh5rw
    @Jack-bh5rw 4 года назад

    This video is very informative, Thank you.

  • @hahmadzai23
    @hahmadzai23 5 лет назад +1

    Can you please make a similar video but for DNS?

  • @HailayKidu
    @HailayKidu 5 лет назад

    This is very nice video about LB,
    Can you please show us how load balancer can be applicable in IOT ?

  • @MrMukulj
    @MrMukulj 5 лет назад

    How can two HTTP servers be running on the same backend on the same port 80 ? check out at time 3:15

  • @PetrShypila
    @PetrShypila 6 лет назад

    Thanks for the video. Right now preparing for the interview. At the end you mention single point failure problem. What would be your suggestion on eliminating it? Just a quick thought is doing LB state backups/replica with a health checks so as soon as it crashes we could restart or quickly switch with a backup.

    • @TheVinitsaini
      @TheVinitsaini 5 лет назад +1

      You might wanna see "elastic load balancer"! Amazon ELB papers.

  • @tomerz9
    @tomerz9 4 года назад

    great video, thanks!

  • @buttegowda
    @buttegowda 5 лет назад

    Sir, This is the best video I have seen on LB. One question: If we have a number of users asking for video streaming, all this video traffic generated by servers will have to traverse from servers to LB and then from LB to the users. This kind of double load on the LB, will that be taken into account for design ? What design alternatives are there ?

    • @TheVinitsaini
      @TheVinitsaini 5 лет назад +6

      Usually such kind of heavy (media) traffic is routed through CDN systems. Reverse proxies returns just the path to the media server (CDN) from where content is downloaded directly to the client's machines via dedicated connections/protocols like websockets

    • @buttegowda
      @buttegowda 5 лет назад

      @@TheVinitsaini Thank you

  • @floopy312
    @floopy312 5 лет назад

    I don't understand the hashing part, what is it you're hashing and why is it important to hash it?

    • @SuccessinTech
      @SuccessinTech  5 лет назад +1

      One of the usages of hashing is to enable statefulness on the LB level. Give this a read www.citrix.com/blogs/2010/09/04/load-balancing-hash-method/

  • @itlearner1175
    @itlearner1175 3 года назад

    Does this mean that load balancer is a single point failure? Can't we have replicas of it?

    • @SuccessinTech
      @SuccessinTech  3 года назад +1

      You can. You can read up on the way AWS Elastic Load Balancing works as an example :)

  • @engrkn
    @engrkn 4 года назад

    great explanation!

  • @bakariholmes4440
    @bakariholmes4440 5 лет назад

    So how can the single point of failure be addressed when using load balancers?

    • @SuccessinTech
      @SuccessinTech  5 лет назад +2

      I‘d say you have a few options. For example layered load balancing with DNS

  • @bibhu_107
    @bibhu_107 2 года назад

    Nice 👍

  • @andriirubtsov5404
    @andriirubtsov5404 6 лет назад +2

    Good summary

    • @SuccessinTech
      @SuccessinTech  6 лет назад +1

      Glad you like it! If you want to support the channel and future content please share my videos and spread the word on your social media =)

  • @stoneshou
    @stoneshou 5 лет назад

    Could you give hint on how spof is handled for lb?

  • @seanstutsman1935
    @seanstutsman1935 6 лет назад +1

    Hi! In love with your videos😀

  • @ethansherr3281
    @ethansherr3281 3 года назад

    You hinted that if using naive Least Connections, or Round Robin, you may send multiple requests from the same user to different machines & then quickly said that such a behavior could mess up your replication. I'm a little confused what you mean by that. I think it could be corrected by having your app services (that are routed to after load balancing) contain a lot of in memory caches, and instead use a distributed cache. What kind of a system would have replication problems? Also what are the replication problems? ...

  • @yasserakbbach7342
    @yasserakbbach7342 4 года назад

    is that mean all backend servers save the same data of a single user 🤔?

  • @RaviChandraEnaganti
    @RaviChandraEnaganti 6 лет назад

    Going into details, how does the load balancer know the number of connections in each individual server? Where will this information be stored? at the balancer or the server itself? only a count of connections, or will they be stored as a queue?

    • @SuccessinTech
      @SuccessinTech  6 лет назад +1

      The LB will need to know about the state of each server. It uses periodic health checks for that purpose.

    • @wenlaizhang9017
      @wenlaizhang9017 5 лет назад

      @@SuccessinTech Does it use ZooKeeper to store the state of each server ?

  • @05burky
    @05burky 5 лет назад

    So how would you mitigate against the single point of failure nature of a load balancer? Anyone please

    • @assassin62nd
      @assassin62nd 5 лет назад

      quite easy to answer: VRRP and Session synchronization! Every VIP on a ADC has it own VRRP Group

  • @codetolive27
    @codetolive27 5 лет назад

    Good one. Thanks for sharing 👍

  • @JehanzebNaeemKhan
    @JehanzebNaeemKhan 3 года назад

    Is it Vancouver in the background?

  • @ricardaefffler9514
    @ricardaefffler9514 6 лет назад

    Hey there!! In love with your content 😻

    • @SuccessinTech
      @SuccessinTech  6 лет назад

      Hey! Glad you like it :D Share it on your social media if you want to support the channel 😋

  • @iamravishank
    @iamravishank 4 года назад

    Very nice video.

  • @joey9903
    @joey9903 3 года назад

    Look likes you threw the sausage pizza away lol

  • @tacowilco7515
    @tacowilco7515 4 года назад

    SSL termination and the translating to RPC ... whaaaaat ?

  • @managerbmr
    @managerbmr 5 лет назад +2

    Get a microphone!

    • @SuccessinTech
      @SuccessinTech  5 лет назад

      This was recorded with a Rhode mic but the room makes a big difference :/

    • @managerbmr
      @managerbmr 5 лет назад

      Success in Tech ahh ok! Sorry! Yeah, it sounds like a room mic! Great content! Thank you for the vids, are you from Hispanic country ?

    • @SuccessinTech
      @SuccessinTech  5 лет назад

      Thanks :) Half spanish!