Transcript
Page 1: Load testing with Blitz

Load testing

Page 2: Load testing with Blitz
Page 3: Load testing with Blitz

Who is this dude?

Page 4: Load testing with Blitz

Lindsay Holmwood

Page 5: Load testing with Blitz

BULLETPROOF

Page 6: Load testing with Blitz

I Run this thing

Page 7: Load testing with Blitz

Have tried and failed many

times to implement effective

load testing

Page 8: Load testing with Blitz
Page 9: Load testing with Blitz

A story

Page 10: Load testing with Blitz

New project

Page 11: Load testing with Blitz

Replacing a high-

profile website

(new infrastructure,

new application)

Page 12: Load testing with Blitz

1000

concurrent users

Page 13: Load testing with Blitz

“We need 100%

uptime”

Page 14: Load testing with Blitz

Project starts

Page 15: Load testing with Blitz

Requirements

change

Page 16: Load testing with Blitz

Deadlines

aren’t met

Page 17: Load testing with Blitz

Performance testing?

Fuck it!

We’ll do it live!

Page 18: Load testing with Blitz
Page 19: Load testing with Blitz

Performance testing?

“You have one day”

Page 20: Load testing with Blitz
Page 21: Load testing with Blitz

Problem:

Page 22: Load testing with Blitz

Treated as

WAterfall-esque

QA

Page 23: Load testing with Blitz

It’s a

non-functional

requirement

Page 24: Load testing with Blitz
Page 25: Load testing with Blitz

WHYDo we load test?

Page 26: Load testing with Blitz

Capacity

planning

Page 27: Load testing with Blitz

“Can the site deal

with load?”

Page 28: Load testing with Blitz

Defect

detection

Page 29: Load testing with Blitz

“Is this code

going to cripple

the site?”

Page 30: Load testing with Blitz

Optimisation

Page 31: Load testing with Blitz

“What happens if

we change this

Setting?”

Page 32: Load testing with Blitz

Historical

analysis

Page 33: Load testing with Blitz

“Is the site

getting slower?”

Page 34: Load testing with Blitz

Cache warming

Page 35: Load testing with Blitz

“Prepare the

infrastructure

for Failover”

Page 36: Load testing with Blitz

WHYDo we load test?

Page 37: Load testing with Blitz

A combination of

proactive &

Reactive reasons

Page 38: Load testing with Blitz

A combination of

proactive &

Reactive reasons

Page 39: Load testing with Blitz

It’s a

non-functional

requirement

Page 40: Load testing with Blitz
Page 41: Load testing with Blitz

Whydoes load testing

FAIL?

(from a technical perspective)

Page 42: Load testing with Blitz

How

not the

WHAT

Page 43: Load testing with Blitz

TooL fetishism

Page 44: Load testing with Blitz

Get bogged down

in details

Page 45: Load testing with Blitz

how the testing

infrastructure works

Page 46: Load testing with Blitz

Micro

vs

Macro

Page 47: Load testing with Blitz

Business

Does not care

about your tools

Page 48: Load testing with Blitz

Business

cares About:

Page 49: Load testing with Blitz

“Can the site deal

with load?”

Page 50: Load testing with Blitz
Page 51: Load testing with Blitz

Recommendation:

Page 52: Load testing with Blitz

Use tool with

lowest barrier

TO entry

Page 53: Load testing with Blitz
Page 54: Load testing with Blitz

Blitz

Page 55: Load testing with Blitz

Runs on AWS

Page 56: Load testing with Blitz

Web form

Page 57: Load testing with Blitz

Browser pluginsFirefox, Chrome

Page 58: Load testing with Blitz

REST API

Page 59: Load testing with Blitz

API ClientsRuby, Python, Java

Node.JS, Perl

Page 60: Load testing with Blitz

Common

Command Line

Page 61: Load testing with Blitz

Excellent

documentationdocs.blitz.io

Page 62: Load testing with Blitz

Inexpensive250 concurrent users

over 60 second period == free

Page 63: Load testing with Blitz

SPRINTS

&

RUSHES

Page 64: Load testing with Blitz
Page 65: Load testing with Blitz

Let’s dive in!

Page 66: Load testing with Blitz

Sign up @http://blitz.io/

Page 67: Load testing with Blitz

