Continuous performance testing: Why you should care

Preview:

Citation preview

blackfire.io @blackfireio #blackfireio

Continuous Performance Testing> Why you should care

blackfire.io @blackfireio #blackfireio

Christophe Dujarric @Chris_Dujarric Product guy. Loves simple things that solve real problems.

Paris, France

Blackfire.io/SensioLabs

christophedujarric.wordpress.com

/christophedujarric

blackfire.io @blackfireio #blackfireio

Reason #1

Money!

-100ms +1%revenue -2.2s +15%

downloads -400ms+9%traffic

blackfire.io @blackfireio #blackfireio

Application Perfomance……Monitoring?

blackfire.io @blackfireio #blackfireio

Weather conditions

Third party services

Your Code

InfrastructuresFront-end

blackfire.io @blackfireio #blackfireio

https://www.flickr.com/photos/guiseiz/6094701062

Wall Clock Time

Wall Time = CPU + I/O

blackfire.io @blackfireio #blackfireio

function foo(){ bar();

echo 'foo';}

foo();

Inclusive Time

blackfire.io @blackfireio #blackfireio

function foo(){ bar();

echo 'foo';}

foo();

Exclusive Time

blackfire.io @blackfireio #blackfireio

I/O= Network + Disk

blackfire.io @blackfireio #blackfireio

Business logic is key

blackfire.io @blackfireio #blackfireio

gc_disable();

Improving Composer

up to 90% faster

Reason #2Continuous attention to technical excellence and good design enhances agility.

Agile Manifesto

From a Technology to a Product

blackfire.io @blackfireio #blackfireio

Monitoring

Benchmarking

Load-testing

Profiling?

blackfire.io @blackfireio #blackfireio

Measuring server response to simulated demand

Mainly Open Source tools

Load testing

Bees with Machine Guns

blackfire.io @blackfireio #blackfireio

Assess the relative performance of servers

Benchmarking

SiegeHttpPerf

Apache Bench

blackfire.io @blackfireio #blackfireio

Real traffic tracking | Crash reports | R.U.M.

Monitoring

blackfire.io @blackfireio #blackfireio

Detailed insights on code performance

Open Source/legacy tools

Profiling

XHProf

blackfire.io @blackfireio #blackfireio

abandon a website that takes more than 3 seconds to load

40% of users

blackfire.io @blackfireio #blackfireio

Solving issues in production costs a lot more than solving them in development

blackfire.io @blackfireio #blackfireio

Agile and Continuous Integration/Delivery thrive to test and automate testing but no tool could

do that for code performance

We want performance to become a major component of Continuous Integration/Delivery

and prevent issues before they occur in production.

thanks to tools which will continuously and automatically test and improve

application performance,

Reason #3

Because now you can.

Step 1: Set your objectives

blackfire.io @blackfireio #blackfireio

Performance is business

T100ms 400ms

blackfire.io @blackfireio #blackfireio

Pages should be fast

Pages should be light

Pages should not do too many SQL queries

Pages should not become slower

Write it like you think of it

blackfire.io @blackfireio #blackfireio

# ~/workspace/project/.blackfire.yml tests: "Pages should be fast enough": path: "/.*" assertions: - "main.wall_time < 80ms" - "main.memory < 8M" - "main.peak_memory < 8M" - "main.io < 10ms" "Pages should not do too many SQL queries": path: "/.*" assertions: - "metrics.sql.queries.count <= 4" "Pages should be light": path: "/.*" assertions: - "metrics.output.network_out < 30KB" "Pages should not become slower": path: "/.*" assertions: - "percent(main.wall_time) < 10%" - "diff(metrics.sql.queries.count) < 2"

.blackfire.yml

Step 2: Circumscribe the issues

blackfire.io @blackfireio #blackfireio

blackfire.io @blackfireio #blackfireio

Profile visualization

blackfire.io @blackfireio #blackfireio

Step 3: Fix and check

blackfire.io @blackfireio #blackfireio

composer install --optimize-autoloader

blackfire.io @blackfireio #blackfireio

Step 4: Make sure it won’t happen

(again)

blackfire.io @blackfireio #blackfireio

TDD?

blackfire.io @blackfireio #blackfireio

# ~/workspace/project/.blackfire.yml tests: "Pages should be fast enough": path: "/.*" assertions: - "main.wall_time < 80ms" - "main.memory < 8M" - "main.peak_memory < 8M" - "main.io < 10ms" - "metrics.composer.file_lookups.count == 0"

metrics: composer.file_lookups: label: Composer File Lookups layer: ~ matching_calls: php: - callee: =Composer\Autoload\ClassLoader::findFileWithExtension

Custom Metrics

blackfire.io @blackfireio #blackfireio

Step 5: QA everywhere

blackfire.io @blackfireio #blackfireio

Continuous Deployment

Several times a day

blackfire.io @blackfireio #blackfireio

Completed 26 sprints

Marked 700+ stories and tasks as Done

rolled out 220 prod releases of the website

Merged 2,260 pull requests

In a year, we

Avg.

blackfire.io @blackfireio #blackfireio

Christophe Dujarric - Product Manager christophe.dujarric@blackfire.io

@Chris_Dujarric

Fire up your PHP Apps Performance

Recommended