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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
34
Elasticsearch + Symfony @ SymfonyLive Online Polish Edition 2021
sgrodzicki
0
170
Elasticsearch + Symfony @ WDI 2021
sgrodzicki
0
51
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
55
Infrastructure as Code @ DevOpsDay Warsaw 2019
sgrodzicki
0
83
Other Decks in Technology
See All in Technology
IBM Bobを使って、PostgreSQLのToDoアプリをDb2へ変換してみよう/202603_Dojo_Bob
mayumihirano
1
350
OCHaCafe S11 #2 コンテナ時代の次の一手:Wasm 最前線
oracle4engineer
PRO
2
130
Exadata Database Service on Dedicated Infrastructure(ExaDB-D) UI スクリーン・キャプチャ集
oracle4engineer
PRO
8
7.2k
VLAモデル構築のための AIロボット向け模倣学習キット
kmatsuiugo
0
140
身体を持ったパーソナルAIエージェントの 可能性を探る開発
yokomachi
1
120
クラウド × シリコンの Mashup - AWS チップ開発で広がる AI 基盤の選択肢
htokoyo
2
250
JAWSDAYS2026_A-6_現場SEが語る 回せるセキュリティ運用~設計で可視化、AIで加速する「楽に回る」運用設計のコツ~
shoki_hata
0
3k
It’s “Time” to use Temporal
sajikix
1
140
(Test) ai-meetup slide creation
oikon48
3
390
JAWS FESTA 2025でリリースしたほぼリアルタイム文字起こし/翻訳機能の構成について
naoki8408
1
520
わからなくて良いなら、わからなきゃだめなの?
kotaoue
1
360
Cortex Code CLI と一緒に進めるAgentic Data Engineering
__allllllllez__
0
250
Featured
See All Featured
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
310
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.2k
The SEO identity crisis: Don't let AI make you average
varn
0
410
Building a Scalable Design System with Sketch
lauravandoore
463
34k
We Have a Design System, Now What?
morganepeng
55
8k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
410
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
210
Prompt Engineering for Job Search
mfonobong
0
180
Ethics towards AI in product and experience design
skipperchong
2
220
The Art of Programming - Codeland 2020
erikaheidi
57
14k
SEO for Brand Visibility & Recognition
aleyda
0
4.4k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.2k
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!