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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
Transcript
27 slides
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!
More Decks by Sebastian Grodzicki
See All by Sebastian Grodzicki
Fault-tolerant workflow orchestration in PHP @ PHPCon Poland 2024
sgrodzicki
0
190
PHP w Google Cloud @ PHPCon Poland 2022
sgrodzicki
0
65
Elasticsearch + Symfony @ SymfonyLive Online Polish Edition 2021
sgrodzicki
0
210
Elasticsearch + Symfony @ WDI 2021
sgrodzicki
0
83
Combining Logs, Metrics, and Traces for Unified Observability @ Infoshare 2020
sgrodzicki
0
580
Building Distributed Systems in Distributed Teams @ Infoshare 2020
sgrodzicki
0
110
Building Distributed Systems in Distributed Teams @ 4Developers 2020
sgrodzicki
0
110
Building Distributed Systems in Distributed Teams @ DevOpsDay Warsaw 2019
sgrodzicki
0
85
Infrastructure as Code @ DevOpsDay Warsaw 2019
sgrodzicki
0
110
Other Decks in Technology
See All in Technology
社内アプリ基盤「Quartz」による、 非エンジニアとAIに本番デプロイを 任せても壊れないプラットフォームの設計
staka121
PRO
1
220
異夢同船〜異なる夢でも同じ船でなんとかする〜
fortegp05
1
590
認知の質も文化醸成も。数年取り組んで見えてきた技術広報のKPI設計 / Tech PR KPIs: Lessons on Awareness Quality and Culture After Several Years
bitkey
PRO
0
210
20261119_AgentCore
takuyay0ne
1
210
Re:ゼロから始めるシェアハウスのペットな鯖
silmin_
0
270
常時稼働エージェントの作り方(Claude公式ブログを資料化)
minorun365
PRO
19
29k
AWS re:Invent 2026 FSI Pre-Event Networking Night
junjikoide
0
170
Web Performance Is a Journey [PerfNow 2026]
tammyeverts
2
130
クラウドでも使えるNetApp -現場目線での設計とクラウドバックアップの活用
ryutakondo
1
310
エンタープライズIAMについて - ID・権限をどう統制するか
oidfj
1
300
Amazon Bedrock AgentCore の基礎とセキュリティ・ガバナンス
ren8k
0
270
Well, that’s weird…
csswizardry
1
200
Featured
See All Featured
Utilizing Notion as your number one productivity tool
mfonobong
4
650
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
540
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.4k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
470
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
20k
Thoughts on Productivity
jonyablonski
76
5.5k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1.1k
How Software Deployment tools have changed in the past 20 years
geshan
3
35k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.9k
Designing for Timeless Needs
cassininazir
1
570