Notes
  • Notes
  • JavaScript
    • URL processing
    • Numbers
  • Python
    • python random notes
    • Python Resources
  • Setup
    • Mac Setup
  • Command Line
    • Basics
    • Linux basics
    • Bash script
    • Create temp files
    • awk
    • sed
    • make
    • ssh
    • gzip
    • Command line tools
    • ffmpeg
    • at and crontab - scheduling commands
  • Web Developement
    • Chrome Dev Tools
    • HTML
    • Markdown
    • CSS
    • Rails
    • Hugo
    • REST APIs
  • Soft Skills
    • Listening Skills
    • Public Speaking
  • Containers
  • Career
    • Resume
    • Interview
    • Promotion
    • Keeping Track of Your Work
    • Decide What to Work On
  • Ergonomics
    • Work Env Setup
    • Pain Relieve
  • Digest / Writing Ideas
    • Books
      • Antifragile
      • Anti-Intellectualism in American Life 美国的反智传统
    • Economy / Society
    • How to spend your time
    • Life
    • Higher education
  • Misc
    • Regex
    • Don't Make Me Think
    • Microsoft Excel
    • AdTech 101
  • Resources
    • web
    • Vim
    • Tools
    • System Design
    • Design Pattern
    • Load Balancer
    • References
    • Hardware
    • Algorithm Resources
    • Command Line Resources
  • Git
    • Pro Git
  • Non-Tech
    • 化学科普 - 拿破仑的纽扣
    • 人生经验 - If I Knew Then
    • 哲学
      • Harvard - Justice
    • 宗教
      • Introduction to the New Testament History and Literature
      • 蔡志忠 - 漫画东方圣经
    • 人文
      • Open Yale Course - 心理学导论
  • Spark
  • VS Code
Powered by GitBook
On this page
  • Load Balancing - High Availability
  • No load balancing
  • DNS (Domain Name System) load balancing
  • Network load balancing
  • Going multi-site
  • Controlling inbound requests in a multi-site system
  • Layer 7 load balancing

Was this helpful?

  1. Resources

Load Balancer

PreviousDesign PatternNextReferences

Last updated 5 years ago

Was this helpful?

Load Balancing - High Availability

No load balancing

One server, one IP.

DNS (Domain Name System) load balancing

Two servers, two IPs. DNS is cached, what if one server goes down?

Network load balancing

One data center: one load balancer + many backend servers.

Layer 4 (TCP/IP) load balancer: can be hardware or software. DNS points one virtual IP, and it points to different backend servers (based on a hash of source/destination IP address/port and protocal (TCP/UDP)). Does not maintain state per connection.

L4 balancers can do health-checking, weighted balancing (for backends with different capacities).

Going multi-site

More data center: The edge routers in both data centers advertise the same VIP. Request sent to that VIP can reach either site (Anycast). Most of the time it works. If one site fails, it stops advertising the VIP, and traffic goes to the other site.

Problems: can't control where traffic flows or limit how much traffic is sent to a given site. Can't explicitly route users to the nearest site (but usually users end up with nearest site).

Controlling inbound requests in a multi-site system

Use different VIPs for each site and use geo-aware DNS to balance them with simple or weighted round-robin. New problems: DNS, cache records. Cannot redirect traffic quickly.

Layer 7 load balancing

Aware of the structure and contents of requests. L7 load balancer can do: caching, rate limiting, fault injection, cost-aware load balancing (some requests require much more server time to process). They can also balance based on a request's attributes (e.g. HTTP cookies), terminate SSL connections, and help defend against application layger DOS attacks. Problems: cost. Usually L4 balancers are running in front of one or more pools of L7 balancers.

https://opensource.com/article/18/10/internet-scale-load-balancing