load testing, lessons learnt and loadzen - martin buhr at devtank - 31st january 2012

56
Preparing for... inclement weather Martin Buhr @martinbuhr http://loadzen.com

Upload: loadzen

Post on 30-Jun-2015

726 views

Category:

Technology


0 download

DESCRIPTION

Talk by Martin Buhr, Founder of Loadzen.com at Devtank on the 31st of January about the importance of load testing your site as a startup, how http://loadzen.com was built and the lessons learned.

TRANSCRIPT

Page 1: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

Preparing for... inclement

weather

Martin Buhr

@martinbuhr

http://loadzen.com

Page 2: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

WHO HERE HAS LOAD

TESTED THEIR APP?

So...

Page 3: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

For those that haven’t

(or don’t know)

Page 4: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

Many people may tell you...

Page 5: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

That these are your problem...

(etc)

Page 6: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

And they really can cause

trouble...

Page 7: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

We know, it happened to us:

Jive.ly

Page 8: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

Day 1:

Launch

Page 9: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

Day 2:

Sarky email to TechCrunch

Page 10: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

Day 3:

#1 on TechCrunch UK

Page 11: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

Day 3:

#1 on TechCrunch US

Page 12: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

Day 3:

#1 on Digg

Page 13: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

Shit.

Page 14: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

So what happened?

To Jive.ly:

• Traffic exploded

• Sign-ups exploded

• In-bound links exploded

• Rankings shot up

• People were buzzing

• Free press!

Page 15: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

So what really happened?

Page 16: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

We lost users

Page 17: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

They lost confidence

Page 18: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

We lost opportunities

Page 19: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

And it was expensive...

Page 20: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

:-(

Page 21: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

But that isn’t the general

case

Page 22: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

You aren’t a C10K site

Page 23: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

You’re not trying to piss off

Anonymous

Page 24: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

You’re not on TechCrunch

(yet)

Page 25: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

Remember these?

(etc)

Page 26: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

They don’t matter... yet

But these guys do...

Page 27: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

ANYONE THAT GENERATES

TRAFFIC THAT YOU DON’T

EXPECT BUT REALLY

WANT

Page 28: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

You may ask yourself:

Why should I care?

Page 29: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

Why should I care?

• Your database:

– Shared SQL server

– Unoptimised queries

– Unoptimised schemas

– Unnecessary requests

Page 30: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

Why should I care?

• Your code:

– Nested nested loops

– Inefficient iterators

– Large in-memory objects

– About a million other bad practices and shortcuts

Page 31: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

Why should I care?

• Your interface:

– Large images

– On the fly processing

– Slow JavaScript

– Slow web services

Page 32: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

All of these are exposed and

get exponentially worse the

higher your traffic

Page 33: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

For start-ups, inefficient

code is expensive

Page 34: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

For developers, it’s just

embarrassing...

Page 35: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

Which is why we load test

:-)

Page 36: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

Oh yeah...

• Your users get your service

• You make the most from your opportunities

• Users spend more on responsive sites

• You improve your bottom line

And best of all:

• You become a better developer

Page 37: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

Learnt that the hard way...

Page 38: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

That got me thinking...

Can I build my own?

Page 39: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

And that became Loadzen (let’s take a look...)

Yes I can...

Page 40: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012
Page 41: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

What is it?

• Load testing in the cloud

• Multi-scenario, weighted testing

• Real-time results

• Chrome plug-in

• Pay as you test

Page 42: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

What’s it built in?

• Django (FCGI)

• MySQL

• Lighttpd

• RabbitMQ

• Pyro

• TornadIO

• SocketIO

Page 43: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

What’s it really built in?

Page 44: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

Python. Pure and Simple.

Page 45: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

Look! A diagram!

Page 46: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012
Page 47: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

And what did we learn?

Page 48: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

Log everything

• Dynamic RPC is hard

• Black box code hurts, open up your systems

• When your site breaks (and it will) – you know why

Page 49: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

Real-time is awesome

• Event-based dev changes the way you think

• Queues make everything seem scalable

• But they introduce their own problems!

– Queue -> Socket -> Browser is a killer on your system

– Flow control and timing can be issues

Page 50: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

UI: Make it simple, stupid

• If your UI sucks, your code is useless

• It’s not someone else’s problem

• If it makes your users life easier, it’s worth it.

• Always think – can I make it simpler?

Page 51: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

Always think scale

• Don’t build for it, but think about it

– Cache your interface

– Use a CDN

– Make requests quick: think async

– Make sure your database is fast

– Use the right tool for the job!

Page 52: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

Pragmatism pays off

• Don’t pick tech because it’s hot

• Pick it because it solves your problem:

– Elegantly

– Efficiently

• Architect for extensibility

– You’ll deal with it sooner or later

Page 53: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

Measure Everything.

Page 54: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

Be inquisitive

• Talk to your users

• Love them (not too much!)

• They are the single most important thing to your company, react.

– Even if you can’t fix it

Page 55: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

And lastly...

Page 56: Load testing, Lessons learnt and Loadzen - Martin Buhr at DevTank - 31st January 2012

make stuff, be awesome.

(that’s our motto, btw)