Slide 1

Slide 1 text

Performance is no more a curse
 with RomainNeutron https://www.flickr.com/photos/latitudes/348189242

Slide 2

Slide 2 text

Romain Neutron 
 
 
 Blackfire.io developer
 OpenSource contributor
 
 https://github.com/romainneutron https://twitter.com/romainneutron

Slide 3

Slide 3 text

Why Profiling? https://www.flickr.com/photos/latitudes/348189242

Slide 4

Slide 4 text

https://www.flickr.com/photos/latitudes/348189242 Performance means Resources Less CPU Less Memory Less Network Less Servers ...
 Sustainable computing

Slide 5

Slide 5 text

Performance means Business More repeat business More page views per visit Better conversions More revenue Increased user satisfaction ... http://www.slideshare.net/stoyan/the-business-of-performance

Slide 6

Slide 6 text

abandon a website that takes more than 3 seconds to load 40% of users

Slide 7

Slide 7 text

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

Slide 8

Slide 8 text

Performance as a feature https://www.flickr.com/photos/jprovost/5733297977

Slide 9

Slide 9 text

Profiling Benchmarking Load-testing Monitoring https://www.flickr.com/photos/fallsroad/13240207

Slide 10

Slide 10 text

Performance?

Slide 11

Slide 11 text

microtime() https://www.flickr.com/photos/rainriver/6967744353

Slide 12

Slide 12 text

Instrumentation https://www.flickr.com/photos/dlajholt/4939986995/

Slide 13

Slide 13 text

Wall Clock Time https://www.flickr.com/photos/guiseiz/6094701062

Slide 14

Slide 14 text

function foo()
 { bar();
 echo 'foo';
 }
 foo(); Wall-Clock Time

Slide 15

Slide 15 text

function foo()
 { bar();
 echo 'foo';
 }
 foo(); Inclusive Time

Slide 16

Slide 16 text

Inclusive Time Critical path of an app

Slide 17

Slide 17 text

function foo()
 { bar();
 echo 'foo';
 }
 foo(); Exclusive Time

Slide 18

Slide 18 text

Exclusive Time Find the functions to optimize first

Slide 19

Slide 19 text

Wall Time = CPU + I/O I/O = Network + Disk

Slide 20

Slide 20 text

Memory

Slide 21

Slide 21 text

Call Graph Profiler

Slide 22

Slide 22 text

The easiest way to profile applications in the development but also in the production environment The best visualization tool for interpreting profiling traces for memory, CPU, I/O and for all languages* * Specific extension for PHP, callgrind for other languages

Slide 23

Slide 23 text

Browser Companion PHP Probe Agent 10/ Upload aggregated profile 1/ Sign request 2/ Signed request 3/ Create profile 4/ Check signature 5/ Request 6/ Response 7/ Send profile 8/ Continue or stop 9/ Continue or stop Storage 11/ Store

Slide 24

Slide 24 text

LA DEMO

Slide 25

Slide 25 text

Continuous Performance

Slide 26

Slide 26 text

Performance Tests https://www.flickr.com/photos/garrett/2548828323/

Slide 27

Slide 27 text

# ~/workspace/projet/.blackfire.yml
 
 tests:
 "Pages should be fast enough":
 path: "/.*"
 assertions:
 - "main.wall_time < 300ms"
 - "main.memory < 50M"
 - "main.peak_memory < 75M"
 - "main.io < 20ms"
 - "main.cpu_time < 100ms"
 "Pages should not do too many SQL queries":
 path: "/.*"
 assertions:
 - "metrics.sql.queries.count <= 12"
 "Pages should be light":
 path: "/.*"
 assertions:
 - "metrics.output.network_out < 100KB"
 "Pages should not become slower":
 path: "/.*"
 assertions:
 - "percent(main.wall_time) < 10%"
 - "diff(metrics.sql.queries.count) < 2"
 .blackfire.yml

Slide 28

Slide 28 text

# ~/workspace/projet/.blackfire.yml
 
 tests:
 "Page should not tag a graph":
 path: ".*"
 assertions:
 - “metrics.process.run.count == 0"
 
 metrics:
 process.run:
 label: “Run a process"
 layer: ~
 matching_calls:
 php:
 - callee: “=proc_open" Custom Metrics

Slide 29

Slide 29 text

Try it today! @blackfireio #blackfireio OSLEZMEETUP092015