SlideShare a Scribd company logo
1 of 31
Download to read offline
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
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?!
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
...
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

What's hot

Screaming Fast Wpmu
Screaming Fast WpmuScreaming Fast Wpmu
Screaming Fast Wpmu
djcp
 

What's hot (20)

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

Similar to Scaling php - Intercon php

Escalando php e drupal- performance ao infinito e além! - Drupal camp sp 2015
Escalando php e drupal- performance ao infinito e além! - Drupal camp sp 2015Escalando php e drupal- performance ao infinito e além! - Drupal camp sp 2015
Escalando php e drupal- performance ao infinito e além! - Drupal camp sp 2015
Handrus Nogueira
 
Learn PHP Lacture1
Learn PHP Lacture1Learn PHP Lacture1
Learn PHP Lacture1
ADARSH BHATT
 

Similar to Scaling php - Intercon php (20)

Escalando php e drupal- performance ao infinito e além! - DrupalCamp SP 2015
Escalando php e drupal- performance ao infinito e além! - DrupalCamp SP 2015Escalando php e drupal- performance ao infinito e além! - DrupalCamp SP 2015
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!
DrupalCamp SP 2015 -  Escalando PHP e Drupal- Performance ao infinito e além!DrupalCamp SP 2015 -  Escalando PHP e Drupal- Performance ao infinito e além!
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! - Drupal camp sp 2015Escalando php e drupal- performance ao infinito e além! - Drupal camp sp 2015
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
Escalando PHP e Drupal: performance ao infinito e além! - DrupalCamp SP 2015Escalando PHP e Drupal: performance ao infinito e além! - DrupalCamp SP 2015
Escalando PHP e Drupal: performance ao infinito e além! - DrupalCamp SP 2015
 
Wc13
Wc13Wc13
Wc13
 
PHP Conference Brasil 2013 - Virtualização e Provisionamento de Ambientes c...
PHP Conference Brasil 2013 - Virtualização e Provisionamento de Ambientes c...PHP Conference Brasil 2013 - Virtualização e Provisionamento de Ambientes c...
PHP Conference Brasil 2013 - Virtualização e Provisionamento de Ambientes c...
 
Lately in php - 2019 May 4
Lately in php - 2019 May 4Lately in php - 2019 May 4
Lately in php - 2019 May 4
 
TDC2013 - PHP - Virtualização e Provisionamento de Ambientes com Vagrant e ...
TDC2013 - PHP - Virtualização e Provisionamento de Ambientes com Vagrant e ...TDC2013 - PHP - Virtualização e Provisionamento de Ambientes com Vagrant e ...
TDC2013 - PHP - Virtualização e Provisionamento de Ambientes com Vagrant e ...
 
Drupal Day SP 2014 - Virtualize seu Ambiente e Seja Produtivo!
Drupal Day SP 2014 - Virtualize seu Ambiente e Seja Produtivo!Drupal Day SP 2014 - Virtualize seu Ambiente e Seja Produtivo!
Drupal Day SP 2014 - Virtualize seu Ambiente e Seja Produtivo!
 
Learn PHP Lacture1
Learn PHP Lacture1Learn PHP Lacture1
Learn PHP Lacture1
 
Php
PhpPhp
Php
 
Top 10 Scalability Mistakes
Top 10 Scalability MistakesTop 10 Scalability Mistakes
Top 10 Scalability Mistakes
 
QCon SP - ShortTalk - Virtualização e Provisionamento de Ambientes com Vagr...
QCon SP - ShortTalk - Virtualização e Provisionamento de Ambientes com Vagr...QCon SP - ShortTalk - Virtualização e Provisionamento de Ambientes com Vagr...
QCon SP - ShortTalk - Virtualização e Provisionamento de Ambientes com Vagr...
 
Php training in surat
Php training in suratPhp training in surat
Php training in surat
 
Apache Con 2008 Top 10 Mistakes
Apache Con 2008 Top 10 MistakesApache Con 2008 Top 10 Mistakes
Apache Con 2008 Top 10 Mistakes
 
Uvod u php - Danilo Purić i Tarik Zaimović
Uvod u php - Danilo Purić i Tarik ZaimovićUvod u php - Danilo Purić i Tarik Zaimović
Uvod u php - Danilo Purić i Tarik Zaimović
 
Php unit i
Php unit i Php unit i
Php unit i
 
Becoming A Drupal Master Builder
Becoming A Drupal Master BuilderBecoming A Drupal Master Builder
Becoming A Drupal Master Builder
 
Summer training report priyanka
Summer  training  report priyankaSummer  training  report priyanka
Summer training report priyanka
 
Frappe framework
Frappe framework Frappe framework
Frappe framework
 

More from Handrus Nogueira

Kraftwagen, porque fazer builds - Drupal camp sp 2015
Kraftwagen, porque fazer builds - Drupal camp sp 2015Kraftwagen, porque fazer builds - Drupal camp sp 2015
Kraftwagen, porque fazer builds - Drupal camp sp 2015
Handrus Nogueira
 

More from Handrus Nogueira (17)

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

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

Scaling php - Intercon php