×
Copy
Open
Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
PROFILING PHP SEBASTIAN GRODZICKI
Slide 2
Slide 2 text
WHO USES PHP?
Slide 3
Slide 3 text
WHO USES PHP 7?
Slide 4
Slide 4 text
WHO USES PHPUNIT?
Slide 5
Slide 5 text
WHO USES XDEBUG?
Slide 6
Slide 6 text
WHO USES BLACKFIRE?
Slide 7
Slide 7 text
SEBASTIAN GRODZICKI CTO @ SHOWROOM
Slide 8
Slide 8 text
I’M NOT HIRED BY BLACKFIRE. Sebastian Grodzicki DISCLAIMER
Slide 9
Slide 9 text
40% OF USERS ABANDON A WEBSITE THAT TAKES MORE THAN 3 SECONDS TO LOAD Akamai STATISTICS
Slide 10
Slide 10 text
PROFILING IS A WAY TO MEASURE WHERE A PROGRAM SPENDS TIME MathWorks DEFINITION
Slide 11
Slide 11 text
MICROTIME
Slide 12
Slide 12 text
log_format foobar '$remote_addr ' '"$request" $status $body_bytes_sent ' '"$http_referer" "$http_user_agent" ' '$request_time $upstream_response_time’; access_log /var/log/nginx/access.log foobar; NGINX
Slide 13
Slide 13 text
Xdebug
Slide 14
Slide 14 text
xdebug.profiler_enable_trigger = 1 http://url?XDEBUG_PROFILE=1
Slide 15
Slide 15 text
KCACHEGRIND
Slide 16
Slide 16 text
PROFILING PHP WEBGRIND
Slide 17
Slide 17 text
XHProf
Slide 18
Slide 18 text
Slide 19
Slide 19 text
XHPROF
Slide 20
Slide 20 text
No content
Slide 21
Slide 21 text
No content
Slide 22
Slide 22 text
PROFILING PHP TIME Wall time I/O CPU Disk I/O Network = = + +
Slide 23
Slide 23 text
PROFILING PHP INCLUSIVE VS EXCLUSIVE TIME function foo() { $str = bar(); return $str; } function foo() { $str = bar(); return $str; }
Slide 24
Slide 24 text
BLACKFIRE CONTINUOUS PERFORMANCE TESTING
Slide 25
Slide 25 text
BLACKFIRE CALLGRAPHS
Slide 26
Slide 26 text
BLACKFIRE HOT PATHS
Slide 27
Slide 27 text
DEMO CHROME COMPANION
Slide 28
Slide 28 text
No content
Slide 29
Slide 29 text
No content
Slide 30
Slide 30 text
DEMO BLACKFIRE CURL
Slide 31
Slide 31 text
No content
Slide 32
Slide 32 text
DEMO BLACKFIRE RUN
Slide 33
Slide 33 text
No content
Slide 34
Slide 34 text
No content
Slide 35
Slide 35 text
ASSERTIONS
Slide 36
Slide 36 text
PROFILING PHP ASSERTIONS tests: "Application should never hit the DB": path: "/.*" assertions: - "metrics.sql.queries.count == 0"
Slide 37
Slide 37 text
PROFILING PHP ASSERTIONS tests: "Homepage should never call the API": path: "/" assertions: - "metrics.http.requests.count == 0"
Slide 38
Slide 38 text
PROFILING PHP ASSERTIONS tests: "Pages should be fast enough": path: "/.*" assertions: - "main.wall_time < 100ms"
Slide 39
Slide 39 text
No content
Slide 40
Slide 40 text
BUILDS
Slide 41
Slide 41 text
No content
Slide 42
Slide 42 text
No content
Slide 43
Slide 43 text
No content
Slide 44
Slide 44 text
PHP SDK
Slide 45
Slide 45 text
BLACKFIRE PHP SDK ▸ composer require blackfire/php-sdk ▸ $blackfire = new \Blackfire\Client(); ▸ $probe = $blackfire->createProbe(); ▸ $profile = $blackfire->endProbe($probe);
Slide 46
Slide 46 text
PHPUNIT
Slide 47
Slide 47 text
assert('metrics.sql.queries.count < 5', 'SQL queries') ->assert('metrics.twig.render.count < 3', 'Rendered Twig templates') ->assert('metrics.twig.compile.count == 0', 'Twig compilation') ; } }
Slide 48
Slide 48 text
blackfire.io/docs/24-days
Slide 49
Slide 49 text
QUESTIONS?
Slide 50
Slide 50 text
THANK YOU!