SlideShare ist ein Scribd-Unternehmen logo
1 von 27
Downloaden Sie, um offline zu lesen
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!

Weitere ähnliche Inhalte

Was ist angesagt?

PHP Performance with APC + Memcached
PHP Performance with APC + MemcachedPHP Performance with APC + Memcached
PHP Performance with APC + Memcached
Ford AntiTrust
 
Boosting I/O Performance with KVM io_uring
Boosting I/O Performance with KVM io_uringBoosting I/O Performance with KVM io_uring
Boosting I/O Performance with KVM io_uring
ShapeBlue
 
ops300 Week5 storage (1)
ops300 Week5 storage (1)ops300 Week5 storage (1)
ops300 Week5 storage (1)
trayyoo
 
Monitoring MongoDB’s Engines in the Wild
Monitoring MongoDB’s Engines in the WildMonitoring MongoDB’s Engines in the Wild
Monitoring MongoDB’s Engines in the Wild
Tim Vaillancourt
 

Was ist angesagt? (19)

Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...
Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...
Scylla Summit 2018: Rebuilding the Ceph Distributed Storage Solution with Sea...
 
Ceph QoS: How to support QoS in distributed storage system - Taewoong Kim
Ceph QoS: How to support QoS in distributed storage system - Taewoong KimCeph QoS: How to support QoS in distributed storage system - Taewoong Kim
Ceph QoS: How to support QoS in distributed storage system - Taewoong Kim
 
OSv at Usenix ATC 2014
OSv at Usenix ATC 2014OSv at Usenix ATC 2014
OSv at Usenix ATC 2014
 
Apache
ApacheApache
Apache
 
GFProxy: Scaling the GlusterFS FUSE Client
GFProxy: Scaling the GlusterFS FUSE Client	GFProxy: Scaling the GlusterFS FUSE Client
GFProxy: Scaling the GlusterFS FUSE Client
 
Performance optimization 101 - Erlang Factory SF 2014
Performance optimization 101 - Erlang Factory SF 2014Performance optimization 101 - Erlang Factory SF 2014
Performance optimization 101 - Erlang Factory SF 2014
 
Magento Meetup Wrocław 6. "Docker for Mac - possible solutions to performance...
Magento Meetup Wrocław 6. "Docker for Mac - possible solutions to performance...Magento Meetup Wrocław 6. "Docker for Mac - possible solutions to performance...
Magento Meetup Wrocław 6. "Docker for Mac - possible solutions to performance...
 
PHP Performance with APC + Memcached
PHP Performance with APC + MemcachedPHP Performance with APC + Memcached
PHP Performance with APC + Memcached
 
[POSS 2019] OVirt and Ceph: Perfect Combination.?
[POSS 2019] OVirt and  Ceph: Perfect Combination.?[POSS 2019] OVirt and  Ceph: Perfect Combination.?
[POSS 2019] OVirt and Ceph: Perfect Combination.?
 
Ruby e xmpp
Ruby e xmppRuby e xmpp
Ruby e xmpp
 
GeoDistributed datacenter: the DNS way
GeoDistributed datacenter: the DNS wayGeoDistributed datacenter: the DNS way
GeoDistributed datacenter: the DNS way
 
Travel with your mock server
Travel with your mock serverTravel with your mock server
Travel with your mock server
 
Improving Development and Deployment with Docker
Improving Development and Deployment with DockerImproving Development and Deployment with Docker
Improving Development and Deployment with Docker
 
Boosting I/O Performance with KVM io_uring
Boosting I/O Performance with KVM io_uringBoosting I/O Performance with KVM io_uring
Boosting I/O Performance with KVM io_uring
 
ops300 Week5 storage (1)
ops300 Week5 storage (1)ops300 Week5 storage (1)
ops300 Week5 storage (1)
 
Monitoring MongoDB’s Engines in the Wild
Monitoring MongoDB’s Engines in the WildMonitoring MongoDB’s Engines in the Wild
Monitoring MongoDB’s Engines in the Wild
 
Frontend Track NodeJS
Frontend Track NodeJSFrontend Track NodeJS
Frontend Track NodeJS
 
