Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Profiling PHP @ PHPCon Poland 2016
Search
Sebastian Grodzicki
October 01, 2016
Technology
1
550
Profiling PHP @ PHPCon Poland 2016
PHPCon Poland 2016
http://www.phpcon.pl/2016/pl/
Sebastian Grodzicki
October 01, 2016
Tweet
Share
More Decks by Sebastian Grodzicki
See All by Sebastian Grodzicki
Elasticsearch + Symfony @ SymfonyLive Online Polish Edition 2021
sgrodzicki
0
100
Elasticsearch + Symfony @ WDI 2021
sgrodzicki
0
16
Combining Logs, Metrics, and Traces for Unified Observability @ Infoshare 2020
sgrodzicki
0
380
Building Distributed Systems in Distributed Teams @ Infoshare 2020
sgrodzicki
0
43
Building Distributed Systems in Distributed Teams @ 4Developers 2020
sgrodzicki
0
38
Building Distributed Systems in Distributed Teams @ DevOpsDay Warsaw 2019
sgrodzicki
0
33
Infrastructure as Code @ DevOpsDay Warsaw 2019
sgrodzicki
0
42
Serverless PHP @ PHPCon Poland 2019
sgrodzicki
0
240
Profiling PHP @ HackYeah 2019
sgrodzicki
0
48
Other Decks in Technology
See All in Technology
KubeConにproposalを送りたい人へのアドバイス
sat
PRO
3
240
Python と Snowflake はズッ友だょ!~ Snowflake の Python 関連機能をふりかえる ~
__allllllllez__
1
120
アクセス制御にまつわる改善 / Improving access control
itkq
0
530
障害対応をちょっとずつよくしていくための 演習の作りかた
heleeen
0
140
ServiceNow Knowledge Learning Rise up
manarobot
0
210
Google Cloud の AI を支える裏側のインフラを垣間見る!
maroon1st
0
340
Google Cloud Next '24でブログを10本書いた方法と勉強会を沸かせた方法
yasumuusan
0
290
生産性向上チームの紹介
cybozuinsideout
PRO
1
870
Azureの基本的な権限管理の勉強会
yhana
0
240
Reducing Cross-Zone Egress at Spotify with Custom gRPC Load Balancing Recap
koh_naga
0
200
データベース02: データベースの概念
trycycle
0
150
推しは推せるときに推せ! プロダクトにフィードバックしていこう
nakasho
0
300
Featured
See All Featured
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
501
140k
Gamification - CAS2011
davidbonilla
76
4.6k
Clear Off the Table
cherdarchuk
84
310k
Principles of Awesome APIs and How to Build Them.
keavy
121
16k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
40
4.4k
From Idea to $5000 a Month in 5 Months
shpigford
377
45k
What's new in Ruby 2.0
geeforr
337
31k
Web development in the modern age
philhawksworth
202
10k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
20
1.9k
Designing the Hi-DPI Web
ddemaree
276
33k
Music & Morning Musume
bryan
41
5.6k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
352
28k
Transcript
PROFILING PHP SEBASTIAN GRODZICKI
WHO USES PHP?
WHO USES PHP 7?
WHO USES PHPUNIT?
WHO USES XDEBUG?
WHO USES BLACKFIRE?
SEBASTIAN GRODZICKI CTO @ SHOWROOM
I’M NOT HIRED BY BLACKFIRE. Sebastian Grodzicki DISCLAIMER
40% OF USERS ABANDON A WEBSITE THAT TAKES MORE THAN
3 SECONDS TO LOAD Akamai STATISTICS
PROFILING IS A WAY TO MEASURE WHERE A PROGRAM SPENDS
TIME MathWorks DEFINITION
MICROTIME
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
Xdebug
xdebug.profiler_enable_trigger = 1 http://url?XDEBUG_PROFILE=1
KCACHEGRIND
PROFILING PHP WEBGRIND
XHProf
<?php xhprof_enable(); # do some stuff $xhprof_data = xhprof_disable();
XHPROF
None
None
PROFILING PHP TIME Wall time I/O CPU Disk I/O Network
= = + +
PROFILING PHP INCLUSIVE VS EXCLUSIVE TIME function foo() { $str
= bar(); return $str; } function foo() { $str = bar(); return $str; }
BLACKFIRE CONTINUOUS PERFORMANCE TESTING
BLACKFIRE CALLGRAPHS
BLACKFIRE HOT PATHS
DEMO CHROME COMPANION
None
None
DEMO BLACKFIRE CURL
None
DEMO BLACKFIRE RUN
None
None
ASSERTIONS
PROFILING PHP ASSERTIONS tests: "Application should never hit the DB":
path: "/.*" assertions: - "metrics.sql.queries.count == 0"
PROFILING PHP ASSERTIONS tests: "Homepage should never call the API":
path: "/" assertions: - "metrics.http.requests.count == 0"
PROFILING PHP ASSERTIONS tests: "Pages should be fast enough": path:
"/.*" assertions: - "main.wall_time < 100ms"
None
BUILDS
None
None
None
PHP SDK
BLACKFIRE PHP SDK ▸ composer require blackfire/php-sdk ▸ $blackfire =
new \Blackfire\Client(); ▸ $probe = $blackfire->createProbe(); ▸ $profile = $blackfire->endProbe($probe);
PHPUNIT
<?php use Blackfire\Bridge\PhpUnit\TestCaseTrait; use Blackfire\Profile; class IntegrationTest extends
\PHPUnit_Framework_TestCase { use TestCaseTrait; /** * @requires extension blackfire */ public function testSomething() { $config = new Profile\Configuration(); $config ->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') ; } }
blackfire.io/docs/24-days
QUESTIONS?
THANK YOU!