Slide 1

Slide 1 text

blackfire.io @blackfireio #blackfireio Profiling PHP applications everywhere, all the time 27/06/2019 - Datadog HQ, New York City

Slide 2

Slide 2 text

blackfire.io @blackfireio #blackfireio Marc Weistroff CTO / blackfire.io [email protected] https://marc.weistroff.net ❤ food, music, books, and bouldering.

Slide 3

Slide 3 text

Profiling?

Slide 4

Slide 4 text

blackfire.io @blackfireio #blackfireio In software engineering, software profiling is a form of
 
 dynamic program analysis
 
 that measures, for example,
 
 the space (memory) 
 or time complexity of a program,
 or the duration of function calls definition

Slide 5

Slide 5 text

Profiling surfaces data from the lowest & deepest level of your application

Slide 6

Slide 6 text

profiling goes deeper than tracing

Slide 7

Slide 7 text

Everywhere?

Slide 8

Slide 8 text

performance?

Slide 9

Slide 9 text

blackfire.io @blackfireio #blackfireio Bad performance = Dysfunction (= Bug) Performance management should be part of CI/CD pipeline Quality

Slide 10

Slide 10 text

blackfire.io @blackfireio #blackfireio Bad performance = Bad business Slowness brings opportunity cost Cart drop. Conversion rate drop.
 Compare load time to conversion rate and you’ll have a number. example: 1s = ~300K / year in opportunity cost True cost depends of your business. Business Risk

Slide 11

Slide 11 text

Performance in the development lifecycle

Slide 12

Slide 12 text

blackfire.io @blackfireio #blackfireio 1. Alice catches a performance issue on production 2. Alice pushes a fix. Tests are run. 3. PR is merged & deployed to staging. 4. QA validation process start. 5. Fix is deployed to production. Performance increased 6. Bob wants to refactor Alice’s code, and ruins everything. 7. goto: 1 Classic performance horror story

Slide 13

Slide 13 text

blackfire.io @blackfireio #blackfireio The cost of this scenario is horrendous Opportunity cost
 + development cost
 + review cost
 + bob’s cost
 Performance Economics

Slide 14

Slide 14 text

Performance management needs to be better integrated in development processes

Slide 15

Slide 15 text

Introducing blackfire.io

Slide 16

Slide 16 text

blackfire.io @blackfireio #blackfireio Profiling Directly from your terminal: $ blackfire curl https://blackfire.io or from the browser with our official extensions for Chrome and Firefox

Slide 17

Slide 17 text

blackfire.io @blackfireio #blackfireio Callgraph view

Slide 18

Slide 18 text

blackfire.io @blackfireio #blackfireio Timespan view

Slide 19

Slide 19 text

blackfire.io @blackfireio #blackfireio Metrics

Slide 20

Slide 20 text

Time spent is just a consequence. Causes are elsewhere.

Slide 21

Slide 21 text

blackfire.io @blackfireio #blackfireio User-defined assertions

Slide 22

Slide 22 text

blackfire.io @blackfireio #blackfireio Recommendations

Slide 23

Slide 23 text

blackfire.io @blackfireio #blackfireio On-demand All environments: dev/staging/PR/prod Safe for prod: 0-overhead for non-profiling requests Distributed Profiling ➡ Perfect tool to detect and understand performance issues on a page. Profiling

Slide 24

Slide 24 text

How to detect regressions?

Slide 25

Slide 25 text

Unit test

Slide 26

Slide 26 text

blackfire.io @blackfireio #blackfireio Our SDK is tightly integrated with PHPUnit Run profiling inside your test suite Evaluate metrics on your tested code PHP SDK

Slide 27

Slide 27 text

blackfire.io @blackfireio #blackfireio PHP-SDK & PHPUnit

Slide 28

Slide 28 text

PR / Staging / Prod

Slide 29

Slide 29 text

blackfire.io @blackfireio #blackfireio Continuous 0-overhead profiling on staging & prod User-defined scenarios User-defined performance budgets Monitoring

Slide 30

Slide 30 text

blackfire.io @blackfireio #blackfireio

Slide 31

Slide 31 text

blackfire.io @blackfireio #blackfireio Performance budget

Slide 32

Slide 32 text

blackfire.io @blackfireio #blackfireio Performance budget

Slide 33

Slide 33 text

blackfire.io @blackfireio #blackfireio Results

Slide 34

Slide 34 text

blackfire.io @blackfireio #blackfireio Comparisons

Slide 35

Slide 35 text

blackfire.io @blackfireio #blackfireio Scheduled Automated via webhooks Set green/red commit status for CI/CD Possible to create complex scenarios Automated Builds

Slide 36

Slide 36 text

blackfire.io @blackfireio #blackfireio Open-Source Web Crawler / Scraper / Tester https://github.com/blackfireio/player Integration tests meet profiling Scenarios

Slide 37

Slide 37 text

blackfire.io @blackfireio #blackfireio

Slide 38

Slide 38 text

blackfire.io @blackfireio #blackfireio On-demand profiling in every env (prod / staging / dev / PR) Performance assertions based on code metrics for unit/integration tests Performance budgets for scenarios Continuous 0-overhead scenario assessment for each environment Incorporate performance management in your whole application development lifecycle

Slide 39

Slide 39 text

How do we do that?

Slide 40

Slide 40 text

blackfire.io @blackfireio #blackfireio Architecture

Slide 41

Slide 41 text

Conclusion

Slide 42

Slide 42 text

Dynamic Code Analysis is essential for quality & business risk management 
 (a.k.a. performance)

Slide 43

Slide 43 text

blackfire.io @blackfireio #blackfireio Nobody has stellar performance unless it is part of continuous improvement & investment. Start at 95p. Move gradually up. Stop at 98p/99p. Bad performance is a business risk. Act accordingly. Integrate performance in your development lifecycle

Slide 44

Slide 44 text

blackfire.io @blackfireio #blackfireio Development lifecycle Blackfire makes it easy to integrate performance in your application development lifecycle. On-demand profiling, metrics, assertions, continuous profiling, scenarios, distributed profiling, …

Slide 45

Slide 45 text

blackfire.io @blackfireio #blackfireio XHProf https://github.com/longxinH/xhprof php-spy https://github.com/adsr/phpspy php-spx https://github.com/NoiseByNorthwest/php-spx Open-Source tools

Slide 46

Slide 46 text

Coupon: summer19

Slide 47

Slide 47 text

blackfire.io @blackfireio #blackfireio Thank you! https://blackfire.io