HighLoad Solutions On MySQL / Xiaobin Lin (Alibaba)
HighLoad Solutions On MySQL / Xiaobin Lin (Alibaba)HighLoad Solutions On MySQL / Xiaobin Lin (Alibaba)
HighLoad Solutions On MySQL / Xiaobin Lin (Alibaba)
 
Native Clients, more the merrier with GFProxy!
Native Clients, more the merrier with GFProxy!Native Clients, more the merrier with GFProxy!
Native Clients, more the merrier with GFProxy!
 

Andere mochten auch

ჯგუფური მუშაობის შეფასების რუბრიკა.
ჯგუფური მუშაობის შეფასების რუბრიკა.ჯგუფური მუშაობის შეფასების რუბრიკა.
ჯგუფური მუშაობის შეფასების რუბრიკა.
lomadze70
 
Statement of Service at Kumho
Statement of Service at KumhoStatement of Service at Kumho
Statement of Service at Kumho
Taekil Kim
 
2015-05-07 Integrating Your AMS with Other Applications
2015-05-07 Integrating Your AMS with Other Applications2015-05-07 Integrating Your AMS with Other Applications
2015-05-07 Integrating Your AMS with Other Applications
Raffa Learning Community
 
Cafasso - August 26, 2015
Cafasso - August 26, 2015Cafasso - August 26, 2015
Cafasso - August 26, 2015
Chris Clarke
 

Andere mochten auch (20)

ჯგუფური მუშაობის შეფასების რუბრიკა.
ჯგუფური მუშაობის შეფასების რუბრიკა.ჯგუფური მუშაობის შეფასების რუბრიკა.
ჯგუფური მუშაობის შეფასების რუბრიკა.
 
Portafolio de Servicios CECoaching 2015 v4
Portafolio de Servicios CECoaching 2015 v4Portafolio de Servicios CECoaching 2015 v4
Portafolio de Servicios CECoaching 2015 v4
 
Casos para la tutoría
Casos para la tutoríaCasos para la tutoría
Casos para la tutoría
 
Statement of Service at Kumho
Statement of Service at KumhoStatement of Service at Kumho
Statement of Service at Kumho
 
El control del peso a través de la
El control del peso a través de laEl control del peso a través de la
El control del peso a través de la
 
Character profiles
Character profilesCharacter profiles
Character profiles
 
Pril1
Pril1Pril1
Pril1
 
2015-05-07 Integrating Your AMS with Other Applications
2015-05-07 Integrating Your AMS with Other Applications2015-05-07 Integrating Your AMS with Other Applications
2015-05-07 Integrating Your AMS with Other Applications
 
Competencias genericas (1)
Competencias genericas (1)Competencias genericas (1)
Competencias genericas (1)
 
Cafasso - August 26, 2015
Cafasso - August 26, 2015Cafasso - August 26, 2015
Cafasso - August 26, 2015
 
@viamultimedia: El desarrollo de una marca personal
@viamultimedia: El desarrollo de una marca personal@viamultimedia: El desarrollo de una marca personal
@viamultimedia: El desarrollo de una marca personal
 
Aportaciones de la psicomotricidad a la Fisioterapia. Ascensión Martín Díez
Aportaciones de la psicomotricidad a la Fisioterapia. Ascensión Martín DíezAportaciones de la psicomotricidad a la Fisioterapia. Ascensión Martín Díez
Aportaciones de la psicomotricidad a la Fisioterapia. Ascensión Martín Díez
 
Marco teorico
Marco teoricoMarco teorico
Marco teorico
 
Pre session-survey
Pre session-surveyPre session-survey
Pre session-survey
 
Letras2015.gal Guía de Lectura
Letras2015.gal Guía de LecturaLetras2015.gal Guía de Lectura
Letras2015.gal Guía de Lectura
 
NRI Consulting
NRI ConsultingNRI Consulting
NRI Consulting
 
Apps and Kids at Your Library
Apps and Kids at Your Library Apps and Kids at Your Library
Apps and Kids at Your Library
 
Presentacion 6 razones porque ahorros personales no incrementan
Presentacion 6 razones porque ahorros personales no incrementanPresentacion 6 razones porque ahorros personales no incrementan
Presentacion 6 razones porque ahorros personales no incrementan
 
