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
Sebastian Grodzicki
April 20, 2015
Technology
1
97
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
27
Elasticsearch + Symfony @ SymfonyLive Online Polish Edition 2021
sgrodzicki
0
160
Elasticsearch + Symfony @ WDI 2021
sgrodzicki
0
49
Combining Logs, Metrics, and Traces for Unified Observability @ Infoshare 2020
sgrodzicki
0
520
Building Distributed Systems in Distributed Teams @ Infoshare 2020
sgrodzicki
0
71
Building Distributed Systems in Distributed Teams @ 4Developers 2020
sgrodzicki
0
71
Building Distributed Systems in Distributed Teams @ DevOpsDay Warsaw 2019
sgrodzicki
0
51
Infrastructure as Code @ DevOpsDay Warsaw 2019
sgrodzicki
0
81
Other Decks in Technology
See All in Technology
usermode linux without MMU - fosdem2026 kernel devroom
thehajime
0
230
量子クラウドサービスの裏側 〜Deep Dive into OQTOPUS〜
oqtopus
0
120
AIエージェントを開発しよう!-AgentCore活用の勘所-
yukiogawa
0
170
CDK対応したAWS DevOps Agentを試そう_20260201
masakiokuda
1
300
ClickHouseはどのように大規模データを活用したAIエージェントを全社展開しているのか
mikimatsumoto
0
230
Greatest Disaster Hits in Web Performance
guaca
0
250
Context Engineeringの取り組み
nutslove
0
350
インフラエンジニア必見!Kubernetesを用いたクラウドネイティブ設計ポイント大全
daitak
1
360
マーケットプレイス版Oracle WebCenter Content For OCI
oracle4engineer
PRO
5
1.6k
All About Sansan – for New Global Engineers
sansan33
PRO
1
1.3k
小さく始めるBCP ― 多プロダクト環境で始める最初の一歩
kekke_n
1
420
Bedrock PolicyでAmazon Bedrock Guardrails利用を強制してみた
yuu551
0
240
Featured
See All Featured
The Curious Case for Waylosing
cassininazir
0
240
Automating Front-end Workflow
addyosmani
1371
200k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
290
Odyssey Design
rkendrick25
PRO
1
500
Between Models and Reality
mayunak
1
190
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
310
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
280
Google's AI Overviews - The New Search
badams
0
910
Claude Code のすすめ
schroneko
67
210k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
93
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
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!