SlideShare a Scribd company logo
Scaling PHP
Lucas Arruda
lucas@ciandt.com
@lunascarruda
Handrus Nogueira
handrus@taller.net.br
@handrus
Lucas Arruda
Software Architect @ CI&T
Open-Source enthusiast
~10 yrs on the road
Based on Campinas-SP
Zend Certified Engineer PHP 5.3
Drupaler for 4 yrs
Google Cloud Platform Qualified Dev.
Handrus
Software Architect / Dev @ Taller
Open-Source and Agile
~10 yrs on the road
Based on Bauru-SP/Florianópolis-SC
Drupaler for 3 yrs
The Basics
Use the latest PHP stable version
Use the latest PHP stable version
Disable unnecessary PHP extensions and web-server modules
● PHP extensions consume memory heap
● Some badly written can cause memory leaks
● The same applies for web-server modules
● Disable if you don’t need them!
Fine tune your php.ini!
● memory_limit
memory_get_usage() / memory_get_peak_usage()
● realpath_cache_size
realpath_cache_get()
● realpath_cache_ttl
Max execution per thread - will affect memory usage!
mod_php
vs.
FastCGI
vs.
PHP-FPM
ob_flush()
flush()
?
PHP ACCELERATORS
Alternative PHP Cache (APC)
Zend OPcache
XCache
apc.shm_size
apc.ttl
apc.num_files_hint
apc.gc_ttl
apc.max_file_size
apc.stat
APC OPcache
opcache.revalidate_freq
opcache.validate_timestamps
opcache.max_accelerated_files
opcache.memory_consumption
opcache.interned_strings_buffer
opcache.fast_shutdown
XCache
xcache.size
xcache.count
xcache.slots
xcache.ttl
xcache.gc_interval
xcache.cacher
xcache.stat
xcache.var_size
xcache.var_count
xcache.var_slots
xcache.var_ttl
xcache.var_maxttl
xcache.var_gc_interval
Scaling php - Intercon php
Zephir
Scaling PHP
Horizontally
Does your app use
session data?
No: you’re good to go!
Yes: then you’ll need to
manage this data across
multiple servers.
Sharing session data
Fault tolerant
No bottleneck
Cheaper
buut… it needs architecure changes!
Persistent load balancing
Sharing session data
PHP Session
Management
Persistent load balacing
Single point of failure
Bottleneck
Expensive
Options
Shared file-system
Database
Memcache / Redis
session.name
session.save_handler
session.save_path
Sharing
session data
Handlers
files
user
memcache
Avoid database specific
queries.
Good libraries can help
(Doctrine FTW!)
If not possible
Document like any
Technical Debt!
And choose well
your database!!
● MySQL
● MariaDB
● PerconaDB
Version?!
Scaling php - Intercon php
How dependent of your actual
environment are you?
timezonepaths connection string
limits
timeouts
Number of triesAPI Keys
Caching Mechanisms
APC
for caching user data
Memcache
for key/value storage (URI/HTML?)
tmpfs/ramfs
for all file-based caching
Reverse proxying
Nginx Varnish
Scaling php - Intercon php
...
Q&A
ciandt.com
Presentation Deck
http://goo.gl/0cV1KT
THANKS
FOR
BEING
HERE!
Please evaluate this presentation!
http://goo.gl/P8ZDfc
(3 questions only)
@lunascarruda
lunascar@gmail.com
google.com/+LucasArruda
fb.com/lucasnarruda
linkedin.com/in/larruda
github.com/larruda
coderbits.com/larruda
@handrus
handrus@gmail.com
google.com/+HandrusNogueira
fb.com/handrus
linkedin.com/in/handrus
github.com/handrus
coderbits.com/handrus

More Related Content

