SlideShare a Scribd company logo
SHANE HANSENSHANE HANSEN
Created: 2018-01-02 Tue 18:28
TABLE OF CONTENTSTABLE OF CONTENTS
1. Load balancing
1.1. Who Am I?
1.2. Why talk about load balancing:
1.3. What is load balancing?
1.4. Caveats
2. Load balancing by construction
2.1. One webserver
2.2. Patterns for N webservers
2.2.1. Web server selection
2.2.2. Health checks
2.2.3. Anatomy of HTTP check
2.2.4. N web server architecture review:
2.3. Scaling load balancers
2.3.1. Exploring DNS load balancing
2.3.2. DNS load balancing
3. Lower level strategies
3.1. Sub-TCP load balancing
3.2. n-tuple hashing
3.3. 5-tuple hashing bene ts
3.4. Equal Cost Multi Path
3.5. Direct Server Return
4. Optimizing for locality/performance
4.1. Simpli ed model of BGP
4.2. Anycast
4.3. Using BGP for anycast load balancing
4.4. Geo DNS
4.5. Put it all together
5. Next-gen techniques at walmartlabs edge
5.1. Direct Container Return
5.2. Service Mesh
5.3. Beyond service mesh
6. Projects using Go to do all the load balancing
things
11 LOAD BALANCINGLOAD BALANCING
A survey of techniques for scaling busyish websites for non-
experts.
1.11.1 WHO AM I?WHO AM I?
Shane Hansen
(@shanemhansen)
Walmartlabs Edge Engineering
Performance connoisseur
1.21.2 WHY TALK ABOUT LOAD BALANCING:WHY TALK ABOUT LOAD BALANCING:
Engineers need to understand options to make good
choices.
Load balancing is rapidly changing and adapting to evolving
protocols
It's interesting
1.31.3 WHAT IS LOAD BALANCING?WHAT IS LOAD BALANCING?
Distributing requests over multiple endpoints to increase
the reliability or performance of a service.
Inline load balancers lter and transform traf c, so they
often quickly grow features around
observability
routing
OOB load balancers either make a decision and leave the
request ow
1.41.4 CAVEATSCAVEATS
Some companies do these things
Nobody would learn anything if I just said: "use dyn" "use
cloud are" or "use elb"
This is utah go, not utah people-who-write-checks-to-
vendors
Many links to go libraries will be left until the end
22 LOAD BALANCING BY CONSTRUCTIONLOAD BALANCING BY CONSTRUCTION
Making a website scale, step by step.
2.12.1 ONE WEBSERVERONE WEBSERVER
Let's say one day that you build a website. What if it starts
making money or getting popular?
2.22.2 PATTERNS FOR N WEBSERVERSPATTERNS FOR N WEBSERVERS
2.2.12.2.1 WEB SERVER SELECTIONWEB SERVER SELECTION
If your web app is truly stateless, round robin is a solid choice
that's hard to mess up.
If it's not stateless, make it stateless.
2.2.22.2.2 HEALTH CHECKSHEALTH CHECKS
Two major types: inline and oob
oob: app speci c health endpoint hit on an interval
Inline: utilize observed info from real requests to select
backends
Bene ts and drawbacks to both.
2.2.32.2.3 ANATOMY OF HTTP CHECKANATOMY OF HTTP CHECK
Typically HTTP request to endpoint with 2xx status code
Extended validation of body supported
Endpoint can return a health "number" for advanced
algos
Timeouts, con gured retry policies
2.2.42.2.4 N WEB SERVER ARCHITECTURE REVIEW:N WEB SERVER ARCHITECTURE REVIEW:
Pros:
Rolling app upgrades possible
Capacity can be easily
increased
Cons:
Limited by performance of software load balancer. ballpark
$X0,000 requests/s
Your site is still bottlenecked by uptime of a single vm.
2.32.3 SCALING LOAD BALANCERSSCALING LOAD BALANCERS
What to do when your company is relying on a single nginx
instance.
2.3.12.3.1 EXPLORING DNS LOAD BALANCINGEXPLORING DNS LOAD BALANCING
Pros:
DNS infrastructure is quite scalable
Possible to scale out and upgrade load
balancers
Cons:
DNS resolvers are quirky, hard to guarantee
distribution
Broken software with bad caches
Quirky protocol: hard to do priorities, weighting, etc.
2.3.22.3.2 DNS LOAD BALANCINGDNS LOAD BALANCING
33 LOWER LEVEL STRATEGIESLOWER LEVEL STRATEGIES
3.13.1 SUB-TCP LOAD BALANCINGSUB-TCP LOAD BALANCING
Strategies
Can be implemented in hardware
Can be implemented in kernel
Order of magnitude more throughput in appliances that do
so
Can be implemented by pushing state/routing to the edge
3.23.2 N-TUPLE HASHINGN-TUPLE HASHING
3.33.3 5-TUPLE HASHING BENEFITS5-TUPLE HASHING BENEFITS
Extremely fast, can be implemented in hardware
persistence: ow always goes to same node
Avoids hot-spots due to "natted university
effect"
3.43.4 EQUAL COST MULTI PATHEQUAL COST MULTI PATH
Implementation of n-tuple hashing
Provide multiple routes to
destination.
Deterministic route selection
3.53.5 DIRECT SERVER RETURNDIRECT SERVER RETURN
Optimize by only using lb to select backend, not to
proxy.
44 OPTIMIZING FOR LOCALITY/PERFORMANCEOPTIMIZING FOR LOCALITY/PERFORMANCE
Examples so far mostly spray traf c
everywhere
How to build truly global systems
4.14.1 SIMPLIFIED MODEL OF BGPSIMPLIFIED MODEL OF BGP
Border Gateway Protocol
Allows autonomous systems to advertise ip
space
4.24.2 ANYCASTANYCAST
Allow multiple pops to advertise same ip space
Routers choose "best route" where best is a function
of:
network hops
whether or not packet will leave ISP's network
stuff
4.34.3 USING BGP FOR ANYCAST LOAD BALANCINGUSING BGP FOR ANYCAST LOAD BALANCING
4.44.4 GEO DNSGEO DNS
Attempt to direct clients to closest physical server
May not follow network topology
Relies on datasets of questionable accuracy
First hop latency unless anycasting DNS
Bene t: DNS is safest proto to anycast
Good idea if you want unicast TCP for long lived
connections
4.54.5 PUT IT ALL TOGETHERPUT IT ALL TOGETHER
Example setup for multi-pop anycast
55 NEXT-GEN TECHNIQUES AT WALMARTLABSNEXT-GEN TECHNIQUES AT WALMARTLABS
EDGEEDGE
5.15.1 DIRECT CONTAINER RETURNDIRECT CONTAINER RETURN
zero copy resource passing (technically one packet is
copied)
Approach used internally at Walmartlabs/cloud are (based
on gophercon talk)
HTTP/1.1 and TLS/SNI
Assumes shared kernel
5.25.2 SERVICE MESHSERVICE MESH
Utilize Edge capabilities internally via
sidecar
service discovery
yada yada
5.35.3 BEYOND SERVICE MESHBEYOND SERVICE MESH
What comes next?
Protocol optimizations: upgrade to http2? QUIC?
Eliminate moving parts
Turn logical microservices into functions at runtime where
possible
Use REST concepts to facilitate pervasive caching.
Make networked services the fallback, calling local
functions is the optimization.
66 PROJECTS USING GO TO DO ALL THE LOADPROJECTS USING GO TO DO ALL THE LOAD
BALANCING THINGSBALANCING THINGS
Seesaw (LVS):
metallb (BGP):
BGP:
DNS:
GoBPF:
cilium
OSS repo for fd passing load balancer: TBD
https://github.com/google/seesaw
https://github.com/google/metallb
https://osrg.github.io/gobgp/
https://github.com/miekg/dns
https://github.com/iovisor/gobpf
https://github.com/cilium/cilium

