SlideShare uma empresa Scribd logo
1 de 48
Baixar para ler offline
L O A D B A L A N C I N G
I S
I M P O S S I B L E
SLIDE
LOAD BALANCING IS IMPOSSIBLE
Tyler McMullen
tyler@fastly.com
@tbmcmullen
2
WHAT IS LOAD BALANCING?
[DIAGRAM DESCRIBING LOAD BALANCING]
[ALLEGORY DESCRIBING LOAD BALANCING]
SLIDELOAD BALANCING IS IMPOSSIBLE 6
Abstraction Balancing LoadFailure
Treat many servers as one
Single entry point
Simplification
Transparent failover
Recover seamlessly
Simplification
Spread the load efficiently across servers
Why Load Balance?
Three major reasons. The least of which is balancing load.
R A N D O M
T H E I N G L O R I O U S D E FA U LT
A N D B A N E O F M Y E X I S T E N C E
SLIDE
LOAD BALANCING IS IMPOSSIBLE
What’s good about
random?
8
• Simplicity
• Few edge cases
• Easy failover
• Works identically when distributed
SLIDE
LOAD BALANCING IS IMPOSSIBLE
What’s bad about
random?
9
• Latency
• Especially long-tail latency
• Useable capacity
B A L L S - I N T O - B I N S
If you throw m balls into n bins,
what is the maximum load
of any one bin?
import	numpy	as	np	
import	numpy.random	as	nr	
n	=	8				#	number	of	servers	
m	=	1000	#	number	of	requests	
bins	=	[0]	*	n	
for	chosen_bin	in	nr.randint(0,	n,	m):	
				bins[chosen_bin]	+=	1	
print	bins
[129,	100,	134,	113,	117,	136,	148,	123]
import	numpy	as	np	
import	numpy.random	as	nr	
n	=	8				#	number	of	servers	
m	=	1000	#	number	of	requests	
bins	=	[0]	*	n	
for	weight	in	nr.uniform(0,	2,	m):	
				chosen_bin	=	nr.randint(0,	n)	
				bins[chosen_bin]	+=	weight	
print	bins
[133.1,	133.9,	144.7,	124.1,	102.9,	125.4,	114.2,	121.3]
How do you model
request latency?
Log-normal Distribution
50th: 0.6
75th: 1.2
95th: 3.1
99th: 6.0
99.9th: 14.1
MEAN: 1.0
mu	=	0.0	
sigma	=	1.15	
lognorm_mean	=	math.e	**	(mu	+	sigma	**	2	/	2)	
desired_mean	=	1.0	
def	normalize(value):	
				return	value	/	lognorm_mean	*	desired_mean	
for	weight	in	nr.lognormal(mu,	sigma,	m):	
				chosen_bin	=	nr.randint(0,	n)	
				bins[chosen_bin]	+=	normalize(weight)	
[128.7,	116.7,	136.1,	153.1,	98.2,	89.1,	125.4,	130.4]
mu	=	0.0	
sigma	=	1.15	
lognorm_mean	=	math.e	**	(mu	+	sigma	**	2	/	2)	
desired_mean	=	1.0	
baseline	=	0.05	
def	normalize(value):	
				return	(value	/	lognorm_mean	
												*	(desired_mean	-	baseline)	
												+	baseline)	
for	weight	in	nr.lognormal(mu,	sigma,	m):	
				chosen_bin	=	nr.randint(0,	n)	
				bins[chosen_bin]	+=	normalize(weight)
