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
Scaling LAMP
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Sebastian Grodzicki
April 20, 2015
Technology
1
98
Scaling LAMP
Scaling LAMP doesn't have to suck
Sebastian Grodzicki
April 20, 2015
Tweet
Share
More Decks by Sebastian Grodzicki
See All by Sebastian Grodzicki
Fault-tolerant workflow orchestration in PHP @ PHPCon Poland 2024
sgrodzicki
0
130
PHP w Google Cloud @ PHPCon Poland 2022
sgrodzicki
0
34
Elasticsearch + Symfony @ SymfonyLive Online Polish Edition 2021
sgrodzicki
0
170
Elasticsearch + Symfony @ WDI 2021
sgrodzicki
0
52
Combining Logs, Metrics, and Traces for Unified Observability @ Infoshare 2020
sgrodzicki
0
530
Building Distributed Systems in Distributed Teams @ Infoshare 2020
sgrodzicki
0
74
Building Distributed Systems in Distributed Teams @ 4Developers 2020
sgrodzicki
0
74
Building Distributed Systems in Distributed Teams @ DevOpsDay Warsaw 2019
sgrodzicki
0
56
Infrastructure as Code @ DevOpsDay Warsaw 2019
sgrodzicki
0
83
Other Decks in Technology
See All in Technology
2026-03-11 JAWS-UG 茨城 #12 改めてALBを便利に使う
masasuzu
2
400
AWS DevOps Agent vs SRE俺 / AWS DevOps Agent vs me, the SRE
sms_tech
3
890
Oracle Cloud Infrastructure IaaS 新機能アップデート 2025/12 - 2026/2
oracle4engineer
PRO
0
170
"作る"から"使われる"へ:Backstage 活用の現在地
sbtechnight
0
180
Cortex Code CLI と一緒に進めるAgentic Data Engineering
__allllllllez__
0
410
Everything Claude Code を眺める
oikon48
11
7.2k
形式手法特論:SMT ソルバで解く認可ポリシの静的解析 #kernelvm / Kernel VM Study Tsukuba No3
ytaka23
1
490
OCHaCafe S11 #2 コンテナ時代の次の一手:Wasm 最前線
oracle4engineer
PRO
2
150
品質を経営にどう語るか #jassttokyo / Communicating the Strategic Value of Quality to Executive Leadership
kyonmm
PRO
2
490
アーキテクチャモダナイゼーションを実現する組織
satohjohn
1
1.1k
身体を持ったパーソナルAIエージェントの 可能性を探る開発
yokomachi
1
130
Google系サービスで文字起こしから勝手にカレンダーを埋めるエージェントを作った話
risatube
0
190
Featured
See All Featured
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
640
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
64
53k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
A Soul's Torment
seathinner
5
2.5k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
180
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Skip the Path - Find Your Career Trail
mkilby
1
84
Optimising Largest Contentful Paint
csswizardry
37
3.6k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
85
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
140
Transcript
Scaling LAMP doesn't have to suck
Sebastian Grodzicki CTO @ GoldenLine ~100 req/s ~4.7M UU
#DevOps
LAMP • Linux • Apache • MySQL • PHP
Scaling LAMP • shared hosting • VPS • dedicated server
Scaling LAMP • split LAMP into LM + LAP •
use virtual machines or Docker • forget 127.0.0.1 (AKA localhost) • forget about local storage
A better LAMP • Linux (tuned) • Apache Nginx •
MySQL Percona Server • PHP PHP-FPM • Redis • Resque
Linux (tuned) • Linux is mostly sane • use latest
kernel • distribution doesn’t matter • (I like Debian)
Tune Linux • open_files • network/sysctl • i/o scheduler
Linux: open_files • default: 1024 (ulimit -n) • soft nofile
999999 • hard nofile 999999
Linux: sysctl • net.ipv4.ip_local_port_range = 1024 65535 • net.ipv4.tcp_tw_recycle =
1 • net.ipv4.tcp_tw_reuse = 1 • net.core.somaxconn = 999999 (default: 128)
Linux: i/o scheduler • $ cat /sys/block/sda/queue/scheduler noop deadline [cfq]
• $ echo deadline > /sys/block/sda/queue/scheduler • $ cat /sys/block/sda/queue/scheduler noop [deadline] cfq
Nginx • open-source HTTP server • swap out Apache •
easy + sane config
Nginx 21k req/s @ 10% CPU & 160 MB RAM
Nginx • load balancer • reverse proxy • content caching
• streaming media • web server
Percona Server • open source MySQL fork • patches from
Twitter and Google • drop-in MySQL replacement • faster at scale, more reliable
MySQL vs Percona new transactions per minute
Percona Server • only use InnoDB (XtraDB) • disable query
cache • enable thread pool
PHP-FPM • standard with PHP 5.3+ • daemonization & process
management • used by Rasmus Lerdord (author of PHP)
PHP-FPM • pm = static • pm.max_children = {{ CPU
cores * 4 }} • pm.max_children = 32 # 8c/16t • pm.max_children = 64 # 16c/32t • pm.max_children = 80 # 20c/40t
PHP-FPM • 5.6 is faster than 5.5 • 5.5 is
faster than 5.4 • 5.4 is faster than 5.3 • 5.6 is much faster than 5.3
PHP-FPM • 5.6: OPcache • 5.5: OPcache • 5.4: APC
• 5.3: APC
Redis • key-value cache & store • >= Memcached •
optional persistence & hot cache • clients for almost every language • use phpredis (the C extension)
Resque • open source library • made by GitHub •
ported to PHP (php-reque) • uses Redis
Load Balancer A Load Balancer B App 1 App 2
App 3 App N DB 1 DB 2 DB N Redis 1 Redis 2 Redis N DNS
Questions?
Thank you!