More Related Content

What's hot

Can Kafka Handle a Lyft Ride? (Andrey Falko & Can Cecen, Lyft) Kafka Summit 2020
Can Kafka Handle a Lyft Ride? (Andrey Falko & Can Cecen, Lyft) Kafka Summit 2020Can Kafka Handle a Lyft Ride? (Andrey Falko & Can Cecen, Lyft) Kafka Summit 2020
Can Kafka Handle a Lyft Ride? (Andrey Falko & Can Cecen, Lyft) Kafka Summit 2020
HostedbyConfluent
 
Running Cloud Foundry for 12 months - An experience report | anynines
Running Cloud Foundry for 12 months - An experience report | anyninesRunning Cloud Foundry for 12 months - An experience report | anynines
Running Cloud Foundry for 12 months - An experience report | anynines
anynines GmbH
 
Managing ejabberd Platforms with Docker - ejabberd Workshop #1
Managing ejabberd Platforms with Docker - ejabberd Workshop #1Managing ejabberd Platforms with Docker - ejabberd Workshop #1
Managing ejabberd Platforms with Docker - ejabberd Workshop #1
Mickaël Rémond
 
How Much Kafka?
How Much Kafka?How Much Kafka?
How Much Kafka?
confluent
 
Running Neutron at Scale - Gal Sagie & Eran Gampel - OpenStack Day Israel 2016
Running Neutron at Scale - Gal Sagie & Eran Gampel - OpenStack Day Israel 2016Running Neutron at Scale - Gal Sagie & Eran Gampel - OpenStack Day Israel 2016
Running Neutron at Scale - Gal Sagie & Eran Gampel - OpenStack Day Israel 2016
Cloud Native Day Tel Aviv
 
