SlideShare a Scribd company logo
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 Related Content

PDF
Automatic Operation Bot for Ceph - You Ji
Ceph Community
 
PDF
Doing QoS Before Ceph Cluster QoS is available - David Byte, Alex Lau
Ceph Community
 
PDF
Global deduplication for Ceph - Myoungwon Oh
Ceph Community
 
PDF
Unikraft: Fast, Specialized Unikernels the Easy Way
ScyllaDB
 
PDF
OSv – The OS designed for the Cloud
Yandex
 
PPT
Ruby eventmachine pres at rubybdx
Mathieu Elie
 
PDF
RBD: What will the future bring? - Jason Dillaman
Ceph Community
 
PDF
Scaling Apache Pulsar to 10 Petabytes/Day
ScyllaDB
 
Automatic Operation Bot for Ceph - You Ji
Ceph Community
 
Doing QoS Before Ceph Cluster QoS is available - David Byte, Alex Lau
Ceph Community
 
Global deduplication for Ceph - Myoungwon Oh
Ceph Community
 
Unikraft: Fast, Specialized Unikernels the Easy Way
ScyllaDB
 
OSv – The OS designed for the Cloud
Yandex
 
Ruby eventmachine pres at rubybdx
Mathieu Elie
 
RBD: What will the future bring? - Jason Dillaman
Ceph Community
 
Scaling Apache Pulsar to 10 Petabytes/Day
ScyllaDB
 

What's hot (19)

PPTX
Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...
ScyllaDB
 
PDF
Ceph QoS: How to support QoS in distributed storage system - Taewoong Kim
Ceph Community
 
PDF
OSv at Usenix ATC 2014
Don Marti
 
PDF
GFProxy: Scaling the GlusterFS FUSE Client
Gluster.org
 
PDF
Performance optimization 101 - Erlang Factory SF 2014
lpgauth
 
PPTX
Magento Meetup Wrocław 6. "Docker for Mac - possible solutions to performance...
Magento Meetup Wrocław
 
PPTX
PHP Performance with APC + Memcached
Ford AntiTrust
 
PDF
[POSS 2019] OVirt and Ceph: Perfect Combination.?
Worteks
 
PDF
Ruby e xmpp
Willian Molinari
 
PDF
GeoDistributed datacenter: the DNS way
Moyd.co LTD
 
PDF
Travel with your mock server
Jorge Ortiz
 
PDF
Improving Development and Deployment with Docker
Irfad Razick
 
PDF
Boosting I/O Performance with KVM io_uring
ShapeBlue
 
PPTX
ops300 Week5 storage (1)
trayyoo
 
PPTX
Monitoring MongoDB’s Engines in the Wild
Tim Vaillancourt
 
PDF
Frontend Track NodeJS
Marcelo Serpa
 
PPTX
HighLoad Solutions On MySQL / Xiaobin Lin (Alibaba)
Ontico
 
PDF
Native Clients, more the merrier with GFProxy!
Gluster.org
 
Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...
ScyllaDB
 
Ceph QoS: How to support QoS in distributed storage system - Taewoong Kim
Ceph Community
 
OSv at Usenix ATC 2014
Don Marti
 
GFProxy: Scaling the GlusterFS FUSE Client
Gluster.org
 
Performance optimization 101 - Erlang Factory SF 2014
lpgauth
 
Magento Meetup Wrocław 6. "Docker for Mac - possible solutions to performance...
Magento Meetup Wrocław
 
PHP Performance with APC + Memcached
Ford AntiTrust
 
[POSS 2019] OVirt and Ceph: Perfect Combination.?
Worteks
 
Ruby e xmpp
Willian Molinari
 
GeoDistributed datacenter: the DNS way
Moyd.co LTD
 
Travel with your mock server
Jorge Ortiz
 
Improving Development and Deployment with Docker
Irfad Razick
 
Boosting I/O Performance with KVM io_uring
ShapeBlue
 
ops300 Week5 storage (1)
trayyoo
 
Monitoring MongoDB’s Engines in the Wild
Tim Vaillancourt
 
Frontend Track NodeJS
Marcelo Serpa
 
HighLoad Solutions On MySQL / Xiaobin Lin (Alibaba)
Ontico
 
Native Clients, more the merrier with GFProxy!
Gluster.org
 
Ad

Viewers also liked (20)

DOCX
ჯგუფური მუშაობის შეფასების რუბრიკა.
lomadze70
 
PDF
Portafolio de Servicios CECoaching 2015 v4
Fernando Gonzalez Villalva
 
PDF
Casos para la tutoría
Lavinia F. Cascante
 
PDF
Statement of Service at Kumho
Taekil Kim
 