[100.7,	137.5,	134.3,	126.2,	113.5,	175.7,	101.6,	113.7]
THIS IS WHY
PERFECTION
IS IMPOSSIBLE
WHY IS THAT A PROBLEM?
WHAT EFFECT DOES IT HAVE?
Random simulation
Actual distribution
The probability of a single resource request avoiding the 99th percentile is 99%.
The probability of all N resource requests in a page avoiding
the 99th percentile is (99% ^ N).
99% ^ 69 = 49.9%
SO WHAT DO WE DO ABOUT IT?
Random simulation
JSQ simulation
L E T ’ S T H R O W A W R E N C H I N T O T H I S . . .
D I S T R I B U T E D L O A D
B A L A N C I N G
A N D W H Y I T M A K E S E V E R Y T H I N G H A R D E R
DISTRIBUTED RANDOM IS EXACTLY THE SAME
DISTRIBUTED JOIN-SHORTEST-QUEUE IS A NIGHTMARE
mu	=	0.0	
sigma	=	1.15	
lognorm_mean	=	math.e	**	(mu	+	sigma	**	2	/	2)	
desired_mean	=	1.0	
baseline	=	0.05	
def	normalize(value):	
				return	(value	/	lognorm_mean	
												*	(desired_mean	-	baseline)	
												+	baseline)	
for	weight	in	nr.lognormal(mu,	sigma,	m):	
				chosen_bin	=	nr.randint(0,	n)	
				bins[chosen_bin]	+=	normalize(weight)
[100.7,	137.5,	134.3,	126.2,	113.5,	175.7,	101.6,	113.7]
mu	=	0.0	
sigma	=	1.15	
lognorm_mean	=	math.e	**	(mu	+	sigma	**	2	/	2)	
desired_mean	=	1.0	
baseline	=	0.05	
def	normalize(value):	
				return	(value	/	lognorm_mean	
												*	(desired_mean	-	baseline)	
												+	baseline)	
for	weight	in	nr.lognormal(mu,	sigma,	m):	
				a	=	nr.randint(0,	n)	
				b	=	nr.randint(0,	n)	
				chosen_bin	=	a	if	bins[a]	<	bins[b]	else	b	
				bins[chosen_bin]	+=	normalize(weight)
[130.5,	131.7,	129.7,	132.0,	131.3,	133.2,	129.9,	132.6]
[100.7,	137.5,	134.3,	126.2,	113.5,	175.7,	101.6,	113.7]
[130.5,	131.7,	129.7,	132.0,	131.3,	133.2,	129.9,	132.6]
STANDARD DEVIATION: 1.18
STANDARD DEVIATION: 22.9
Random simulation
JSQ simulation
Randomized JSQ simulation
A N O T H E R C R A Z Y I D E A
MY PROBLEM WITH THIS APPROACH...
A DIFFERENCE OF PERSPECTIVE
WRAP UP
SLIDE
LOAD BALANCING IS IMPOSSIBLE
THANKS BYE
tyler@fastly.com
@tbmcmullen
48

Mais conteúdo relacionado

Destaque

Destaque (20)

It Probably Works - QCon 2015
It Probably Works - QCon 2015It Probably Works - QCon 2015
It Probably Works - QCon 2015
 
The Fallacy of Fast - Ines Sombra at Fastly Altitude 2015
The Fallacy of Fast - Ines Sombra at Fastly Altitude 2015The Fallacy of Fast - Ines Sombra at Fastly Altitude 2015
The Fallacy of Fast - Ines Sombra at Fastly Altitude 2015
 
Design & Performance - Steve Souders at Fastly Altitude 2015
Design & Performance - Steve Souders at Fastly Altitude 2015Design & Performance - Steve Souders at Fastly Altitude 2015
Design & Performance - Steve Souders at Fastly Altitude 2015
 
Fallacy of Fast
Fallacy of FastFallacy of Fast
Fallacy of Fast
 
Applying Varnish
Applying VarnishApplying Varnish
Applying Varnish
 
Confident Refactoring - Ember SF Meetup
Confident Refactoring - Ember SF MeetupConfident Refactoring - Ember SF Meetup
Confident Refactoring - Ember SF Meetup
 
Top 5 Things I've Messed Up in Live Streaming
Top 5 Things I've Messed Up in Live StreamingTop 5 Things I've Messed Up in Live Streaming
Top 5 Things I've Messed Up in Live Streaming
 
What we can learn from CDNs about Web Development, Deployment, and Performance
What we can learn from CDNs about Web Development, Deployment, and PerformanceWhat we can learn from CDNs about Web Development, Deployment, and Performance
What we can learn from CDNs about Web Development, Deployment, and Performance
 
