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
こまけぇこたぁいいんだよ!! PHPWebアプリケーションを早くする、それだけだ / ...
Search
shiro seike
PRO
February 11, 2024
Programming
130
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
こまけぇこたぁいいんだよ!! PHPWebアプリケーションを早くする、それだけだ / It doesn't matter how small it is! Make PHPWeb applications faster, that's all!
PHPカンファレンス関西2024
shiro seike
PRO
February 11, 2024
More Decks by shiro seike
See All by shiro seike
Seeing Through Serverless: Observability for AWS Lambda with ADOT and CloudWatch Application Signals
seike460
PRO
1
95
Seeing Through Serverless: ADOT と CloudWatch Application Signals で実現する AWS Lambda のオブザーバビリティ(日本語版)/ Seeing Through Serverless (Japanese Edition)
seike460
PRO
1
10
モノレポの型は、そのままつながる 〜Hono RPCで型を素通しする開発体験〜 / Monorepo Types Connect As-Is: Passing Types Through with Hono RPC
seike460
PRO
1
9
OSSのコンセプトを知る / Understanding the Concept Behind an OSS
seike460
PRO
1
8
型も通る、synthも通る、それでも危ない 〜AIのCDKの権限とコストを機械で検証する〜 / It Passes Type Checks, It Passes Synth Checks, but It’s Still Risky — Automatically Verifying Permissions and Costs in AI’s CDK —
seike460
PRO
1
610
コミュニティの有益性 ~JAWS Days 2026 での体験を通して~ / The Benefits of a Community ~Through My Experience at JAWS Days 2026~
seike460
PRO
0
440
実行委員長目線で振り返る JAWS DAYS 2026 / JAWS DAYS 2026 from the Chair's Perspective
seike460
PRO
1
13
SLO から始める SRE / Starting SRE with SLO
seike460
PRO
1
86
Architecture as SteeringOn-Ramp to AI-DLC
seike460
PRO
0
50
Other Decks in Programming
See All in Programming
Oxlintはいいぞ(続)
yug1224
1
510
ソフトウェアエンジニアにとっての生成AI - 特性を知って使い倒す / generative ai for software enginner
kishida
7
2.3k
Can LLMs Replicate 4 Years of Compose Migration? Exploring the boundaries of automation with 279 XML files from a real product
makun
0
120
Pythonの実行はどこまで賢くなったのか? CPythonとPyPyから見る最適化のしくみ
curekoshimizu
4
2.4k
リアルな遅延を測る仕様
kota_yata
1
130
GKE アップグレード前に知っておきたい Blue/Green と PDB の関係
stkk
0
130
週末にAI-DLCを本気で回したら$1,600溶けた
hbashimizu
0
120
Jindong: Introducing Declarative Haptics in Compose Multiplatform
l2hyunwoo
0
140
AWS Transform Customによる Spring Boot 2.xから4.xへのVerUp
satoshi256kbyte
2
120
XHTMLが残したもの
yosuke_furukawa
PRO
1
320
Go 1.27 における memory allocation の高速化
andpad
0
370
夏だ!祭りだ!祭りとはドメインモデリングでは?
ryugen04
0
510
Featured
See All Featured
WCS-LA-2024
lcolladotor
0
820
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.4k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
300
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
640
HDC tutorial
michielstock
2
830
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
370
How to Think Like a Performance Engineer
csswizardry
28
2.8k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
510
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.6k
Transcript
!! PHPWeb PHP 西 2024 2 0 24 . 2
. 11 @seike 4 60 1
自己 @seike 46 0 - - @seike 46 0 -
AWS Community Builder Serverless - Fusic - / 門 - / - 月 PHP - PHP 2024 LT ( ) - PHP 大 2024 LT (Now ) - PHPerKaigi 20 2 4 LT - PHP 小 田 2024 - PHP 香 2024 - PHP 2024 2
!! - @seike 4 60 - Fusic - PHPerKaigi
3
Agenda 1 . 2 . 3 . 4 . 4
01
None
用 - Web - DB - c 5 .large
vCPU 2 4 GiB 20GiB 7
02
ISUCON 12 ISUCON 12 PHP ISUCON 大 自 9
03
phpspy phpspy 11
方 pgrep phpspy 用 12 $ ./phpspy
-b 81 920 --limit= 1 00 0 0 --pid=$(pgrep -n php-fpm) > traces $ ./stackcollapse-phpspy.pl <traces | ./vendor/flamegraph.pl >flame.svg
04
PHP 入 14 SCORE: 13 27 (+ 132 7 0
( 0 %))
DB Web DB 行 用 Web DB 15
DB PHP 入 Web DB 16 SCORE: 13 27 (+
132 7 0 ( 0 %)) SCORE: 14 69 (+ 146 9 0 ( 0 %))
htop htop 17
DB DB MySQL innodb_buffer_pool_size innodb_log_file_size innodb_flush_log_at_trx_commit innodb_flush_method table_open_cache thread_cache_size max_connections
18
DB PHP 入 Web DB DB 19 SCORE: 13 27
(+ 132 7 0 ( 0 %)) SCORE: 14 69 (+ 146 9 0 ( 0 %)) SCORE: 16 95 (+ 169 5 0 ( 0 %))
Index DB Index pt-query-digest 用 20 ALTER TABLE visit_history DROP
INDEX tenant_id_idx; ALTER TABLE visit_history ADD INDEX tenant_id_idx(tenant_id, competition_id, player_id, created_at);
Index PHP 入 Web DB DB Index 21 SCORE: 13
27 (+ 132 7 0 ( 0 %)) SCORE: 14 69 (+ 146 9 0 ( 0 %)) SCORE: 16 95 (+ 169 5 0 ( 0 %)) SCORE: 18 67 (+ 186 7 0 ( 0 %))
N+ 1 22 MySQL App\Isuports\Handlers::playerHandler N+ 1 行
N+ 1 PHP 入 Web DB DB Index N+ 1
23 SCORE: 13 27 (+ 132 7 0 ( 0 %)) SCORE: 14 69 (+ 146 9 0 ( 0 %)) SCORE: 16 95 (+ 169 5 0 ( 0 %)) SCORE: 18 67 (+ 186 7 0 ( 0 %)) SCORE: 24 33 (+ 243 3 0 ( 0 %))
Nginx - worker_processes -> auto - worker_connections - keepalive_timeout 入
gzip gzip_vary gzip_proxied gzip_comp_level gzip_buffers gzip_http_version 24
php-fpm 25 Fork Process Process - pm.max_children - pm.start_servers -
pm.min_spare_servers - pm.max_spare_servers - rlimit_files
php-fpm 26 OPcache PHP 8 目玉 JIT PHP 入 OPcache
opcache.enable JIT opcache.jit opcache.jit_buffer_size opcache.max_accelerated_files opcache.memory_consumption opcache.validate_timestamps XDebug
OS OS 大 ⾒ ulimit 大
net.core.somaxconn vm.swappiness fs.file-max 27
Nginx + php-fpm + OS PHP 入 Web DB DB
Index N+ 1 Nginx + php-fpm + OS 28 SCORE: 13 27 (+ 132 7 0 ( 0 %)) SCORE: 14 69 (+ 146 9 0 ( 0 %)) SCORE: 16 95 (+ 169 5 0 ( 0 %)) SCORE: 18 67 (+ 186 7 0 ( 0 %)) SCORE: 24 33 (+ 243 3 0 ( 0 %)) SCORE: 30 12 (+ 301 2 0 ( 0 %))
見 立 用 大 手 大 自 29
見 30 PHP https://speakerdeck.com/seike 4 6 0 /php-web-application-performance-tuning
Thank You We are Hiring ! https://recruit.fusic.co.jp/