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
0
61
こまけぇこたぁいいんだよ!! PHPWebアプリケーションを早くする、それだけだ / It doesn't matter how small it is! Make PHPWeb applications faster, that's all!
PHPカンファレンス関西2024
shiro seike
PRO
February 11, 2024
Tweet
Share
More Decks by shiro seike
See All by shiro seike
Amazon Q Developer Proで効率化するAPI開発入門
seike460
PRO
0
110
(再)ひとり技術広報からの脱却 / Re:Breaking away from one-man technical public relations
seike460
PRO
1
140
PHPで作るWebSocketサーバー ~リアクティブなアプリケーションを知るために~ / WebSocket Server in PHP - To know reactive applications
seike460
PRO
2
880
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
260
AWS reInvent 2024サービスアップデートデモ / AWS reInvent 2024 Service Update Demo
seike460
PRO
0
43
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
620
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
1.2k
実践サーバーレスパフォーマンスチューニング ~その実力に迫る~ / Practical Serverless Performance Tuning ~A Close Look at its Power~
seike460
PRO
2
380
PHPを書く理由、PHPを書いていて良い理由 / Reasons to write PHP and why it is good to write PHP
seike460
PRO
5
650
Other Decks in Programming
See All in Programming
Unity Android XR入門
sakutama_11
0
160
富山発の個人開発サービスで日本中の学校の業務を改善した話
krpk1900
5
390
『品質』という言葉が嫌いな理由
korimu
0
160
なぜイベント駆動が必要なのか - CQRS/ESで解く複雑系システムの課題 -
j5ik2o
12
4.2k
color-scheme: light dark; を完全に理解する
uhyo
5
410
動作確認やテストで漏れがちな観点3選
starfish719
6
1k
Kubernetes History Inspector(KHI)を触ってみた
bells17
0
230
Java Webフレームワークの現状 / java web framework at burikaigi
kishida
9
2.2k
Djangoアプリケーション 運用のリアル 〜問題発生から可視化、最適化への道〜 #pyconshizu
kashewnuts
1
250
楽しく向き合う例外対応
okutsu
0
150
SpringBoot3.4の構造化ログ #kanjava
irof
2
1k
Formの複雑さに立ち向かう
bmthd
1
860
Featured
See All Featured
A designer walks into a library…
pauljervisheath
205
24k
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.5k
The Pragmatic Product Professional
lauravandoore
32
6.4k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Embracing the Ebb and Flow
colly
84
4.6k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
49
2.3k
The Invisible Side of Design
smashingmag
299
50k
Site-Speed That Sticks
csswizardry
4
380
We Have a Design System, Now What?
morganepeng
51
7.4k
Code Reviewing Like a Champion
maltzj
521
39k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
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/