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
630
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
22
Combining Logs, Metrics, and Traces for Unified Observability @ Infoshare 2020
sgrodzicki
0
390
Building Distributed Systems in Distributed Teams @ Infoshare 2020
sgrodzicki
0
44
Building Distributed Systems in Distributed Teams @ 4Developers 2020
sgrodzicki
0
40
Building Distributed Systems in Distributed Teams @ DevOpsDay Warsaw 2019
sgrodzicki
0
34
Infrastructure as Code @ DevOpsDay Warsaw 2019
sgrodzicki
0
47
Serverless PHP @ PHPCon Poland 2019
sgrodzicki
0
260
Profiling PHP @ HackYeah 2019
sgrodzicki
0
52
Other Decks in Technology
See All in Technology
RAGのサービスをリリースして1年3ヶ月が経ちました
segavvy
4
950
AI研修【MIXI 24新卒技術研修】
mixi_engineers
PRO
0
130
OSSコミットしてZennの課題を解決した話
dyoshikawa1993
0
150
データ分析基盤を作ってみよう~設計編~
nrinetcom
PRO
1
110
Scaling Technical Excellence at 104: Evolution in AWS and Developer Empowerment
scotthsieh825
1
160
DevIO2024_レガシー運用からの脱却 -クラウド活用の実践事例とベストプラクティス-
jun2882
0
210
Azure AI ことはじめ
tsubakimoto_s
0
130
[NIKKEI Tech Talk]Bias for Action!! 実践から学ぶための仕組とコミュニティ / Community for Practice and Learning
kanamasa
0
280
GoとアクターモデルでES+CQRSを実践! / proto_actor_es_cqrs
ytake
1
160
シフトレフトで挑む セキュリティの生産性向上
sekido
PRO
0
270
「我々はどこに向かっているのか」を問い続けるための仕組みづくり / Establishing a System for Continuous Inquiry about where we are
daitasu
0
170
さらに高品質・高速化を目指すAI時代のテスト設計支援と、めざす先 / AI Test Lab vol.1
shift_evolve
0
190
Featured
See All Featured
What the flash - Photography Introduction
edds
65
11k
Writing Fast Ruby
sferik
623
60k
Art, The Web, and Tiny UX
lynnandtonic
291
20k
Music & Morning Musume
bryan
43
5.9k
The Language of Interfaces
destraynor
151
23k
Faster Mobile Websites
deanohume
303
30k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
248
20k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
121
18k
GitHub's CSS Performance
jonrohan
1026
450k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
90
47k
10 Git Anti Patterns You Should be Aware of
lemiorhan
652
58k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
502
140k
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!