Twitter’s Apache Kafka Adoption Journey | Ming Liu, Twitter
Twitter’s Apache Kafka Adoption Journey | Ming Liu, TwitterTwitter’s Apache Kafka Adoption Journey | Ming Liu, Twitter
Twitter’s Apache Kafka Adoption Journey | Ming Liu, Twitter
HostedbyConfluent
 
Design and Implementation of a Load Balancing Algorithm for a Clustered SDN C...
Design and Implementation of a Load Balancing Algorithm for a Clustered SDN C...Design and Implementation of a Load Balancing Algorithm for a Clustered SDN C...
Design and Implementation of a Load Balancing Algorithm for a Clustered SDN C...
Daniel Gheorghita
 
Load Balancer Device and Configurations.
Load Balancer Device and Configurations.Load Balancer Device and Configurations.
Load Balancer Device and Configurations.
Web Werks Data Centers
 
Network Automation (Bay Area Juniper Networks Meetup)
Network Automation (Bay Area Juniper Networks Meetup)Network Automation (Bay Area Juniper Networks Meetup)
Network Automation (Bay Area Juniper Networks Meetup)
Alejandro Salinas
 
Training Slides: Advanced 304: Upgrading From Native MySQL Replication To Tun...
Training Slides: Advanced 304: Upgrading From Native MySQL Replication To Tun...Training Slides: Advanced 304: Upgrading From Native MySQL Replication To Tun...
Training Slides: Advanced 304: Upgrading From Native MySQL Replication To Tun...
Continuent
 
Informix HA Best Practices
Informix HA Best Practices Informix HA Best Practices
Informix HA Best Practices
Scott Lashley
 
Experience Report: Cloud Foundry Open Source Operations | anynines
Experience Report: Cloud Foundry Open Source Operations | anyninesExperience Report: Cloud Foundry Open Source Operations | anynines
Experience Report: Cloud Foundry Open Source Operations | anynines
anynines GmbH
 
VerneMQ - Distributed MQTT Broker
VerneMQ - Distributed MQTT BrokerVerneMQ - Distributed MQTT Broker
VerneMQ - Distributed MQTT Broker
Adriano Pimpini
 
Kafka on Kubernetes: Keeping It Simple (Nikki Thean, Etsy) Kafka Summit SF 2019
Kafka on Kubernetes: Keeping It Simple (Nikki Thean, Etsy) Kafka Summit SF 2019Kafka on Kubernetes: Keeping It Simple (Nikki Thean, Etsy) Kafka Summit SF 2019
Kafka on Kubernetes: Keeping It Simple (Nikki Thean, Etsy) Kafka Summit SF 2019
confluent
 
Deep Dive into Apache Kafka
Deep Dive into Apache KafkaDeep Dive into Apache Kafka
Deep Dive into Apache Kafka
confluent
 
Nimbuzz march2012
Nimbuzz march2012Nimbuzz march2012
Nimbuzz march2012
nlwebperf
 
Getting up to speed with MirrorMaker 2 | Mickael Maison, IBM and Ryanne Dolan...
Getting up to speed with MirrorMaker 2 | Mickael Maison, IBM and Ryanne Dolan...Getting up to speed with MirrorMaker 2 | Mickael Maison, IBM and Ryanne Dolan...
Getting up to speed with MirrorMaker 2 | Mickael Maison, IBM and Ryanne Dolan...
HostedbyConfluent
 
Apache Kafka – (Pattern and) Anti-Pattern
Apache Kafka – (Pattern and) Anti-PatternApache Kafka – (Pattern and) Anti-Pattern
Apache Kafka – (Pattern and) Anti-Pattern
confluent
 
