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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Sebastian Grodzicki
October 01, 2016
Technology
720
1
Share
Profiling PHP @ PHPCon Poland 2016
PHPCon Poland 2016
http://www.phpcon.pl/2016/pl/
Sebastian Grodzicki
October 01, 2016
More Decks by Sebastian Grodzicki
See All by Sebastian Grodzicki
Fault-tolerant workflow orchestration in PHP @ PHPCon Poland 2024
sgrodzicki
0
140
PHP w Google Cloud @ PHPCon Poland 2022
sgrodzicki
0
35
Elasticsearch + Symfony @ SymfonyLive Online Polish Edition 2021
sgrodzicki
0
180
Elasticsearch + Symfony @ WDI 2021
sgrodzicki
0
53
Combining Logs, Metrics, and Traces for Unified Observability @ Infoshare 2020
sgrodzicki
0
540
Building Distributed Systems in Distributed Teams @ Infoshare 2020
sgrodzicki
0
77
Building Distributed Systems in Distributed Teams @ 4Developers 2020
sgrodzicki
0
77
Building Distributed Systems in Distributed Teams @ DevOpsDay Warsaw 2019
sgrodzicki
0
58
Infrastructure as Code @ DevOpsDay Warsaw 2019
sgrodzicki
0
85
Other Decks in Technology
See All in Technology
Network Firewall Proxyで 自前プロキシを消し去ることができるのか
gusandayo
0
210
I ran an automated simulation of fake news spread using OpenClaw.
zzzzico
1
980
シン・リスコフの置換原則 〜現代風に考えるSOLIDの原則〜
jinwatanabe
0
150
Hooks, Filters & Now Context: Why MCPs Are the “Hooks” of the AI Era
miriamschwab
0
120
Data Enabling Team立ち上げました
sansantech
PRO
0
290
Databricks Lakebaseを用いたAIエージェント連携
daiki_akimoto_nttd
0
170
Zero Data Loss Autonomous Recovery Service サービス概要
oracle4engineer
PRO
4
13k
組織的なAI活用を阻む 最大のハードルは コンテキストデザインだった
ixbox
1
1.1k
仕様通り動くの先へ。Claude Codeで「使える」を検証する
gotalab555
8
3k
Oracle AI Database@Google Cloud:サービス概要のご紹介
oracle4engineer
PRO
6
1.3k
プロダクトを触って語って理解する、チーム横断バグバッシュのすすめ / 20260411 Naoki Takahashi
shift_evolve
PRO
1
210
🀄️ on swiftc
giginet
PRO
0
130
Featured
See All Featured
Claude Code のすすめ
schroneko
67
220k
The Spectacular Lies of Maps
axbom
PRO
1
680
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.3k
Utilizing Notion as your number one productivity tool
mfonobong
4
290
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
140
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Deep Space Network (abreviated)
tonyrice
0
110
How to build a perfect <img>
jonoalderson
1
5.3k
What does AI have to do with Human Rights?
axbom
PRO
1
2.1k
Crafting Experiences
bethany
1
110
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
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!