Image source: my 5 yo daughter
Software engineer at MediaSmart Mobile
alexfernandez, @pinchito, alejandrofer
Freelance scalability consultant
Serve mobile ads
Performance campaigns
40K+ requests / second
10M+ impressions / day
35+ servers
10+ countries
Image source: Stupid Zombies 2
We help pay for your entertainment
Serve an increasing numbers of requests
Define ‘fast’
Source: GodTIC (Spanish)
Asynchronous, event-driven, non-blocking
Focus on concurrency, not performance
Node behaves very linearly:
Double the load, double the resources
Smooth learning curve
Few surprises
Source: modulecounts.com
Ruby down, Maven ~ one month away
vs
Image source: Rama
Image source: ZDNet
Image source: usvsth3m
Keep business happy!
And we will be happy as well
Escape the callback pyramid
Use named functions, not lambdas
Use events as they were meant to be
Would you bet your business on promises?
(Sorry about that)
Image source: Dr Electric
Perhaps not...
Image source: Chelydra.org
Developments go slower
Your code runs slower
Business Goes First
Do not scale too soon
... and definitely not too late!
Keep lists of what you owe
and repay it as you go along
Don't let performance issues accumulate
Image source: Beao
Gather data instead of opinions
Two kind of tests:
Measure requests per second
... and then correct by a given factor
Image source: MythBusters
And do not be afraid to work on production if needed
DYOD: do your own deployments
Deploy as often as possible!
Monitor after deploying!
Monitor everything!
Send alerts
Image source: Laughing Squid
Send only necessary alerts
Image source: Josh Linkner
Beware Swiss Army Knives
Humanity's best invention
for scalability
Cache everything everywhere!
Locally and remotely
Humanity's second best invention
for scalability
Ideal for async processing
Remove work from online processing
and aggregate it
Redis has different access patterns
Image source: CloudBees Blog
Always
No exceptions
Source: Haretz
Search for lock-free solutionsScalability is about removing bottlenecks
Is the sign of a bottleneck
... and beware the self-sustaining stampede!
First order of business: bound your tasks
Set a target for optimizations
Image source: glee wiki
Now look for the real cause!
Do root cause analysis immediately — and fully
Farther away from symptom → less effective
Work on symptoms if needed
Why? why? why? why? why?
Reinventing the wheel is stupid
Image source: Michael Covel
Building improved wheels is great!
Image source: Tesla Motors
The world doesn't care about your feelings
You cannot win an argument with reality
Unverified opinions are useless
(specially your own)
Accept facts and collect data
The great menace to progress is not ignorance
but the illusion of knowledge.
The teacher gets the most out of the lessons,
and the true teacher is a learner.
And now...
Image source: livluvcreate
Questions?
http://slid.es/alexfernandez/scalability-lessons
Oh and by the way...
We're hiring!