PDF
mod_php vs FastCGI vs FPM vs CLI
PDF
Current status of PSR - Phpblt1
PDF
A look at FastCgi & Mod_PHP architecture
PDF
Daniel Sloof: Magento on HHVM
PDF
Introducción a Nginx y PHP FPM
PPTX
Magento on HHVM. Daniel Sloof
PDF
InterConPHP 2014 - Scaling PHP
mod_php vs FastCGI vs FPM vs CLI
Current status of PSR - Phpblt1
A look at FastCgi & Mod_PHP architecture
Daniel Sloof: Magento on HHVM
Introducción a Nginx y PHP FPM
Magento on HHVM. Daniel Sloof
InterConPHP 2014 - Scaling PHP

What's hot (20)

PDF
Hhvm and wordpress
KEY
Re-imaginging CakePHP
KEY
SydPHP March 2012 Meetup
PDF
Calling java from a bash script 5
PPTX
Подталкиваем PHP к пределу возможностей, Michael Armstrong (lite speed techno...
PDF
Essential debugging php debugging techniques, tips & tricks
PDF
Design a scalable site: Problem and solutions
PDF
Screaming Fast Wpmu
PPTX
Open-Source Analytics Stack on MongoDB, with Schema, Pierre-Alain Jachiet and...
PDF
FuelPHP presentation - PeoplePerHour workshop
ODP
Wt vs phalcon
PDF
Professional PHP: an open-source alternative for enterprise development [Kort...
PPTX
PDF
pacproxy - Ruby hiroba 2014
PPSX
Setting advanced PHP development environment
PDF
PRPL Pattern with Webpack and React
PDF
Ways to generate PDF from Python Web applications, Gaël Le Mignot
PDF
The Power Of Refactoring (PHPNW)
PDF
PHP 5.4 - Begin your love affair with traits
PDF
The Power of Refactoring
Hhvm and wordpress
Re-imaginging CakePHP
SydPHP March 2012 Meetup
Calling java from a bash script 5
Подталкиваем PHP к пределу возможностей, Michael Armstrong (lite speed techno...
Essential debugging php debugging techniques, tips & tricks
Design a scalable site: Problem and solutions
Screaming Fast Wpmu
Open-Source Analytics Stack on MongoDB, with Schema, Pierre-Alain Jachiet and...
FuelPHP presentation - PeoplePerHour workshop
Wt vs phalcon
Professional PHP: an open-source alternative for enterprise development [Kort...
pacproxy - Ruby hiroba 2014
Setting advanced PHP development environment
PRPL Pattern with Webpack and React
Ways to generate PDF from Python Web applications, Gaël Le Mignot
The Power Of Refactoring (PHPNW)
PHP 5.4 - Begin your love affair with traits
The Power of Refactoring
Ad

Similar to Scaling php - Intercon php (20)

PDF
Escalando PHP e Drupal: performance ao infinito e além! - DrupalCamp SP 2015
PDF
DrupalCamp SP 2015 - Escalando PHP e Drupal- Performance ao infinito e além!
PDF
Escalando php e drupal- performance ao infinito e além! - Drupal camp sp 2015
PDF
Escalando php e drupal- performance ao infinito e além! - DrupalCamp SP 2015
PDF
php & performance
PDF
PHP & Performance
PDF
Scaling PHP web apps
PDF
Scale Apache with Nginx
PPT
Scalable Apache for Beginners
PDF
Scaling with Symfony - PHP UK
PDF
2013 - Dustin whittle - Escalando PHP en la vida real
PDF
Scaling LAMP doesn't have to suck
PPT
Performance and Scalability
PDF
PHP 7 OPCache extension review
PDF
Steve Corona: Scaling LAMP doesn't have to suck
PPT
Lamp Stack Optimization
PDF
Optimizing LAMPhp Applications
PPTX
PHP Performance: Principles and tools
PDF
Dutch php conference_2010_opm
PDF
High performance PHP8 at Scale - PhpersSummit 2023
Escalando PHP e Drupal: performance ao infinito e além! - DrupalCamp SP 2015
DrupalCamp SP 2015 - Escalando PHP e Drupal- Performance ao infinito e além!
Escalando php e drupal- performance ao infinito e além! - Drupal camp sp 2015
Escalando php e drupal- performance ao infinito e além! - DrupalCamp SP 2015
php & performance
PHP & Performance
Scaling PHP web apps
Scale Apache with Nginx
Scalable Apache for Beginners
Scaling with Symfony - PHP UK
2013 - Dustin whittle - Escalando PHP en la vida real
Scaling LAMP doesn't have to suck
Performance and Scalability
PHP 7 OPCache extension review
Steve Corona: Scaling LAMP doesn't have to suck
Lamp Stack Optimization
Optimizing LAMPhp Applications
PHP Performance: Principles and tools
Dutch php conference_2010_opm
High performance PHP8 at Scale - PhpersSummit 2023
Ad

More from Handrus Nogueira (17)

PDF
Vendendo a filosofia open-source (e drupal!) - DrupalCamp SP 2015
PDF
Kraftwagen - DrupalCamp SP 2015
PDF
Selling the open-source philosophy - DrupalCon Bogotá 2015
PDF
Vendendo a filosofia open-source (e drupal!) - Drupal camp sp 2015
PDF
Kraftwagen, porque fazer builds - Drupal camp sp 2015
PDF
Selling the open-source philosophy - DrupalCon Latin America 2015
PDF
Testes, por que se importar com eles? Spin Campinas 2013
PDF
Introduction to Drupal - drupal trainning day
PDF
Empregado like a boss
PDF
MEAN e Drupal - Drupal day 2014
PDF
Como nutrir uma cultura de grandes desenvolvedores com Lean e Gamification! -...
PDF
Testes de Performance - Drupal camp Florianópolis
PDF
Como nutrir uma cultura de grandes desenvolvedores com Lean e Gamification! -...
PDF
Contribuindo com a comunidade drupal
PDF
What isdrupal
PPTX
Cópia de what isdrupal
PDF
Dev camp2014
Vendendo a filosofia open-source (e drupal!) - DrupalCamp SP 2015
Kraftwagen - DrupalCamp SP 2015
Selling the open-source philosophy - DrupalCon Bogotá 2015
Vendendo a filosofia open-source (e drupal!) - Drupal camp sp 2015
Kraftwagen, porque fazer builds - Drupal camp sp 2015
Selling the open-source philosophy - DrupalCon Latin America 2015
Testes, por que se importar com eles? Spin Campinas 2013
Introduction to Drupal - drupal trainning day
Empregado like a boss
MEAN e Drupal - Drupal day 2014
Como nutrir uma cultura de grandes desenvolvedores com Lean e Gamification! -...
Testes de Performance - Drupal camp Florianópolis
Como nutrir uma cultura de grandes desenvolvedores com Lean e Gamification! -...
Contribuindo com a comunidade drupal
What isdrupal
Cópia de what isdrupal
Dev camp2014

Recently uploaded (20)

PPTX
MYSQL Presentation for SQL database connectivity
PPTX
A Presentation on Artificial Intelligence
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Cloud computing and distributed systems.
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Encapsulation theory and applications.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Machine learning based COVID-19 study performance prediction
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
KodekX | Application Modernization Development
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Modernizing your data center with Dell and AMD
MYSQL Presentation for SQL database connectivity
A Presentation on Artificial Intelligence
The Rise and Fall of 3GPP – Time for a Sabbatical?
Cloud computing and distributed systems.
Unlocking AI with Model Context Protocol (MCP)
Reach Out and Touch Someone: Haptics and Empathic Computing
Encapsulation theory and applications.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Understanding_Digital_Forensics_Presentation.pptx
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Chapter 3 Spatial Domain Image Processing.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Machine learning based COVID-19 study performance prediction
The AUB Centre for AI in Media Proposal.docx
KodekX | Application Modernization Development
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Encapsulation_ Review paper, used for researhc scholars
Modernizing your data center with Dell and AMD

Scaling php - Intercon php