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アプリケーションを早くする、それだけだ / It doesn't matter how small it is! Make PHPWeb applications faster, that's all!
Search
shiro seike
PRO
February 11, 2024
Programming
0
10
こまけぇこたぁいいんだよ!! 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
地方こそサーバーレス、その意義に迫るサーバーレスPHP / Serverless PHP: The Rural Areas, and Why Serverless PHP Matters
seike460
PRO
2
110
サーバーレスらしさを意識した AWSにおける開発手法 / Development methodologies in AWS that are serverless-like
seike460
PRO
1
58
OpenAPIを中心に考えるAPI開発入門 / Introduction to API Development with a Focus on OpenAPI
seike460
PRO
2
200
PHP8.3の機能を振り返る / Review of PHP 8.3 features
seike460
PRO
1
130
フルサーバーレスアーキテクチャの運用を重ねた先に見える価値 / The value that can be seen beyond the operation of a full serverless architecture
seike460
PRO
0
23
決断するための勇気、そのためのBacklog / Courage to make decisions, Backlog for that.
seike460
PRO
4
2.1k
Backlog API x Generative AI
seike460
PRO
0
90
「サーバーレス」ってなんだろう みんなでワイガヤ談義 / What is "serverless?" Wigaya discussion with everyone
seike460
PRO
0
37
とにかくHTTP3をライトニングに話す / Anyway, I'll talk to Lightning about HTTP3.
seike460
PRO
0
140
Other Decks in Programming
See All in Programming
otelcol receiver 自作RTA / Pepabo Tech Conference #22 春のSREまつり
arthur1
0
1.1k
TypeScriptとGraphQLで実現する 型安全なAPI実装 / TSKaigi 2024
hokaccha
5
2.9k
The Hotwire Landscape After Turbo 8 @ Helvetic Ruby 2024, Zurich
marcoroth
0
110
How to improve maintainability and readability of your automated tests? ( #scrumniigata )
teyamagu
PRO
1
130
TypeScriptの型とパフォーマンス (TSKaigi 2024)
ypresto
14
5.2k
[RubyKaigi 2024] Ruby Mixology 101: adding shots of PHP, Elixir, and more
palkan
0
140
TypeScriptでもLLMアプリケーション開発 / LLM Application In Typescript
rkaga
5
1.4k
酒飲んでたらテックリードになった話
spbaya0141
0
210
Adding Security to Microcontroller Ruby
sylph01
1
170
RustでAWS Lambda functionをいい感じに書く
taiki45
2
160
The World is a Network (and We Are Just Nodes)
whatyouhide
0
100
WinActorの勉強を継続する方法
tamai_63
0
130
Featured
See All Featured
Navigating Team Friction
lara
179
13k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
275
13k
How GitHub (no longer) Works
holman
305
140k
Agile that works and the tools we love
rasmusluckow
325
20k
ParisWeb 2013: Learning to Love: Crash Course in Emotional UX Design
dotmariusz
104
6.7k
Done Done
chrislema
178
15k
The Brand Is Dead. Long Live the Brand.
mthomps
49
31k
Ruby is Unlike a Banana
tanoku
96
10k
StorybookのUI Testing Handbookを読んだ
zakiyama
13
4.7k
The Straight Up "How To Draw Better" Workshop
denniskardys
228
130k
Bootstrapping a Software Product
garrettdimon
PRO
302
110k
Fashionably flexible responsive web design (full day workshop)
malarkey
398
65k
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/