Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Scaling LAMP
Search
Sebastian Grodzicki
April 20, 2015
Technology
110
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Scaling LAMP
Scaling LAMP doesn't have to suck
Sebastian Grodzicki
April 20, 2015
More Decks by Sebastian Grodzicki
See All by Sebastian Grodzicki
Fault-tolerant workflow orchestration in PHP @ PHPCon Poland 2024
sgrodzicki
0
180
PHP w Google Cloud @ PHPCon Poland 2022
sgrodzicki
0
54
Elasticsearch + Symfony @ SymfonyLive Online Polish Edition 2021
sgrodzicki
0
200
Elasticsearch + Symfony @ WDI 2021
sgrodzicki
0
71
Combining Logs, Metrics, and Traces for Unified Observability @ Infoshare 2020
sgrodzicki
0
570
Building Distributed Systems in Distributed Teams @ Infoshare 2020
sgrodzicki
0
97
Building Distributed Systems in Distributed Teams @ 4Developers 2020
sgrodzicki
0
95
Building Distributed Systems in Distributed Teams @ DevOpsDay Warsaw 2019
sgrodzicki
0
77
Infrastructure as Code @ DevOpsDay Warsaw 2019
sgrodzicki
0
100
Other Decks in Technology
See All in Technology
幾何アルゴリズムで なめらかなピン操作を / iOSDC Japan 2026 / smoothpin
kazumanagano
0
340
Snowflakeのコスト最適化を支えるアーキテクチャ設計
ktatsuya
1
1.6k
HRC_Frontend_Conference_Fukuoka_2026.pdf
ts020
0
680
MCPをつなげて作る組織横断のAIエージェント基盤(の開発工程)
tsubakimoto_s
0
120
すぐできる衛星通信対応 あとは山奥に行くだけ
tatetate55
0
120
山手線を徒歩で一周してわかった、 位置情報アプリは「足」が最強のデバッガー
hinakko
0
150
The Agent Builder Loop from Daily Work to OSS
minorun365
PRO
3
180
Deploying a Full-Stack Bun-Native Framework on Cloudflare Workers
7nohe
0
160
人間はどの意思決定を手放せるのか
kawasima
14
5.7k
LTのテーマ どうきめてる?〜5つの型と私のやり方〜
yama3133
1
100
SQL文一行も書けない人事がCortexもろもろを使って人事業務を楽にしてみる
ponponmikankan
1
240
Adaptive Warehouse を今すぐ導入すべき理由と迷ったときの判断基準
__allllllllez__
0
220
Featured
See All Featured
Statistics for Hackers
jakevdp
799
230k
New Earth Scene 8
popppiees
3
2.6k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.9k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
The Limits of Empathy - UXLibs8
cassininazir
1
660
エンジニアに許された特別な時間の終わり
watany
108
250k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Google's AI Overviews - The New Search
badams
0
1.6k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
930
Testing 201, or: Great Expectations
jmmastey
46
8.3k
Designing for Timeless Needs
cassininazir
1
470
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!