Performance Measuring & Monitoring - Catchpoint CEO Mehdi Daoudi at Fastly Al...
Performance Measuring & Monitoring - Catchpoint CEO Mehdi Daoudi at Fastly Al...Performance Measuring & Monitoring - Catchpoint CEO Mehdi Daoudi at Fastly Al...
Performance Measuring & Monitoring - Catchpoint CEO Mehdi Daoudi at Fastly Al...
 
Advanced VCL Workshop - Rogier Mulhuijzen and Stephen Basile at Fastly Altitu...
Advanced VCL Workshop - Rogier Mulhuijzen and Stephen Basile at Fastly Altitu...Advanced VCL Workshop - Rogier Mulhuijzen and Stephen Basile at Fastly Altitu...
Advanced VCL Workshop - Rogier Mulhuijzen and Stephen Basile at Fastly Altitu...
 
Beyond Breakpoints: A Tour of Dynamic Analysis
Beyond Breakpoints: A Tour of Dynamic AnalysisBeyond Breakpoints: A Tour of Dynamic Analysis
Beyond Breakpoints: A Tour of Dynamic Analysis
 
Causation
Causation Causation
Causation
 
The future of the edge
The future of the edge The future of the edge
The future of the edge
 
Rails Caching: Secrets From the Edge
Rails Caching: Secrets From the EdgeRails Caching: Secrets From the Edge
Rails Caching: Secrets From the Edge
 
Building a better web
Building a better webBuilding a better web
Building a better web
 
Migrating Target to Fastly - Eddie Roger at Fastly Altitude 2015
Migrating Target to Fastly - Eddie Roger at Fastly Altitude 2015Migrating Target to Fastly - Eddie Roger at Fastly Altitude 2015
Migrating Target to Fastly - Eddie Roger at Fastly Altitude 2015
 
From Zero to Capacity Planning
From Zero to Capacity PlanningFrom Zero to Capacity Planning
From Zero to Capacity Planning
 
Making ops life easier
Making ops life easierMaking ops life easier
Making ops life easier
 
Debugging Your CDN - Austin Spires at Fastly Altitude 2015
Debugging Your CDN - Austin Spires at Fastly Altitude 2015Debugging Your CDN - Austin Spires at Fastly Altitude 2015
Debugging Your CDN - Austin Spires at Fastly Altitude 2015
 
Resource Allocation in Computer Networks
Resource Allocation in Computer NetworksResource Allocation in Computer Networks
Resource Allocation in Computer Networks
 

Mais de Fastly

Mais de Fastly (20)

Revisiting HTTP/2
Revisiting HTTP/2Revisiting HTTP/2
Revisiting HTTP/2
 
Altitude San Francisco 2018: Preparing for Video Streaming Events at Scale
Altitude San Francisco 2018: Preparing for Video Streaming Events at ScaleAltitude San Francisco 2018: Preparing for Video Streaming Events at Scale
Altitude San Francisco 2018: Preparing for Video Streaming Events at Scale
 
Altitude San Francisco 2018: Building the Souther Hemisphere of the Internet
Altitude San Francisco 2018: Building the Souther Hemisphere of the InternetAltitude San Francisco 2018: Building the Souther Hemisphere of the Internet
Altitude San Francisco 2018: Building the Souther Hemisphere of the Internet
 
Altitude San Francisco 2018: The World Cup Stream
Altitude San Francisco 2018: The World Cup StreamAltitude San Francisco 2018: The World Cup Stream
Altitude San Francisco 2018: The World Cup Stream
 
Altitude San Francisco 2018: We Own Our Destiny
Altitude San Francisco 2018: We Own Our DestinyAltitude San Francisco 2018: We Own Our Destiny
Altitude San Francisco 2018: We Own Our Destiny
 
Altitude San Francisco 2018: Scale and Stability at the Edge with 1.4 Billion...
Altitude San Francisco 2018: Scale and Stability at the Edge with 1.4 Billion...Altitude San Francisco 2018: Scale and Stability at the Edge with 1.4 Billion...
Altitude San Francisco 2018: Scale and Stability at the Edge with 1.4 Billion...
 
