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
79
PHP w Google Cloud @ PHPCon Poland 2022
sgrodzicki
0
13
Elasticsearch + Symfony @ SymfonyLive Online Polish Edition 2021
sgrodzicki
0
140
Elasticsearch + Symfony @ WDI 2021
sgrodzicki
0
47
Combining Logs, Metrics, and Traces for Unified Observability @ Infoshare 2020
sgrodzicki
0
470
Building Distributed Systems in Distributed Teams @ Infoshare 2020
sgrodzicki
0
56
Building Distributed Systems in Distributed Teams @ 4Developers 2020
sgrodzicki
0
60
Building Distributed Systems in Distributed Teams @ DevOpsDay Warsaw 2019
sgrodzicki
0
42
Infrastructure as Code @ DevOpsDay Warsaw 2019
sgrodzicki
0
58
Other Decks in Technology
See All in Technology
LangChain Interrupt & LangChain Ambassadors meetingレポート
os1ma
2
320
SEQUENCE object comparison - db tech showcase 2025 LT2
nori_shinoda
0
150
LLM時代の検索
shibuiwilliam
2
360
開発生産性を測る前にやるべきこと - 組織改善の実践 / Before Measuring Dev Productivity
kaonavi
13
6k
OpenTelemetryセマンティック規約の恩恵とMackerel APMにおける活用例 / SRE NEXT 2025
mackerelio
2
350
React開発にStorybookとCopilotを導入して、爆速でUIを編集・確認する方法
yu_kod
1
290
CRE Camp #1 エンジニアリングを民主化するCREチームでありたい話
mntsq
1
140
Contributing to Rails? Start with the Gems You Already Use
yahonda
2
100
スタートアップに選択肢を 〜生成AIを活用したセカンダリー事業への挑戦〜
nstock
0
250
開発生産性を組織全体の「生産性」へ! 部門間連携の壁を越える実践的ステップ
sudo5in5k
3
7.4k
Geminiとv0による高速プロトタイピング
shinya337
1
280
[ JAWS-UG千葉支部 x 彩の国埼玉支部 ]ムダ遣い卒業!FinOpsで始めるAWSコスト最適化の第一歩
sh_fk2
2
110
Featured
See All Featured
How to train your dragon (web standard)
notwaldorf
96
6.1k
Fireside Chat
paigeccino
37
3.5k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
60k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
281
13k
A Tale of Four Properties
chriscoyier
160
23k
Producing Creativity
orderedlist
PRO
346
40k
4 Signs Your Business is Dying
shpigford
184
22k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
RailsConf 2023
tenderlove
30
1.1k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3.1k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
31
1.3k
A Modern Web Designer's Workflow
chriscoyier
695
190k
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!