PPTX
El control del peso a través de la
Lina Ospina
 
PPTX
Character profiles
batchelortyrellqb
 
PPT
Pril1
mara2101
 
PDF
2015-05-07 Integrating Your AMS with Other Applications
Raffa Learning Community
 
PDF
Competencias genericas (1)
Margarita Isabel Sena
 
PDF
Cafasso - August 26, 2015
Chris Clarke
 
PPTX
@viamultimedia: El desarrollo de una marca personal
Néstor Altuve
 
PDF
Aportaciones de la psicomotricidad a la Fisioterapia. Ascensión Martín Díez
Asociación Española de Fisioterapeutas en Salud Mental
 
DOCX
Marco teorico
pilakaterine
 
PDF
Pre session-survey
Conrad Attard
 
PDF
Letras2015.gal Guía de Lectura
Bibliotecas Municipais de A Coruña
 
PDF
NRI Consulting
Righthorizon
 
PPT
Apps and Kids at Your Library
MissHayleyMac
 
PPTX
Presentacion 6 razones porque ahorros personales no incrementan
seremprendedor
 
DOCX
Perspectiva del paciente. Anna Sendra
Asociación Española de Fisioterapeutas en Salud Mental
 
PPTX
Teoria de internet
sandra jimenez mauricio
 
ჯგუფური მუშაობის შეფასების რუბრიკა.
lomadze70
 
Portafolio de Servicios CECoaching 2015 v4
Fernando Gonzalez Villalva
 
Casos para la tutoría
Lavinia F. Cascante
 
Statement of Service at Kumho
Taekil Kim
 
El control del peso a través de la
Lina Ospina
 
Character profiles
batchelortyrellqb
 
Pril1
mara2101
 
2015-05-07 Integrating Your AMS with Other Applications
Raffa Learning Community
 
Competencias genericas (1)
Margarita Isabel Sena
 
Cafasso - August 26, 2015
Chris Clarke
 
@viamultimedia: El desarrollo de una marca personal
Néstor Altuve
 
Aportaciones de la psicomotricidad a la Fisioterapia. Ascensión Martín Díez
Asociación Española de Fisioterapeutas en Salud Mental
 
Marco teorico
pilakaterine
 
Pre session-survey
Conrad Attard
 
Letras2015.gal Guía de Lectura
Bibliotecas Municipais de A Coruña
 
NRI Consulting
Righthorizon
 
Apps and Kids at Your Library
MissHayleyMac
 
Presentacion 6 razones porque ahorros personales no incrementan
seremprendedor
 
Perspectiva del paciente. Anna Sendra
Asociación Española de Fisioterapeutas en Salud Mental
 
Teoria de internet
sandra jimenez mauricio
 
Ad

Similar to 4Developers 2015: Scaling LAMP doesn't have to suck - Sebastian Grodzicki (20)

PDF
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
Atwix
 
PDF
OSDC 2016 - Tuning Linux for your Database by Colin Charles
NETWAYS
 
PPTX
Apache Performance Tuning: Scaling Up
Sander Temme
 
PPTX
HyperLoop: Group-Based NIC-Offloading to Accelerate Replicated Transactions i...
Daehyeok Kim
 
PDF
Running Applications on the NetBSD Rump Kernel by Justin Cormack
eurobsdcon
 
PDF
Tuning the Kernel for Varnish Cache
Per Buer
 
PPTX
Drupal performance
Piyuesh Kumar
 
PDF
HIgh Performance Redis- Tague Griffith, GoPro
Redis Labs
 
PPTX
Best And Worst Practices Deploying IBM Connections
LetsConnect
 
PDF
Top ten-list
Brian DeShong
 
PPTX
USE_OF_PACKET_CAPTURE.pptx
rajaguru91
 
PDF
Tuning Linux for your database FLOSSUK 2016
Colin Charles
 
KEY
Introduction to memcached
Jurriaan Persyn
 
PPTX
In-memory Caching in HDFS: Lower Latency, Same Great Taste
DataWorks Summit
 
ODP
Linux basics (part 2)
OSU Open Source Lab
 
PPTX
Performance out
Jack Huang
 
PPTX
Performance out
Jack Huang
 
PPTX
title
michalsap
 
PPTX
Performance out
Sergey Bran
 
PPTX
Performance out
Jack Huang
 
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
Atwix
 
OSDC 2016 - Tuning Linux for your Database by Colin Charles
NETWAYS
 
Apache Performance Tuning: Scaling Up
Sander Temme
 
HyperLoop: Group-Based NIC-Offloading to Accelerate Replicated Transactions i...
Daehyeok Kim
 
Running Applications on the NetBSD Rump Kernel by Justin Cormack
eurobsdcon
 