Altitude San Francisco 2018: Moving Off the Monolith: A Seamless Migration
Altitude San Francisco 2018: Moving Off the Monolith: A Seamless MigrationAltitude San Francisco 2018: Moving Off the Monolith: A Seamless Migration
Altitude San Francisco 2018: Moving Off the Monolith: A Seamless Migration
 
Altitude San Francisco 2018: Bringing TLS to GitHub Pages
Altitude San Francisco 2018: Bringing TLS to GitHub PagesAltitude San Francisco 2018: Bringing TLS to GitHub Pages
Altitude San Francisco 2018: Bringing TLS to GitHub Pages
 
Altitude San Francisco 2018: HTTP Invalidation Workshop
Altitude San Francisco 2018: HTTP Invalidation WorkshopAltitude San Francisco 2018: HTTP Invalidation Workshop
Altitude San Francisco 2018: HTTP Invalidation Workshop
 
Altitude San Francisco 2018: HTTP/2 Tales: Discovery and Woe
Altitude San Francisco 2018: HTTP/2 Tales: Discovery and WoeAltitude San Francisco 2018: HTTP/2 Tales: Discovery and Woe
Altitude San Francisco 2018: HTTP/2 Tales: Discovery and Woe
 
Altitude San Francisco 2018: How Magento moved to the cloud while maintaining...
Altitude San Francisco 2018: How Magento moved to the cloud while maintaining...Altitude San Francisco 2018: How Magento moved to the cloud while maintaining...
Altitude San Francisco 2018: How Magento moved to the cloud while maintaining...
 
Altitude San Francisco 2018: Scaling Ethereum to 10B requests per day
Altitude San Francisco 2018: Scaling Ethereum to 10B requests per dayAltitude San Francisco 2018: Scaling Ethereum to 10B requests per day
Altitude San Francisco 2018: Scaling Ethereum to 10B requests per day
 
Altitude San Francisco 2018: Authentication at the Edge
Altitude San Francisco 2018: Authentication at the EdgeAltitude San Francisco 2018: Authentication at the Edge
Altitude San Francisco 2018: Authentication at the Edge
 
Altitude San Francisco 2018: WebAssembly Tools & Applications
Altitude San Francisco 2018: WebAssembly Tools & ApplicationsAltitude San Francisco 2018: WebAssembly Tools & Applications
Altitude San Francisco 2018: WebAssembly Tools & Applications
 
Altitude San Francisco 2018: Testing with Fastly Workshop
Altitude San Francisco 2018: Testing with Fastly WorkshopAltitude San Francisco 2018: Testing with Fastly Workshop
Altitude San Francisco 2018: Testing with Fastly Workshop
 
Altitude San Francisco 2018: Fastly Purge Control at the USA TODAY NETWORK
Altitude San Francisco 2018: Fastly Purge Control at the USA TODAY NETWORKAltitude San Francisco 2018: Fastly Purge Control at the USA TODAY NETWORK
Altitude San Francisco 2018: Fastly Purge Control at the USA TODAY NETWORK
 
Altitude San Francisco 2018: WAF Workshop
Altitude San Francisco 2018: WAF WorkshopAltitude San Francisco 2018: WAF Workshop
Altitude San Francisco 2018: WAF Workshop
 
Altitude San Francisco 2018: Logging at the Edge
Altitude San Francisco 2018: Logging at the Edge Altitude San Francisco 2018: Logging at the Edge
Altitude San Francisco 2018: Logging at the Edge
 
Altitude San Francisco 2018: Video Workshop Docs
Altitude San Francisco 2018: Video Workshop DocsAltitude San Francisco 2018: Video Workshop Docs
Altitude San Francisco 2018: Video Workshop Docs
 
Altitude San Francisco 2018: Programming the Edge
Altitude San Francisco 2018: Programming the EdgeAltitude San Francisco 2018: Programming the Edge
Altitude San Francisco 2018: Programming the Edge
 

Último

The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 

Último (20)

Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 

Load balancing is impossible