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
700
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
Fault-tolerant workflow orchestration in PHP @ PHPCon Poland 2024
sgrodzicki
0
100
PHP w Google Cloud @ PHPCon Poland 2022
sgrodzicki
0
18
Elasticsearch + Symfony @ SymfonyLive Online Polish Edition 2021
sgrodzicki
0
150
Elasticsearch + Symfony @ WDI 2021
sgrodzicki
0
48
Combining Logs, Metrics, and Traces for Unified Observability @ Infoshare 2020
sgrodzicki
0
500
Building Distributed Systems in Distributed Teams @ Infoshare 2020
sgrodzicki
0
62
Building Distributed Systems in Distributed Teams @ 4Developers 2020
sgrodzicki
0
63
Building Distributed Systems in Distributed Teams @ DevOpsDay Warsaw 2019
sgrodzicki
0
46
Infrastructure as Code @ DevOpsDay Warsaw 2019
sgrodzicki
0
69
Other Decks in Technology
See All in Technology
NOT A HOTEL SOFTWARE DECK (2025/11/06)
notahotel
0
3.4k
今日から使える AWS Step Functions 小技集 / AWS Step Functions Tips
kinunori
4
400
Boxを“使われる場”にする統制と自動化の仕組み
demaecan
0
210
AWS IAM Identity Centerによる権限設定をグラフ構造で可視化+グラフRAGへの挑戦
ykimi
2
380
ピープルウエア x スタートアップ
operando
3
3.5k
Logik: A Free and Open-source FPGA Toolchain
omasanori
0
220
Findy Data Engineering Summit 2025/11/06 mybest
jonnojun
0
110
MCP サーバーの基礎から実践レベルの知識まで
azukiazusa1
24
11k
触れるけど壊れないWordPressの作り方
masakawai
0
690
新米エンジニアをTech Leadに任命する ー 成長を支える挑戦的な人と組織のマネジメント
naopr
1
360
コミュニティと共に変化する 私とFusicの8年間
ayasamind
0
280
AI-ready"のための"データ基盤 〜 LLMOpsで事業貢献するための基盤づくり
ismk
0
120
Featured
See All Featured
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Facilitating Awesome Meetings
lara
57
6.6k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.8k
Side Projects
sachag
455
43k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.1k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
31
2.7k
Agile that works and the tools we love
rasmusluckow
331
21k
Visualization
eitanlees
150
16k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.7k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
658
61k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.5k
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!