$ gem install blitz$ blitz helpUsage: blitz <command> <options> help - Display this help account:about - Show information about your account api:init - Validate and login with your API key couch:fuzz - Auto generate blitz tests from CouchDB curl - Run a sprint or a rush curl:help - Show help on sprint and rushing traceroute - Run traceroute remotely traceroute:help - Show help on traceroute version - Show the version of this Ruby gem$ blitz api:init # writes credentials to ~/.blitz/credentials

Page 68: Load testing with Blitz

$ blitz curl:help

Usage: blitz curl <options> <url>

--user-agent -A <string> User-Agent to send to server--cookie -b name=<string> Cookie to send to the server (multiple)--data -d <string> Data to send in a PUT or POST request--dump-header -D <file> Print the request/response headers--referer -e <string> Referer URL--help -h Help on command line options--header -H <string> Custom header to pass to server--pattern -p <s>-<e>:<d> Ramp from s to e concurrent requests in d secs--region -r <string> california|oregon|virginia|singapore|ireland|japan--status -s <number> Assert on the HTTP response status code--timeout -T <ms> Wait time for both connect and responses--user -u <user[:pass]> User and password for authentication--request -X <string> Request method to use (GET, HEAD, PUT, etc.)--variable -v <string> Define a variable to use--verbose -V Print the request/response headers--tlsv1 -1 Use TLSv1 (SSL)--sslv2 -2 Use SSLv2 (SSL)--sslv3 -3 Use SSLv3 (SSL)

Page 69: Load testing with Blitz
Page 70: Load testing with Blitz

$ blitz curl --region singapore --pattern 1-250:20 \ --timeout 10000 --verbose http://example.org/

Page 71: Load testing with Blitz

$ blitz curl --region singapore --pattern 1-250:20 \ --timeout 10000 --verbose http://example.org/

user growth / time

Page 72: Load testing with Blitz

$ blitz curl --region singapore --pattern 1-250:20 \ --timeout 10000 --verbose http://example.org/

user growth / timefor AWS lag

Page 73: Load testing with Blitz

rushing from singapore...

Time Users Response Hits Timeouts Errors Hits/s Mbps 2.5s 31 -1.000s 0 0 0 8.3s 103 1.075s 146 0 9 50.53 0.88 11.2s 140 0.406s 376 0 9 79.64 1.41 14.1s 176 0.409s 682 0 9 105.24 1.86 22.8s 0 0.417s 1552 0 9 15.57 0.27

$ blitz curl --region singapore --pattern 1-250:20 \ --timeout 10000 --verbose http://example.org/

user growth / timefor AWS lag

Page 74: Load testing with Blitz

--pattern 1-250:20

Page 75: Load testing with Blitz

--pattern 1-250:20

blitz calculates the growth automatically

Page 76: Load testing with Blitz

Sawtooth--pattern 1-250:20,1-250:20,1-250:20

Page 77: Load testing with Blitz

TV AD / Twittersplosion--pattern 200-5000:30,5000-400:60

Page 78: Load testing with Blitz
Page 79: Load testing with Blitz

Integrate

with your

development cycle

Page 80: Load testing with Blitz

VCS

CI

Deploy automation

Page 81: Load testing with Blitz

VCS

CI

Deploy automation

Page 82: Load testing with Blitz

git

post-receive hook

Page 83: Load testing with Blitz

GitHub web hooks

Page 84: Load testing with Blitz

Doesn’t take into

account test

failures

Page 85: Load testing with Blitz

Is the code

actually

deployed?

Page 86: Load testing with Blitz
Page 87: Load testing with Blitz

VCS

CI

Deploy automation

Page 88: Load testing with Blitz

CRON JOB

Page 89: Load testing with Blitz

JENKINS JOB

Page 90: Load testing with Blitz

GREAT if you have

a CI system

Page 91: Load testing with Blitz

Runs tests

but

Separate system

Page 92: Load testing with Blitz

What if you’re making

infrastructure changes

during a load test?

Page 93: Load testing with Blitz
Page 94: Load testing with Blitz

VCS

CI

Deploy automation

Page 95: Load testing with Blitz

Fabric

Page 96: Load testing with Blitz

Capistrano

Page 97: Load testing with Blitz

Run tests when

you deploy

Page 98: Load testing with Blitz

Use the same

toolchain

Page 99: Load testing with Blitz

Testing lives IN the app.

Page 100: Load testing with Blitz

What about triggering

load tests on

infrastructure

changes?

Page 101: Load testing with Blitz

MVP

Page 102: Load testing with Blitz