Perspectiva del paciente. Anna Sendra
Perspectiva del paciente. Anna SendraPerspectiva del paciente. Anna Sendra
Perspectiva del paciente. Anna Sendra
 
Teoria de internet
Teoria de internetTeoria de internet
Teoria de internet
 

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

Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
Atwix
 
In-memory Caching in HDFS: Lower Latency, Same Great Taste
In-memory Caching in HDFS: Lower Latency, Same Great TasteIn-memory Caching in HDFS: Lower Latency, Same Great Taste
In-memory Caching in HDFS: Lower Latency, Same Great Taste
DataWorks Summit
 
Performance out
Performance outPerformance out
Performance out
Jack Huang
 
Performance out
Performance outPerformance out
Performance out
Jack Huang
 
Performance_Out.pptx
Performance_Out.pptxPerformance_Out.pptx
Performance_Out.pptx
sanjanabal
 

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

Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
 
OSDC 2016 - Tuning Linux for your Database by Colin Charles
OSDC 2016 - Tuning Linux for your Database by Colin CharlesOSDC 2016 - Tuning Linux for your Database by Colin Charles
OSDC 2016 - Tuning Linux for your Database by Colin Charles
 
Apache Performance Tuning: Scaling Up
Apache Performance Tuning: Scaling UpApache Performance Tuning: Scaling Up
Apache Performance Tuning: Scaling Up
 
HyperLoop: Group-Based NIC-Offloading to Accelerate Replicated Transactions i...
HyperLoop: Group-Based NIC-Offloading to Accelerate Replicated Transactions i...HyperLoop: Group-Based NIC-Offloading to Accelerate Replicated Transactions i...
HyperLoop: Group-Based NIC-Offloading to Accelerate Replicated Transactions i...
 
Running Applications on the NetBSD Rump Kernel by Justin Cormack
Running Applications on the NetBSD Rump Kernel by Justin Cormack Running Applications on the NetBSD Rump Kernel by Justin Cormack
Running Applications on the NetBSD Rump Kernel by Justin Cormack
 
Tuning the Kernel for Varnish Cache
Tuning the Kernel for Varnish CacheTuning the Kernel for Varnish Cache
Tuning the Kernel for Varnish Cache
 
Drupal performance
Drupal performanceDrupal performance
Drupal performance
 
HIgh Performance Redis- Tague Griffith, GoPro
HIgh Performance Redis- Tague Griffith, GoProHIgh Performance Redis- Tague Griffith, GoPro
HIgh Performance Redis- Tague Griffith, GoPro
 
Best And Worst Practices Deploying IBM Connections
Best And Worst Practices Deploying IBM ConnectionsBest And Worst Practices Deploying IBM Connections
Best And Worst Practices Deploying IBM Connections
 
Top ten-list
Top ten-listTop ten-list
Top ten-list
 
USE_OF_PACKET_CAPTURE.pptx
USE_OF_PACKET_CAPTURE.pptxUSE_OF_PACKET_CAPTURE.pptx
USE_OF_PACKET_CAPTURE.pptx
 
Tuning Linux for your database FLOSSUK 2016
Tuning Linux for your database FLOSSUK 2016Tuning Linux for your database FLOSSUK 2016
Tuning Linux for your database FLOSSUK 2016
 
Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcached
 
In-memory Caching in HDFS: Lower Latency, Same Great Taste
In-memory Caching in HDFS: Lower Latency, Same Great TasteIn-memory Caching in HDFS: Lower Latency, Same Great Taste
In-memory Caching in HDFS: Lower Latency, Same Great Taste
 
Linux basics (part 2)
Linux basics (part 2)Linux basics (part 2)
Linux basics (part 2)
 
Performance out
Performance outPerformance out
Performance out
 
Performance out
Performance outPerformance out
Performance out
 
Performance_Out.pptx
Performance_Out.pptxPerformance_Out.pptx
Performance_Out.pptx
 
2 7
2 72 7
2 7
 
Performance out
Performance outPerformance out
Performance out
 

Kürzlich hochgeladen

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 

Kürzlich hochgeladen (20)

Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 

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