This document summarizes techniques for scaling PHP applications. It discusses using the latest PHP version and disabling unnecessary extensions to reduce memory usage. It also covers tuning php.ini settings, using PHP accelerators like APC and OPcache, sharing session data across servers, caching with Memcache, and reverse proxying with Nginx. The presenters are Lucas Arruda and Handrus Nogueira, software architects with experience optimizing PHP applications.
2. 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.
3. 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
7. 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!
8. 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!
17. Does your app use
session data?
No: you’re good to go!
Yes: then you’ll need to
manage this data across
multiple servers.
18. 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