Load Balancing Container with Nginx
Load Balancing Container with NginxLoad Balancing Container with Nginx
Load Balancing Container with Nginx
Kumar Mayank
 
Sharing is Caring: Toward Creating Self-tuning Multi-tenant Kafka (Anna Povzn...
Sharing is Caring: Toward Creating Self-tuning Multi-tenant Kafka (Anna Povzn...Sharing is Caring: Toward Creating Self-tuning Multi-tenant Kafka (Anna Povzn...
Sharing is Caring: Toward Creating Self-tuning Multi-tenant Kafka (Anna Povzn...
HostedbyConfluent
 

What's hot (20)

Can Kafka Handle a Lyft Ride? (Andrey Falko & Can Cecen, Lyft) Kafka Summit 2020
Can Kafka Handle a Lyft Ride? (Andrey Falko & Can Cecen, Lyft) Kafka Summit 2020Can Kafka Handle a Lyft Ride? (Andrey Falko & Can Cecen, Lyft) Kafka Summit 2020
Can Kafka Handle a Lyft Ride? (Andrey Falko & Can Cecen, Lyft) Kafka Summit 2020
 
Running Cloud Foundry for 12 months - An experience report | anynines
Running Cloud Foundry for 12 months - An experience report | anyninesRunning Cloud Foundry for 12 months - An experience report | anynines
Running Cloud Foundry for 12 months - An experience report | anynines
 
Managing ejabberd Platforms with Docker - ejabberd Workshop #1
Managing ejabberd Platforms with Docker - ejabberd Workshop #1Managing ejabberd Platforms with Docker - ejabberd Workshop #1
Managing ejabberd Platforms with Docker - ejabberd Workshop #1
 
How Much Kafka?
How Much Kafka?How Much Kafka?
How Much Kafka?
 
Running Neutron at Scale - Gal Sagie & Eran Gampel - OpenStack Day Israel 2016
Running Neutron at Scale - Gal Sagie & Eran Gampel - OpenStack Day Israel 2016Running Neutron at Scale - Gal Sagie & Eran Gampel - OpenStack Day Israel 2016
Running Neutron at Scale - Gal Sagie & Eran Gampel - OpenStack Day Israel 2016
 
Twitter’s Apache Kafka Adoption Journey | Ming Liu, Twitter
Twitter’s Apache Kafka Adoption Journey | Ming Liu, TwitterTwitter’s Apache Kafka Adoption Journey | Ming Liu, Twitter
Twitter’s Apache Kafka Adoption Journey | Ming Liu, Twitter
 
Design and Implementation of a Load Balancing Algorithm for a Clustered SDN C...
Design and Implementation of a Load Balancing Algorithm for a Clustered SDN C...Design and Implementation of a Load Balancing Algorithm for a Clustered SDN C...
Design and Implementation of a Load Balancing Algorithm for a Clustered SDN C...
 
Load Balancer Device and Configurations.
Load Balancer Device and Configurations.Load Balancer Device and Configurations.
Load Balancer Device and Configurations.
 
Network Automation (Bay Area Juniper Networks Meetup)
Network Automation (Bay Area Juniper Networks Meetup)Network Automation (Bay Area Juniper Networks Meetup)
Network Automation (Bay Area Juniper Networks Meetup)
 
Training Slides: Advanced 304: Upgrading From Native MySQL Replication To Tun...
Training Slides: Advanced 304: Upgrading From Native MySQL Replication To Tun...Training Slides: Advanced 304: Upgrading From Native MySQL Replication To Tun...
Training Slides: Advanced 304: Upgrading From Native MySQL Replication To Tun...
 
Informix HA Best Practices
Informix HA Best Practices Informix HA Best Practices
Informix HA Best Practices
 
Experience Report: Cloud Foundry Open Source Operations | anynines
Experience Report: Cloud Foundry Open Source Operations | anyninesExperience Report: Cloud Foundry Open Source Operations | anynines
Experience Report: Cloud Foundry Open Source Operations | anynines
 
VerneMQ - Distributed MQTT Broker
VerneMQ - Distributed MQTT BrokerVerneMQ - Distributed MQTT Broker
VerneMQ - Distributed MQTT Broker
 
Kafka on Kubernetes: Keeping It Simple (Nikki Thean, Etsy) Kafka Summit SF 2019
Kafka on Kubernetes: Keeping It Simple (Nikki Thean, Etsy) Kafka Summit SF 2019Kafka on Kubernetes: Keeping It Simple (Nikki Thean, Etsy) Kafka Summit SF 2019
Kafka on Kubernetes: Keeping It Simple (Nikki Thean, Etsy) Kafka Summit SF 2019
 
Deep Dive into Apache Kafka
Deep Dive into Apache KafkaDeep Dive into Apache Kafka
Deep Dive into Apache Kafka
 
Nimbuzz march2012
Nimbuzz march2012Nimbuzz march2012
Nimbuzz march2012
 
Getting up to speed with MirrorMaker 2 | Mickael Maison, IBM and Ryanne Dolan...
Getting up to speed with MirrorMaker 2 | Mickael Maison, IBM and Ryanne Dolan...Getting up to speed with MirrorMaker 2 | Mickael Maison, IBM and Ryanne Dolan...
Getting up to speed with MirrorMaker 2 | Mickael Maison, IBM and Ryanne Dolan...
 
Apache Kafka – (Pattern and) Anti-Pattern
Apache Kafka – (Pattern and) Anti-PatternApache Kafka – (Pattern and) Anti-Pattern
Apache Kafka – (Pattern and) Anti-Pattern
 
Load Balancing Container with Nginx
Load Balancing Container with NginxLoad Balancing Container with Nginx
Load Balancing Container with Nginx
 
Sharing is Caring: Toward Creating Self-tuning Multi-tenant Kafka (Anna Povzn...
Sharing is Caring: Toward Creating Self-tuning Multi-tenant Kafka (Anna Povzn...Sharing is Caring: Toward Creating Self-tuning Multi-tenant Kafka (Anna Povzn...
Sharing is Caring: Toward Creating Self-tuning Multi-tenant Kafka (Anna Povzn...
 

Similar to Load balancing basics

Don't think about the difficulty Let's try to connect easy to IPv6 network w...
 Don't think about the difficulty Let's try to connect easy to IPv6 network w... Don't think about the difficulty Let's try to connect easy to IPv6 network w...
Don't think about the difficulty Let's try to connect easy to IPv6 network w...
Namba Kazuo
 
Docker Swarm secrets for creating great FIWARE platforms
Docker Swarm secrets for creating great FIWARE platformsDocker Swarm secrets for creating great FIWARE platforms
Docker Swarm secrets for creating great FIWARE platforms
Federico Michele Facca
 
Network performance test plan_v0.3
Network performance test plan_v0.3Network performance test plan_v0.3
Network performance test plan_v0.3
David Pasek
 
Anycast all the things
Anycast all the thingsAnycast all the things
Anycast all the things
Maximilan Wilhelm
 
FIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE Platforms
FIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE PlatformsFIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE Platforms
FIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE Platforms
FIWARE
 
CCNA 2016 SYLLABUS
CCNA 2016 SYLLABUSCCNA 2016 SYLLABUS
CCNA 2016 SYLLABUS
Nafis Khan Chowdhury
 
200-125-ccna-v3
200-125-ccna-v3200-125-ccna-v3
200-125-ccna-v3
Ibby Nuj
 
200 125-ccna-v3
200 125-ccna-v3200 125-ccna-v3
200 125-ccna-v3
Ruben Gagita
 
CISCO 200 125-ccna-v3
CISCO 200 125-ccna-v3CISCO 200 125-ccna-v3
CISCO 200 125-ccna-v3
Leo Juntilla
 
Load Balancing 101
Load Balancing 101Load Balancing 101
Load Balancing 101
HungWei Chiu
 
Route Origin Validation - A MANRS Approach
Route Origin Validation - A MANRS ApproachRoute Origin Validation - A MANRS Approach
Route Origin Validation - A MANRS Approach
Bangladesh Network Operators Group
 
hwinstructions.docxCSCI 6642 –Computer Networks & Data Commun.docx
hwinstructions.docxCSCI 6642 –Computer Networks & Data Commun.docxhwinstructions.docxCSCI 6642 –Computer Networks & Data Commun.docx
hwinstructions.docxCSCI 6642 –Computer Networks & Data Commun.docx
adampcarr67227
 
Virtualization & Network Connectivity
Virtualization & Network Connectivity Virtualization & Network Connectivity
Virtualization & Network Connectivity
itplant
 
WebSphere Portal Version 6.0 Web Content Management and DB2 Tuning Guide
WebSphere Portal Version 6.0 Web Content Management and DB2 Tuning GuideWebSphere Portal Version 6.0 Web Content Management and DB2 Tuning Guide
WebSphere Portal Version 6.0 Web Content Management and DB2 Tuning Guide
Tan Nguyen Phi
 
Optimizing AS Paths
Optimizing AS PathsOptimizing AS Paths
Optimizing AS Paths
ThousandEyes
 
Composing services with Kubernetes
Composing services with KubernetesComposing services with Kubernetes
Composing services with Kubernetes
Bart Spaans
 
A Distributed Control Law for Load Balancing in Content Delivery Networks
A Distributed Control Law for Load Balancing in Content Delivery NetworksA Distributed Control Law for Load Balancing in Content Delivery Networks
A Distributed Control Law for Load Balancing in Content Delivery Networks
Sruthi Kamal
 
Azure appservice
Azure appserviceAzure appservice
Azure appservice
Raju Kumar
 
P&G BT Global Services - LLD Final Revision Year 2008.
P&G BT Global Services - LLD Final Revision Year 2008.P&G BT Global Services - LLD Final Revision Year 2008.
P&G BT Global Services - LLD Final Revision Year 2008.
Kapil Sabharwal
 
Creating Your Virtual Data Center: VPC Fundamentals and Connectivity Options
Creating Your Virtual Data Center: VPC Fundamentals and Connectivity OptionsCreating Your Virtual Data Center: VPC Fundamentals and Connectivity Options
Creating Your Virtual Data Center: VPC Fundamentals and Connectivity Options
Amazon Web Services
 

Similar to Load balancing basics (20)

Don't think about the difficulty Let's try to connect easy to IPv6 network w...
 Don't think about the difficulty Let's try to connect easy to IPv6 network w... Don't think about the difficulty Let's try to connect easy to IPv6 network w...
Don't think about the difficulty Let's try to connect easy to IPv6 network w...
 
Docker Swarm secrets for creating great FIWARE platforms
Docker Swarm secrets for creating great FIWARE platformsDocker Swarm secrets for creating great FIWARE platforms
Docker Swarm secrets for creating great FIWARE platforms
 
Network performance test plan_v0.3
Network performance test plan_v0.3Network performance test plan_v0.3
Network performance test plan_v0.3
 
Anycast all the things
Anycast all the thingsAnycast all the things
Anycast all the things
 
FIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE Platforms
FIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE PlatformsFIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE Platforms
FIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE Platforms
 
CCNA 2016 SYLLABUS
CCNA 2016 SYLLABUSCCNA 2016 SYLLABUS
CCNA 2016 SYLLABUS
 
200-125-ccna-v3
200-125-ccna-v3200-125-ccna-v3
200-125-ccna-v3
 
200 125-ccna-v3
200 125-ccna-v3200 125-ccna-v3
200 125-ccna-v3
 
CISCO 200 125-ccna-v3
CISCO 200 125-ccna-v3CISCO 200 125-ccna-v3
CISCO 200 125-ccna-v3
 
Load Balancing 101
Load Balancing 101Load Balancing 101
Load Balancing 101
 
Route Origin Validation - A MANRS Approach
Route Origin Validation - A MANRS ApproachRoute Origin Validation - A MANRS Approach
Route Origin Validation - A MANRS Approach
 
hwinstructions.docxCSCI 6642 –Computer Networks & Data Commun.docx
hwinstructions.docxCSCI 6642 –Computer Networks & Data Commun.docxhwinstructions.docxCSCI 6642 –Computer Networks & Data Commun.docx
hwinstructions.docxCSCI 6642 –Computer Networks & Data Commun.docx
 
Virtualization & Network Connectivity
Virtualization & Network Connectivity Virtualization & Network Connectivity
Virtualization & Network Connectivity
 
WebSphere Portal Version 6.0 Web Content Management and DB2 Tuning Guide
WebSphere Portal Version 6.0 Web Content Management and DB2 Tuning GuideWebSphere Portal Version 6.0 Web Content Management and DB2 Tuning Guide
WebSphere Portal Version 6.0 Web Content Management and DB2 Tuning Guide
 
Optimizing AS Paths
Optimizing AS PathsOptimizing AS Paths
Optimizing AS Paths
 
Composing services with Kubernetes
Composing services with KubernetesComposing services with Kubernetes
Composing services with Kubernetes
 
A Distributed Control Law for Load Balancing in Content Delivery Networks
A Distributed Control Law for Load Balancing in Content Delivery NetworksA Distributed Control Law for Load Balancing in Content Delivery Networks
A Distributed Control Law for Load Balancing in Content Delivery Networks
 
Azure appservice
Azure appserviceAzure appservice
Azure appservice
 
P&G BT Global Services - LLD Final Revision Year 2008.
P&G BT Global Services - LLD Final Revision Year 2008.P&G BT Global Services - LLD Final Revision Year 2008.
P&G BT Global Services - LLD Final Revision Year 2008.
 
Creating Your Virtual Data Center: VPC Fundamentals and Connectivity Options
Creating Your Virtual Data Center: VPC Fundamentals and Connectivity OptionsCreating Your Virtual Data Center: VPC Fundamentals and Connectivity Options
Creating Your Virtual Data Center: VPC Fundamentals and Connectivity Options
 

Recently uploaded

GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Undress Baby
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
Hornet Dynamics
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
ICS
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
Rakesh Kumar R
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
Sven Peters
 
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise EditionWhy Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Envertis Software Solutions
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 

Recently uploaded (20)

GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
 
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise EditionWhy Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 

Load balancing basics

  • 1. SHANE HANSENSHANE HANSEN Created: 2018-01-02 Tue 18:28
  • 2. TABLE OF CONTENTSTABLE OF CONTENTS 1. Load balancing 1.1. Who Am I? 1.2. Why talk about load balancing: 1.3. What is load balancing? 1.4. Caveats 2. Load balancing by construction 2.1. One webserver 2.2. Patterns for N webservers 2.2.1. Web server selection 2.2.2. Health checks 2.2.3. Anatomy of HTTP check 2.2.4. N web server architecture review: 2.3. Scaling load balancers
  • 3. 2.3.1. Exploring DNS load balancing 2.3.2. DNS load balancing 3. Lower level strategies 3.1. Sub-TCP load balancing 3.2. n-tuple hashing 3.3. 5-tuple hashing bene ts 3.4. Equal Cost Multi Path 3.5. Direct Server Return 4. Optimizing for locality/performance 4.1. Simpli ed model of BGP 4.2. Anycast 4.3. Using BGP for anycast load balancing 4.4. Geo DNS 4.5. Put it all together 5. Next-gen techniques at walmartlabs edge 5.1. Direct Container Return 5.2. Service Mesh
  • 4. 5.3. Beyond service mesh 6. Projects using Go to do all the load balancing things
  • 5. 11 LOAD BALANCINGLOAD BALANCING A survey of techniques for scaling busyish websites for non- experts.
  • 6. 1.11.1 WHO AM I?WHO AM I? Shane Hansen (@shanemhansen) Walmartlabs Edge Engineering Performance connoisseur
  • 7. 1.21.2 WHY TALK ABOUT LOAD BALANCING:WHY TALK ABOUT LOAD BALANCING: Engineers need to understand options to make good choices. Load balancing is rapidly changing and adapting to evolving protocols It's interesting
  • 8. 1.31.3 WHAT IS LOAD BALANCING?WHAT IS LOAD BALANCING? Distributing requests over multiple endpoints to increase the reliability or performance of a service. Inline load balancers lter and transform traf c, so they often quickly grow features around observability routing OOB load balancers either make a decision and leave the request ow
  • 9. 1.41.4 CAVEATSCAVEATS Some companies do these things Nobody would learn anything if I just said: "use dyn" "use cloud are" or "use elb" This is utah go, not utah people-who-write-checks-to- vendors Many links to go libraries will be left until the end
  • 10. 22 LOAD BALANCING BY CONSTRUCTIONLOAD BALANCING BY CONSTRUCTION Making a website scale, step by step.
  • 11. 2.12.1 ONE WEBSERVERONE WEBSERVER Let's say one day that you build a website. What if it starts making money or getting popular?
  • 12. 2.22.2 PATTERNS FOR N WEBSERVERSPATTERNS FOR N WEBSERVERS
  • 13. 2.2.12.2.1 WEB SERVER SELECTIONWEB SERVER SELECTION If your web app is truly stateless, round robin is a solid choice that's hard to mess up. If it's not stateless, make it stateless.
  • 14. 2.2.22.2.2 HEALTH CHECKSHEALTH CHECKS Two major types: inline and oob oob: app speci c health endpoint hit on an interval Inline: utilize observed info from real requests to select backends Bene ts and drawbacks to both.
  • 15. 2.2.32.2.3 ANATOMY OF HTTP CHECKANATOMY OF HTTP CHECK Typically HTTP request to endpoint with 2xx status code Extended validation of body supported Endpoint can return a health "number" for advanced algos Timeouts, con gured retry policies
  • 16. 2.2.42.2.4 N WEB SERVER ARCHITECTURE REVIEW:N WEB SERVER ARCHITECTURE REVIEW: Pros: Rolling app upgrades possible Capacity can be easily increased Cons: Limited by performance of software load balancer. ballpark $X0,000 requests/s Your site is still bottlenecked by uptime of a single vm.
  • 17. 2.32.3 SCALING LOAD BALANCERSSCALING LOAD BALANCERS What to do when your company is relying on a single nginx instance.
  • 18. 2.3.12.3.1 EXPLORING DNS LOAD BALANCINGEXPLORING DNS LOAD BALANCING Pros: DNS infrastructure is quite scalable Possible to scale out and upgrade load balancers Cons: DNS resolvers are quirky, hard to guarantee distribution Broken software with bad caches Quirky protocol: hard to do priorities, weighting, etc.
  • 19. 2.3.22.3.2 DNS LOAD BALANCINGDNS LOAD BALANCING
  • 20. 33 LOWER LEVEL STRATEGIESLOWER LEVEL STRATEGIES
  • 21. 3.13.1 SUB-TCP LOAD BALANCINGSUB-TCP LOAD BALANCING Strategies Can be implemented in hardware Can be implemented in kernel Order of magnitude more throughput in appliances that do so Can be implemented by pushing state/routing to the edge
  • 23. 3.33.3 5-TUPLE HASHING BENEFITS5-TUPLE HASHING BENEFITS Extremely fast, can be implemented in hardware persistence: ow always goes to same node Avoids hot-spots due to "natted university effect"
  • 24. 3.43.4 EQUAL COST MULTI PATHEQUAL COST MULTI PATH Implementation of n-tuple hashing Provide multiple routes to destination. Deterministic route selection
  • 25. 3.53.5 DIRECT SERVER RETURNDIRECT SERVER RETURN Optimize by only using lb to select backend, not to proxy.
  • 26. 44 OPTIMIZING FOR LOCALITY/PERFORMANCEOPTIMIZING FOR LOCALITY/PERFORMANCE Examples so far mostly spray traf c everywhere How to build truly global systems
  • 27. 4.14.1 SIMPLIFIED MODEL OF BGPSIMPLIFIED MODEL OF BGP Border Gateway Protocol Allows autonomous systems to advertise ip space
  • 28. 4.24.2 ANYCASTANYCAST Allow multiple pops to advertise same ip space Routers choose "best route" where best is a function of: network hops whether or not packet will leave ISP's network stuff
  • 29. 4.34.3 USING BGP FOR ANYCAST LOAD BALANCINGUSING BGP FOR ANYCAST LOAD BALANCING
  • 30. 4.44.4 GEO DNSGEO DNS Attempt to direct clients to closest physical server May not follow network topology Relies on datasets of questionable accuracy First hop latency unless anycasting DNS Bene t: DNS is safest proto to anycast Good idea if you want unicast TCP for long lived connections
  • 31. 4.54.5 PUT IT ALL TOGETHERPUT IT ALL TOGETHER Example setup for multi-pop anycast
  • 32. 55 NEXT-GEN TECHNIQUES AT WALMARTLABSNEXT-GEN TECHNIQUES AT WALMARTLABS EDGEEDGE
  • 33. 5.15.1 DIRECT CONTAINER RETURNDIRECT CONTAINER RETURN zero copy resource passing (technically one packet is copied) Approach used internally at Walmartlabs/cloud are (based on gophercon talk) HTTP/1.1 and TLS/SNI Assumes shared kernel
  • 34. 5.25.2 SERVICE MESHSERVICE MESH Utilize Edge capabilities internally via sidecar service discovery yada yada
  • 35. 5.35.3 BEYOND SERVICE MESHBEYOND SERVICE MESH What comes next? Protocol optimizations: upgrade to http2? QUIC? Eliminate moving parts Turn logical microservices into functions at runtime where possible Use REST concepts to facilitate pervasive caching. Make networked services the fallback, calling local functions is the optimization.
  • 36. 66 PROJECTS USING GO TO DO ALL THE LOADPROJECTS USING GO TO DO ALL THE LOAD BALANCING THINGSBALANCING THINGS Seesaw (LVS): metallb (BGP): BGP: DNS: GoBPF: cilium OSS repo for fd passing load balancer: TBD https://github.com/google/seesaw https://github.com/google/metallb https://osrg.github.io/gobgp/ https://github.com/miekg/dns https://github.com/iovisor/gobpf https://github.com/cilium/cilium