Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Performance is no more a curse

Performance is no more a curse

I bet you are writing unit tests for your apps; if not, you probably feel ashamed. But what about performance? Everyone is talking about it but very few people actually integrate performance into their development workflow... After some quick theory, I will show you how to use Blackfire that makes it so easy to profile your apps that you won't have any more excuses anymore for not doing it. Finally, I will talk about my new holy grail: Continuous Performance Profiling.

Romain Neutron

September 15, 2015
Tweet

More Decks by Romain Neutron

Other Decks in Programming

Transcript

  1. Romain Neutron 
 
 
 Blackfire.io developer
 OpenSource contributor
 


    https://github.com/romainneutron https://twitter.com/romainneutron
  2. 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
  3. 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
  4. 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
  5. # ~/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
  6. # ~/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