Just get

something

working!

Page 103: Load testing with Blitz
Page 104: Load testing with Blitz

Problem:

Page 105: Load testing with Blitz

No REporting

:-(

Page 106: Load testing with Blitz

rushing from singapore...

Time Users Response Hits Timeouts Errors Hits/s Mbps 2.5s 31 -1.000s 0 0 0 8.3s 103 1.075s 146 0 9 50.53 0.88 11.2s 140 0.406s 376 0 9 79.64 1.41 14.1s 176 0.409s 682 0 9 105.24 1.86 22.8s 0 0.417s 1552 0 9 15.57 0.27

THIS IS IT

Page 107: Load testing with Blitz

SOL ON:

Page 108: Load testing with Blitz

Optimisation

Page 109: Load testing with Blitz

“What happens if

we change this

Setting?”

Page 110: Load testing with Blitz

Historical

analysis

Page 111: Load testing with Blitz

“Is the site

getting slower?”

Page 112: Load testing with Blitz

Showstopper?

Page 113: Load testing with Blitz

...

Page 114: Load testing with Blitz

$ gem install blitz

# ...

rushing from singapore...

Time Users Response Hits Timeouts Errors Hits/s Mbps 2.5s 31 -1.000s 0 0 0 8.3s 103 1.075s 146 0 9 50.53 0.88 11.2s 140 0.406s 376 0 9 79.64 1.41 14.1s 176 0.409s 682 0 9 105.24 1.86 22.8s 0 0.417s 1552 0 9 15.57 0.27

Page 115: Load testing with Blitz

Can we duck

punch our way

to success?

Page 116: Load testing with Blitz
Page 117: Load testing with Blitz

#!/usr/bin/env ruby# load_test.rb

require 'blitz'

arguments = "--region singapore --pattern 1:250:60"url = "http://example.org/"command = "#{arguments} #{url}"

job = Blitz::Curl.parse(command)curl = Blitz::Command::Curl.newcurl.rush(job)

Page 118: Load testing with Blitz

# ruby load_test.rb

rushing from singapore...

Time Users Response Hits Timeouts Errors Hits/s Mbps 2.5s 31 -1.000s 0 0 0 8.3s 103 1.075s 146 0 9 50.53 0.88 11.2s 140 0.406s 376 0 9 79.64 1.41 14.1s 176 0.409s 682 0 9 105.24 1.86 22.8s 0 0.417s 1552 0 9 15.57 0.27

Page 119: Load testing with Blitz

#!/usr/bin/env ruby# load_test.rb

require 'blitz'

arguments = "--region singapore --pattern 1:250:60"url = "http://example.org/"command = "#{arguments} #{url}"

job = Blitz::Curl.parse(command)curl = Blitz::Command::Curl.newcurl.rush(job)

Page 120: Load testing with Blitz

#!/usr/bin/env ruby# load_test.rb

require 'blitz'

arguments = "--region singapore --pattern 1:250:60"url = "http://example.org/"command = "#{arguments} #{url}"

job = Blitz::Curl.parse(command)curl = Blitz::Command::Curl.newcurl.rush(job)

Page 121: Load testing with Blitz

Blitz::Curl.parse(command)

returns

Blitz::Curl::Rush

Page 122: Load testing with Blitz

#!/usr/bin/env ruby# load_test.rb

require 'blitz'

arguments = "--region singapore --pattern 1:250:60"url = "http://example.org/"command = "#{arguments} #{url}"

job = Blitz::Curl.parse(command)curl = Blitz::Command::Curl.newcurl.rush(job)

Page 123: Load testing with Blitz

Blitz::Command::Curl#rush

Page 124: Load testing with Blitz

Blitz::Command::Curl#rush

initiates the test + outputs the test results

Page 125: Load testing with Blitz

#!/usr/bin/env ruby# load_test.rb

require 'blitz'

arguments = "--region singapore --pattern 1:250:60"url = "http://example.org/"command = "#{arguments} #{url}"

job = Blitz::Curl.parse(command)curl = Blitz::Command::Curl.newcurl.rush(job)

puts job.result.timeline.to_json

Page 126: Load testing with Blitz

Produces muck

Page 127: Load testing with Blitz

duck punch our

way to success

Page 128: Load testing with Blitz

class Blitz::Curl::Rush class Point def to_json(*args) { 'timestamp' => @timestamp, 'duration' => @duration, 'total' => @total, 'hits' => @hits, 'errors' => @errors, 'timeouts' => @timeouts, 'volume' => @volume, 'txbytes' => @txbytes, 'rxbytes' => @rxbytes, 'steps' => @steps, }.to_json end end

# ...

Page 129: Load testing with Blitz

# ...

class Step def to_json(*args) { 'duration' => @duration, 'connect' => @connect, 'errors' => @errors, 'timeouts' => @timeouts, 'asserts' => @asserts, }.to_json end endend

Page 130: Load testing with Blitz

#!/usr/bin/env ruby# load_test.rb

require 'blitz'

arguments = "--region singapore --pattern 1:250:60"url = "http://example.org/"command = "#{arguments} #{url}"

job = Blitz::Curl.parse(command)curl = Blitz::Command::Curl.newcurl.rush(job)

puts job.result.timeline.to_json

Page 131: Load testing with Blitz

{"start":1335694346,"finish":1335694367,"results":[{"timestamp":2.502626,"duration":1.13912,"total":1,"hits":1,"errors":0,"timeouts":0,"volume":2,"txbytes":258.0,"rxbytes":17810.0,"steps":[{"duration":2.13912,"connect":0.260004,"errors":0,"timeouts":0,"asserts":0}]},{"timestamp":5.016102,"duration":0.640047,"total":5,"hits":5,"errors":0,"timeouts":0,"volume":4,"txbytes":1548.0,"rxbytes":90882.0,"steps":[{"duration":1.640047,"connect":0.158944,"errors":0,"timeouts":0,"asserts":0}]},{"timestamp":7.524594,"duration":0.639987,"total":10,"hits":10,"errors":0,"timeouts":0,"volume":5,"txbytes":3354.0,"rxbytes":182222.0,"steps":[{"duration":1.639987,"connect":0.158999,"errors":0,"timeouts":0,"asserts":0}]},{"timestamp":10.03388,"duration":0.63961,"total":20,"hits":20,"errors":0,"timeouts":0,"volume":7,"txbytes":5418.0,"rxbytes":364902.0,"steps":[{"duration":1.63961,"connect":0.158847,"errors":0,"timeouts":0,"asserts":0}]},{"timestamp":12.543211,"duration":0.640421,"total":31,"hits":31,"errors":0,"timeouts":0,"volume":9,"txbytes":9030.0,"rxbytes":565850.0,"steps":[{"duration":1.640422,"connect":0.158767,"errors":0,"timeouts":0,"asserts":0}]},{"timestamp":15.051705,"duration":0.639894,"total":44,"hits":44,"errors":0,"timeouts":0,"volume":10,"txbytes":12384.0,"rxbytes":803334.0,"steps":[{"duration":1.639894,"connect":0.158794,"errors":0,"timeouts":0,"asserts":0}]},{"timestamp":17.560136,"duration":-1.0,"total":44,"hits":44,"errors":0,"timeouts":0,"volume":0,"txbytes":12384.0,"rxbytes":803334.0,"steps":[{"duration":0.0,"connect":0.0,"errors":0,"timeouts":0,"asserts":0}]}]}

Page 132: Load testing with Blitz

Do with as

you please

Page 133: Load testing with Blitz

Here’s one I

prepared earlier...

Page 134: Load testing with Blitz
Page 135: Load testing with Blitz

...

Page 136: Load testing with Blitz

You don’t have to

set up a tool

Page 137: Load testing with Blitz

But you have to

write reporting?

Page 138: Load testing with Blitz

At least you

have load

testing?

Page 139: Load testing with Blitz

It’s on the way...

Page 141: Load testing with Blitz
Page 142: Load testing with Blitz

Where to

from here?

Page 143: Load testing with Blitz

Pull in data from

other places

Page 144: Load testing with Blitz

new relic

Ganglia/collectd

Git commits

Page 146: Load testing with Blitz
Page 147: Load testing with Blitz

Don’t like Blitz?

Page 148: Load testing with Blitz

SaaS

Load impact

Browser mob

Page 149: Load testing with Blitz

Open Source

Tsung

JMeter

Page 150: Load testing with Blitz
Page 151: Load testing with Blitz

Start Using

something!

Page 152: Load testing with Blitz

Low barrier of

entry is key

Page 153: Load testing with Blitz

Integrate with your

existing dev tools

Page 154: Load testing with Blitz
Page 155: Load testing with Blitz

Questions?


Top Related