Tuning the Kernel for Varnish Cache
Per Buer
 
Drupal performance
Piyuesh Kumar
 
HIgh Performance Redis- Tague Griffith, GoPro
Redis Labs
 
Best And Worst Practices Deploying IBM Connections
LetsConnect
 
Top ten-list
Brian DeShong
 
USE_OF_PACKET_CAPTURE.pptx
rajaguru91
 
Tuning Linux for your database FLOSSUK 2016
Colin Charles
 
Introduction to memcached
Jurriaan Persyn
 
In-memory Caching in HDFS: Lower Latency, Same Great Taste
DataWorks Summit
 
Linux basics (part 2)
OSU Open Source Lab
 
Performance out
Jack Huang
 
Performance out
Jack Huang
 
title
michalsap
 
Performance out
Sergey Bran
 
Performance out
Jack Huang
 

Recently uploaded (20)

PPTX
Explanation about Structures in C language.pptx
Veeral Rathod
 
PDF
Protecting the Digital World Cyber Securit
dnthakkar16
 
PDF
Salesforce Implementation Services Provider.pdf
VALiNTRY360
 
PDF
ChatPharo: an Open Architecture for Understanding How to Talk Live to LLMs
ESUG
 
PPTX
Visualising Data with Scatterplots in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PPTX
Role Of Python In Programing Language.pptx
jaykoshti048
 
PPT
Why Reliable Server Maintenance Service in New York is Crucial for Your Business
Sam Vohra
 
PDF
Immersive experiences: what Pharo users do!
ESUG
 
PDF
Key Features to Look for in Arizona App Development Services
Net-Craft.com
 
PDF
Bandai Playdia The Book - David Glotz
BluePanther6
 
PDF
Using licensed Data Loss Prevention (DLP) as a strategic proactive data secur...
Q-Advise
 
PPTX
slidesgo-unlocking-the-code-the-dynamic-dance-of-variables-and-constants-2024...
kr2589474
 
PDF
vAdobe Premiere Pro 2025 (v25.2.3.004) Crack Pre-Activated Latest
imang66g
 
PDF
49784907924775488180_LRN2959_Data_Pump_23ai.pdf
Abilash868456
 
PDF
Generating Union types w/ Static Analysis
K. Matthew Dupree
 
PDF
What to consider before purchasing Microsoft 365 Business Premium_PDF.pdf
Q-Advise
 
PDF
lesson-2-rules-of-netiquette.pdf.bshhsjdj
jasmenrojas249
 
PPTX
Presentation about Database and Database Administrator
abhishekchauhan86963
 
PPTX
Maximizing Revenue with Marketo Measure: A Deep Dive into Multi-Touch Attribu...
bbedford2
 
PDF
10 posting ideas for community engagement with AI prompts
Pankaj Taneja
 
Explanation about Structures in C language.pptx
Veeral Rathod
 
Protecting the Digital World Cyber Securit
dnthakkar16
 
Salesforce Implementation Services Provider.pdf
VALiNTRY360
 
ChatPharo: an Open Architecture for Understanding How to Talk Live to LLMs
ESUG
 
Visualising Data with Scatterplots in IBM SPSS Statistics.pptx
Version 1 Analytics
 
Role Of Python In Programing Language.pptx
jaykoshti048
 
Why Reliable Server Maintenance Service in New York is Crucial for Your Business
Sam Vohra
 
Immersive experiences: what Pharo users do!
ESUG
 
Key Features to Look for in Arizona App Development Services
Net-Craft.com
 
Bandai Playdia The Book - David Glotz
BluePanther6
 
Using licensed Data Loss Prevention (DLP) as a strategic proactive data secur...
Q-Advise
 
slidesgo-unlocking-the-code-the-dynamic-dance-of-variables-and-constants-2024...
kr2589474
 
vAdobe Premiere Pro 2025 (v25.2.3.004) Crack Pre-Activated Latest
imang66g
 
49784907924775488180_LRN2959_Data_Pump_23ai.pdf
Abilash868456
 
Generating Union types w/ Static Analysis
K. Matthew Dupree
 
What to consider before purchasing Microsoft 365 Business Premium_PDF.pdf
Q-Advise
 
lesson-2-rules-of-netiquette.pdf.bshhsjdj
jasmenrojas249
 
Presentation about Database and Database Administrator
abhishekchauhan86963
 
Maximizing Revenue with Marketo Measure: A Deep Dive into Multi-Touch Attribu...
bbedford2
 
10 posting ideas for community engagement with AI prompts
Pankaj Taneja
 

4Developers 2015: Scaling LAMP doesn't have to suck - Sebastian Grodzicki