المدة الزمنية 5:18

Top 6 Load Balancing Algorithms Every Developer Should Know

بواسطة ByteByteGo
95 986 مشاهدة
0
3.5 K
تم نشره في 2023/08/17

Get a Free System Design PDF with 158 pages by subscribing to our weekly newsletter: https://bytebytego.ck.page/subscribe Animation tools: Adobe Illustrator and After Effects. Checkout our bestselling System Design Interview books: Volume 1: https://amzn.to/3Ou7gkd Volume 2: https://amzn.to/3HqGozy The digital version of System Design Interview books: https://bit.ly/3mlDSk9 ABOUT US: Covering topics and trends in large-scale system design, from the authors of the best-selling System Design Interview series.

الفئة People & Blogs

عرض المزيد

تعليقات - 54
  • @
    @jmsaffroy9 months ago When using dynamic load balancing, especially with a feedback loop (e.g. dynamic weights updated based on some server-side metric), you probably want some static guard rails to keep imbalance under control in case something unexpected happens (e.g. a sudden hot spot).
    Also, it's worth looking for the possibility of positive feedback loops, for instance if certain kinds of errors happening on one particular server (e.g. configuration problem) make processing very fast, and thus make this server even more attractive to the load balancing system.
    Error metrics are easily overlooked when computing weights for load balancing.
    ...
    48
  • @
    @adityaanuragi69169 months ago When I first heard of load balancing I imagined the round robin algorithm like distributing cards to all the players in the game. I didn't even think there are algorithms on distributing the load 11
  • @
    @gagAMinute9 months ago Hi! You've excellent stuff on your channel. Thanks a tonne for sharing 🙏✌🏻
  • @
    @alqassemnasr28648 months ago great content thank you for all information.
  • @
    @nmmm20009 months ago you miss random load balancing. it is similar to round robin, except uses random function e.g. something like rand(0, 256) % 4.
    DNS supports that.
    13
  • @
    @user-or9dk4ng8r9 months ago I;ve just finished to "warm up" load balancing section before intervview and at the end get your vid!:) 1
  • @
    @kjyu45399 months ago can u explain about concurrency and redundancy problems when using multiple servers?
    for example should we have a separate copy of the application on each server or there are other ways for doing it?
    another consideration is concurrent access to shared resources... how preventing conflicts and data corruption is implemented?
    probably another subcategory is distributing the database itself...
    i think these can be candidates for separate videos indeed ;)
    ...
    3
  • @
    @solution-n-social9 months ago ChatGPT responses with a bit different algorithms, less Round Robins and more Least Connections:
    1. Round Robin
    2. Least Connections
    3. Weighted Round Robin
    4. Weighted Least Connections
    5. IP Hash
    6. Least Response Time
    Bard responses with a bit different algorithms, Geolocation instead of IP Hash:
    1. Round robin.
    2. Weighted round robin.
    3. Least connections.
    4. Least response time.
    5. Sticky sessions.
    6. Geolocation.
    :D
    ...
    2
  • @
    @PatrickStaight9 months ago Is Load Balancing a good defence against a DDOS?
    • If it's a high volume lightweight attack like a Smurfed ping won't the load balancer need to process each packet anyway, even if very briefly?
    • Under what circumstances will trivial processing overwhelm the load balancer and is this different between algorithms?
    • I'm assuming Sticky Round Robin or IP/URL can just drop all the packets from a user or IP respectively to dodge a denial of service attack. Is this the case?
    • How are TCP/IP layers split between the load balancer and the destination machine? Particularly, if an attacker sends massage parts at a rate just under the connection timeout will the load balancer get overwhelmed by excessive open connections or will the destination machine (slow loris attack)?
    ...
    5
  • @
    @fullStackInKannada9 months ago Hi, your videos are too low in volumn I need to increase it too full for clear but when switch tab next YT video it'll be too loud. So it for all the end users or only for my system. But your videos are very informative thanks for that. ... 1
  • @
    @ryan_roga8 months ago Surely there has to be hybrid solutions to this problem. Some of these details in the "cons" category for these different methods feel like they could be easily overcome. #3 for example - why would an admin be required to actively monitor these values and adjust them? Surely that task could be automated with code. ...
  • @
    @jks63715 months ago 🎯 Key Takeaways for quick navigation:
    🌐 Overview of Load Balancing Algorithms
    - Crucial for large-scale web apps.
    - Two categories: static and dynamic.
    - Goal: Grasp core load balancing for better app architecture.
    🔄 Static Load Balancing Algorithms
    - Distribute requests without real-time server consideration.
    - Examples: Round Robin, Sticky Round Robin, Weighted Round Robin.
    - Trade-off: Simplicity vs. Adaptability.
    🔍 Hash-Based Algorithms
    - Hash functions map requests to servers.
    - Challenge: Optimal hash function choice.
    - Advantage: Even distribution with a wise function.
    🔄 Dynamic Load Balancing Algorithms
    - Adapt in real-time based on server conditions.
    - Examples: Least Connections, Least Response Time.
    - Trade-off: Adaptability vs. Overhead.
    ⚖️ Trade-offs between Static and Dynamic Algorithms
    - Consider trade-offs in load balancing selection.
    - Static for stateless apps, dynamic for complex ones.
    💬 Viewer Engagement and Conclusion
    - Encourage sharing load balancing experiences.
    - Highlight simplified "static" and "dynamic" differentiation.
    - Promote system design newsletter.
    Made with HARPA AI
    ... 2
  • @
    @user-ey2sw8wx7e9 months ago Looks like there is an error on preview in 2. No Bob's requests on the right side, only on the left.
  • @
    @sham-yaswanth9 months ago Hey, I'm new to System design, Can we add multiple load balancers in a complex system? if yes then how to map requests between them? Do we need another load balancer to manage those two? 2
  • @
    @robl399 months ago How do you scale the load balancer? How do you prevent the load balancer from being a single point of failure? 2
  • @
    @AbeDillon8 months ago The lowest latency method shouldn't require that much overhead, right?
    If you have enough traffic that you're tracking multiple outstanding requests per server, then you can order each server by whichever is longest: the latency of the last fulfilled request or the elapsed time since the oldest outstanding request. That way, you (practically) don't have any overhead measuring latency. If you don't have enough traffic to accumulate multiple requests per server, then load-balancing shouldn't be a huge problem.
    You can add more complex logic to minimize hot-spots and detect server failures, but the gist is still the same.
    ...
    2
  • @
    @Tony-dp1rl8 months ago I've seen a lot of load balancing configurations in my time, but I don't think I have ever seen anyone use URL hashing. Wonder what scenario that is good for. 3
  • @
    @Devertelo9 months ago When you see a video that says "Every Developer Should Know" and you look like John Snow, know nothing 😅 43
  • @
    @BhaveshAgarwal9 months ago ByteByteGo - please share the tools and softwares you use to create these wonderful videos. It will be extremely helpful to learn them and use it for work and share knowledge in general. Thanks in advance! 4
  • @
    @blue56599 months ago Is it better to avoid load balancers entirely and use message queues instead?
  • @
    @darenzou9 months ago is consistent hashing considered a load balancing algorithm? 2
  • @
    @fanjin9 months ago If the load balancer is a single server with single IP address, how can it possibly handle so much traffic? I know it just forwards request but the IO overhead can add up, right?
  • @
    @fazlurrahmatullah30176 months ago What load balancing method is suitable for Backends such as Nodejs used for Live Streaming Applications?
    *So the Backend is a live streaming application
  • @
    @TheYeti9 months ago Do most devs using any cloud hosting even need to concern themselves with load balancing algos?
  • @
    @HimalayJoriwallast month Consistent hashing is widely used. Isn'it ?
  • @
    @k.alipardhan69575 months ago If you already have latency metrics, wouldn't least time be the "best" choice?
  • @
    @thegtrick3595 months ago Hello everyone, I am working on load balancing algorithm in CloudSim 3.0.3 and main problem is deadline of task. If I have MIPS that can not execute this task before deadline, what I need to do? Can anyone help me?
  • @
    @CandyLemon365 months ago The narrative here is powerful and impactful. A similar book I read was transformative in its reach. "Game Theory and the Pursuit of Algorithmic Fairness" by Jack Frostwell
  • @
    @bouzie80002 months ago Me after watching a 20 minute video on consistent hashing and seeing none of it here :)
  • @
    @jmsaffroy9 months ago When using dynamic load balancing, especially with a feedback loop (e.g. dynamic weights updated based on some server-side metric), you probably want some static guard rails to keep imbalance under control in case something unexpected happens (e.g. a sudden hot spot).
    Also, it's worth looking for the possibility of positive feedback loops, for instance if certain kinds of errors happening on one particular server (e.g. configuration problem) make processing very fast, and thus make this server even more attractive to the load balancing system.
    Error metrics are easily overlooked when computing weights for load balancing.
    ...
    48
  • @
    @adityaanuragi69169 months ago When I first heard of load balancing I imagined the round robin algorithm like distributing cards to all the players in the game. I didn't even think there are algorithms on distributing the load 11
  • @
    @gagAMinute9 months ago Hi! You've excellent stuff on your channel. Thanks a tonne for sharing 🙏✌🏻
  • @
    @alqassemnasr28648 months ago great content thank you for all information.
  • @
    @nmmm20009 months ago you miss random load balancing. it is similar to round robin, except uses random function e.g. something like rand(0, 256) % 4.
    DNS supports that.
    13
  • @
    @user-or9dk4ng8r9 months ago I;ve just finished to "warm up" load balancing section before intervview and at the end get your vid!:) 1
  • @
    @kjyu45399 months ago can u explain about concurrency and redundancy problems when using multiple servers?
    for example should we have a separate copy of the application on each server or there are other ways for doing it?
    another consideration is concurrent access to shared resources... how preventing conflicts and data corruption is implemented?
    probably another subcategory is distributing the database itself...
    i think these can be candidates for separate videos indeed ;)
    ...
    3
  • @
    @solution-n-social9 months ago ChatGPT responses with a bit different algorithms, less Round Robins and more Least Connections:
    1. Round Robin
    2. Least Connections
    3. Weighted Round Robin
    4. Weighted Least Connections
    5. IP Hash
    6. Least Response Time
    Bard responses with a bit different algorithms, Geolocation instead of IP Hash:
    1. Round robin.
    2. Weighted round robin.
    3. Least connections.
    4. Least response time.
    5. Sticky sessions.
    6. Geolocation.
    :D
    ...
    2
  • @
    @PatrickStaight9 months ago Is Load Balancing a good defence against a DDOS?
    • If it's a high volume lightweight attack like a Smurfed ping won't the load balancer need to process each packet anyway, even if very briefly?
    • Under what circumstances will trivial processing overwhelm the load balancer and is this different between algorithms?
    • I'm assuming Sticky Round Robin or IP/URL can just drop all the packets from a user or IP respectively to dodge a denial of service attack. Is this the case?
    • How are TCP/IP layers split between the load balancer and the destination machine? Particularly, if an attacker sends massage parts at a rate just under the connection timeout will the load balancer get overwhelmed by excessive open connections or will the destination machine (slow loris attack)?
    ...
    5
  • @
    @fullStackInKannada9 months ago Hi, your videos are too low in volumn I need to increase it too full for clear but when switch tab next YT video it'll be too loud. So it for all the end users or only for my system. But your videos are very informative thanks for that. ... 1
  • @
    @ryan_roga8 months ago Surely there has to be hybrid solutions to this problem. Some of these details in the "cons" category for these different methods feel like they could be easily overcome. #3 for example - why would an admin be required to actively monitor these values and adjust them? Surely that task could be automated with code. ...
  • @
    @jks63715 months ago 🎯 Key Takeaways for quick navigation:
    🌐 Overview of Load Balancing Algorithms
    - Crucial for large-scale web apps.
    - Two categories: static and dynamic.
    - Goal: Grasp core load balancing for better app architecture.
    🔄 Static Load Balancing Algorithms
    - Distribute requests without real-time server consideration.
    - Examples: Round Robin, Sticky Round Robin, Weighted Round Robin.
    - Trade-off: Simplicity vs. Adaptability.
    🔍 Hash-Based Algorithms
    - Hash functions map requests to servers.
    - Challenge: Optimal hash function choice.
    - Advantage: Even distribution with a wise function.
    🔄 Dynamic Load Balancing Algorithms
    - Adapt in real-time based on server conditions.
    - Examples: Least Connections, Least Response Time.
    - Trade-off: Adaptability vs. Overhead.
    ⚖️ Trade-offs between Static and Dynamic Algorithms
    - Consider trade-offs in load balancing selection.
    - Static for stateless apps, dynamic for complex ones.
    💬 Viewer Engagement and Conclusion
    - Encourage sharing load balancing experiences.
    - Highlight simplified "static" and "dynamic" differentiation.
    - Promote system design newsletter.
    Made with HARPA AI
    ... 2
  • @
    @user-ey2sw8wx7e9 months ago Looks like there is an error on preview in 2. No Bob's requests on the right side, only on the left.
  • @
    @sham-yaswanth9 months ago Hey, I'm new to System design, Can we add multiple load balancers in a complex system? if yes then how to map requests between them? Do we need another load balancer to manage those two? 2
  • @
    @robl399 months ago How do you scale the load balancer? How do you prevent the load balancer from being a single point of failure? 2
  • @
    @AbeDillon8 months ago The lowest latency method shouldn't require that much overhead, right?
    If you have enough traffic that you're tracking multiple outstanding requests per server, then you can order each server by whichever is longest: the latency of the last fulfilled request or the elapsed time since the oldest outstanding request. That way, you (practically) don't have any overhead measuring latency. If you don't have enough traffic to accumulate multiple requests per server, then load-balancing shouldn't be a huge problem.
    You can add more complex logic to minimize hot-spots and detect server failures, but the gist is still the same.
    ...
    2
  • @
    @Tony-dp1rl8 months ago I've seen a lot of load balancing configurations in my time, but I don't think I have ever seen anyone use URL hashing. Wonder what scenario that is good for. 3
  • @
    @Devertelo9 months ago When you see a video that says "Every Developer Should Know" and you look like John Snow, know nothing 😅 43
  • @
    @BhaveshAgarwal9 months ago ByteByteGo - please share the tools and softwares you use to create these wonderful videos. It will be extremely helpful to learn them and use it for work and share knowledge in general. Thanks in advance! 4
  • @
    @blue56599 months ago Is it better to avoid load balancers entirely and use message queues instead?
  • @
    @darenzou9 months ago is consistent hashing considered a load balancing algorithm? 2
  • @
    @fanjin9 months ago If the load balancer is a single server with single IP address, how can it possibly handle so much traffic? I know it just forwards request but the IO overhead can add up, right?
  • @
    @fazlurrahmatullah30176 months ago What load balancing method is suitable for Backends such as Nodejs used for Live Streaming Applications?
    *So the Backend is a live streaming application
  • @
    @TheYeti9 months ago Do most devs using any cloud hosting even need to concern themselves with load balancing algos?
  • @
    @HimalayJoriwallast month Consistent hashing is widely used. Isn'it ?
  • @
    @k.alipardhan69575 months ago If you already have latency metrics, wouldn't least time be the "best" choice?
  • @
    @thegtrick3595 months ago Hello everyone, I am working on load balancing algorithm in CloudSim 3.0.3 and main problem is deadline of task. If I have MIPS that can not execute this task before deadline, what I need to do? Can anyone help me?
  • @
    @CandyLemon365 months ago The narrative here is powerful and impactful. A similar book I read was transformative in its reach. "Game Theory and the Pursuit of Algorithmic Fairness" by Jack Frostwell
  • @
    @bouzie80002 months ago Me after watching a 20 minute video on consistent hashing and seeing none of it here :)