SlideShare a Scribd company logo
1 of 29
Case: Drupal/DvG performance
PHP-FPM vs MOD_PHP
PHP-FPM vs MOD_PHP - Drupal/DVG Performance
AGENDA
● WIE ZIJN WIJ?
● HOE WERKT EEN WEBSERVER?
○ Apache
○ Nginx
● MOD_PHP - PHP-FPM
○ MOD_PHP
○ PHP-FPM
● CACHING (UITSTAP)
● BENCHMARKS
● CONCLUSIE
● WEBSCALE AANPAK
PHP-FPM vs MOD_PHP - Drupal/DVG Performance
WIE ZIJN WIJ?
● Webscale
○ Hosting sinds 2001
○ Hosting voor professionals
○ Gespecialiseerd in PHP frameworks
■ zoals Drupal
■ maar ook Symfony, Wordpress, Typo3 & Magento
○ ISO 9001 en 27001 NL datacenters
○ CISSP management
○ 100% open source
○ 300+ managed servers
○ 200+ Drupal sites
○ Webscale werkt voor:
■ Rijksoverheid, Gemeenten, Graydon, Jaguar Land Rover
○ Webscale werkt met:
■ Cipix, d-Media, Merge, ezCompany
PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
HOE WERKT EEN WEBSERVER?
● Client/Server Model
● HTTP of HTTPS(HTTP over SSL)
DRUPAL
WEBSERVER
BROWSER
CLIENT
HTTP-REQUEST
HTTP-RESPONSE
PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
HOE WERKT APACHE?
● Apache kent een tweetal modes waarin deze kan draaien:
○ PREFORK: Request per proces.
httpd
listener
:80
:443
DRUPAL
WEBSERVER
HTTPD-PROCESS
HTTPD-PROCESS
HTTPD-PROCESS
PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
HOE WERKT APACHE?
● Apache kent een tweetal modes waarin deze kan draaien:
○ WORKER: Ieder proces meerdere requests dmv threads.
httpd
listener
:80
:443
DRUPAL
WEBSERVER
HTTPD-PROCESS
THREAD
THREAD
THREAD
HTTPD-PROCESS
THREAD
THREAD
THREAD
PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
HOE WERKT NGINX?
● Asynchronous, non-blocking, event-driven connection-handling algorithm.
○ C10K challenge
○ Meerdere worker-processen (vaste waarde).
○ Iedere worker heeft een “event-loop”, welke nieuwe events registreert.
○ De worker haalt de events asynchroon uit de “event-loop” en verwerkt deze.
○ Hierdoor worden de requests non-blocking afgehandeld.
nginx
master
:80
:443
WORKER-Process 1
WORKER-Process 2
WORKER-Process 3
DRUPAL
WEBSERVER
PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
NGINX VS APACHE
PROs Nginx t.o.v. Apache:
○ Schaalt enorm ver, zelfs met lage resources.
○ CPU en memory verbruik zeer consistent.
○ Eenvoudigere inschatting benodigde resources.
○ Kan meer concurrent connecties aan dan Apache.
○ Eenvoudiger in te zetten als proxy-server.
CONs Nginx t.o.v. Apache:
○ Geen native dynamic-content processing (dus geen mod_php). *
○ Geen .htaccess ondersteuning. *
* Dit maakt de worker ook zo klein en snel.
* Ook dit is bewust, waardoor er geen “traversal” over het Filesystem nodig is.
PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
MOD_PHP vs PHP-FPM
● Mod_php alleen mogelijk bij Apache
● Apache biedt keuze uit:
○ mod_php
○ mod_fastcgi (voor het aanspreken van php-fpm)
● Nginx alleen php-fpm mogelijk
● Mod_php = embedded
● Php-fpm = daemon
PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
MOD_PHP (alleen apache)
● MOD_PHP:
httpd
listener
:80
:443
DRUPAL
WEBSERVER
HTTPD-PROCESS
HTTPD-PROCESS
HTTPD-PROCESS
mod_php
mod_php
mod_php
● PROs:
○ PHP uitgevoerd door Apache zelf.
○ Geen externe processen nodig.
○ PHP configuratie aanpasbaar via
.htaccess
● CONs:
○ Apache Memory-footprint groter.
○ PHP-interpeter voor non-PHP
content.
○ Rechten op bestanden gelijk aan
webserver. (www-data).
PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
MOD_PHP
● MOD_PHP:
PROs:
○ Eenvoudiger in beheer.
○ Voor veel sites vaak al voldoende.
○ Bij PHP-only sites is het snel.
CONs:
○ Memory-footprint.
○ Lastig met bestandrechten.
○ Restart apache nodig voor wijzigingen in php.ini.
○ Gaat slecht om met php crashes.
PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
PHP-FPM I.C.M. APACHE
● MOD_FASTCGI:
httpd
listener
:80
:443
DRUPAL
WEBSERVER
HTTPD-PROCESS
HTTPD-PROCESS
● PROs:
○ PHP-code geisoleerd van Apache.
○ Static-content niet via PHP.
○ Rechten op bestanden instelbaar.
● CONs:
○ Geen php-configuratie in .htaccess.
○ Extern process nodig.
HTTPD-PROCESS
mod_fastcgi
PHP-FPM
PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
PHP-FPM I.C.M. NGINX
nginx
master
:80
:443
WORKER-Process 1
WORKER-Process 2
DRUPAL
WEBSERVER WORKER-Process 3
● Nginx heeft zelf geen native dynamic-content processing.
● Daarom Nginx als proxy, php-requests doorzetten naar php-fpm.
PHP-FPM
PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
pool site02pool site01
PHP-FPM
● FPM - FastCGI Process Manager:
PHP-FPM: Master process
PHP-FPM-Worker:
pool site01
PHP-FPM-Worker:
pool site01
PHP-FPM-Worker:
pool site01
PHP-FPM-Worker:
pool site02
PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
PHP-FPM-Worker:
pool site02
PHP-FPM
● FPM - FastCGI Process Manager:
PROs:
○ Meerdere PHP-Workers (zelfs over meerdere servers).
○ Worker-pools met eigen uids/gids.
○ Meerdere php.ini opties.
○ Logging en slowlogging.
○ Status-interface.
○ Emergency restart.
○ Gracefull php-reload
○ Security.
CONs:
○ Complexer om te beheren
○ Niet altijd sneller dan mod_php
PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
CACHING (UITSTAP)
● Caching houdt opgevraagde resources in memory.
● Hierdoor hoeft het (trage) filesystem niet telkens aangesproken te worden.
● Verbeterde responsiveness van jouw sites.
● Betere performance op dezelfde hardware.
● PHP code hoeft niet opnieuw gecompiled te worden door de PHP-Interpreter.
● Verschillende oplossingen voor caching:
○ Browser-caching.
○ Apache-content-caching.
○ Nginx-content-caching en micro-caching.
○ Varnish.
● Caching via de (web)applicatie:
○ Memcached
○ Redis
PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
BENCHMARKS
Testopstelling:
○ KVM VM, 4GB Memory, 2 vCPU, (E5-2620v2 2.1Ghz)
○ Debian 7.8 (old-stable):
■ Apache 2.2.22
■ Nginx 1.2
■ PHP 5.4.36
■ Varnish 3.0.2
○ Debian 8.1 (stable)
■ Apache 2.4.10
■ Nginx 1.6.2
■ PHP 5.6.9
■ Varnish 4.0.2
PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
Drupal voor Gemeenten
PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
BENCHMARKS
Test 01 - ‘It Works!’:
○ Enkele html pagina met “It Works!” om baseline te bepalen.
○ Apache-mpm-prefork: ab -n10000 -c100
Wheezy Jessie
4.546 3.586
3.556 3.228
3.531 2.971
3.464 3.117
3.637 3.214
PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
BENCHMARKS
Test 01 - ‘It Works!’:
○ Enkele html pagina met “It Works!” om baseline te bepalen.
○ Nginx: ab -n10000 -c100
Wheezy Jessie
2.255 1.44
2.335 1.445
2.239 1.457
2.18 1.432
2.199 1.429
PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
BENCHMARKS
Test 01 - ‘It Works!’:
○ Enkele html pagina met “It Works!” om baseline te bepalen.
○ Varnish met Apache-backend: ab -n10000 -c100
Wheezy Jessie
2.624 1.653
2.608 1.666
2.635 1.686
2.601 1.664
2.617 1.639
PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
BENCHMARKS
Test 02 - DvG Installatie met test-data’:
○ Apache mod-php: ab -n1000 -c20
Wheezy Jessie
236.95 91.668
235.972 91.503
Dit is een extreme belasting!
Load op server werd
onbruikbaar hoog.
PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
BENCHMARKS
Test 02 - DvG Installatie met test-data’:
○ Apache php-fpm: ab -n1000 -c20
Dit is een extreme belasting!
Load op server werd
onbruikbaar hoog.
Wheezy Jessie
237.328 86.504
238.103 84.998
PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
BENCHMARKS
Test 02 - DvG Installatie met test-data’:
○ Nginx php-fpm: ab -n1000 -c20
Dit is een extreme belasting!
Load op server werd
onbruikbaar hoog.
PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
Wheezy Jessie
235.874 85.692
234.788 85.026
BENCHMARKS
Test 03 - DvG Installatie met test-data’:
○ Varnish met Nginx & php-fpm: ab -n1000 -c20
Dit is een extreme belasting!
Load op server blijft rustig.
Wheezy Jessie
2.208 2.019
2.208 2.03
PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
BENCHMARKS
Test 03 - DvG Installatie met test-data’:
○ Varnish met Nginx & php-fpm: ab -n10000 -c100
Dit is een ZEER extreme belasting!
Load op server blijft rustig.
Wheezy Jessie
21.974 19.066
22.386 18.949
PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
CONCLUSIE
Conclusie van onze benchmarks:
● Nieuwe Debian 8.1 (Jessie) biedt al flinke performance-winst
● Apache 2.4 is weer sneller dan Apache 2.2
● Nginx 1.6 is weer sneller dan Nginx 1.2
● Verschil mod-php VS php-fpm minimaal, maar FPM bied meer mogelijkheden.
● Keuze belangrijker voor Ops dan Devs.
● Voor echte winst is caching (Varnish) onmiskenbaar.
De toekomst brengt nog meer verbeteringen:
● PHP-7
● HHVM (HipHop Virtual Machine, ontwikkeld door Facebook)
● Apache-mpm-event
PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
WEBSCALE AANPAK
● Optimalisatie op meer dan alleen webservers en php:
○ Oplossingen en implementatie toegespitst op behoeften van de klant.
○ Houdt nauwlettend trends in de gaten, om pro-actief aanpassingen door te voeren.
○ Monitoring om pro- en in geval van calamiteit re-actief in te grijpen.
○ Samen met de klant in dialoog voor beste performance en availability.
○ Security staat hoog in ons vaandel.
○ Mysql-Server tuning en optimalisatie.
○ Linux kernel-tuning.
○ Verdeling resources over hypervisors, storage en datacentrum.
PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
VRAGEN BIJ DE
BORREL!
PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance

More Related Content

Viewers also liked

Dockerizing Symfony Applications - Symfony Live Berlin 2014
Dockerizing Symfony Applications - Symfony Live Berlin 2014Dockerizing Symfony Applications - Symfony Live Berlin 2014
Dockerizing Symfony Applications - Symfony Live Berlin 2014D
 
Fpm module 02 initiation and integration april 11 2013
Fpm module  02 initiation and integration april 11 2013Fpm module  02 initiation and integration april 11 2013
Fpm module 02 initiation and integration april 11 2013melvinchien
 
Word press on conoha このべん #3
Word press on conoha このべん #3Word press on conoha このべん #3
Word press on conoha このべん #3Wataru OKAMOTO
 
mod_php vs. FastCGI 原理与比较
mod_php vs. FastCGI 原理与比较mod_php vs. FastCGI 原理与比较
mod_php vs. FastCGI 原理与比较Ji ZHANG
 
Supercharging your PHP pages with mod_lsapi in CloudLinux OS
Supercharging your PHP pages with mod_lsapi in CloudLinux OSSupercharging your PHP pages with mod_lsapi in CloudLinux OS
Supercharging your PHP pages with mod_lsapi in CloudLinux OSCloudLinux
 
High performance PHP: Scaling and getting the most out of your infrastructure
High performance PHP: Scaling and getting the most out of your infrastructureHigh performance PHP: Scaling and getting the most out of your infrastructure
High performance PHP: Scaling and getting the most out of your infrastructuremkherlakian
 
PHP7実環境ベンチ2016春
PHP7実環境ベンチ2016春PHP7実環境ベンチ2016春
PHP7実環境ベンチ2016春Ryo Tomidokoro
 
第2回勉強会資料 柏木
第2回勉強会資料 柏木第2回勉強会資料 柏木
第2回勉強会資料 柏木beyond0iwamoto
 
Ultrafast WordPress Virtual Word camp2015
Ultrafast WordPress Virtual  Word camp2015 Ultrafast WordPress Virtual  Word camp2015
Ultrafast WordPress Virtual Word camp2015 Yuta Sakamoto
 
realpathキャッシュと OPcacheの面倒すぎる関係
realpathキャッシュと OPcacheの面倒すぎる関係realpathキャッシュと OPcacheの面倒すぎる関係
realpathキャッシュと OPcacheの面倒すぎる関係Yoshio Hanawa
 
PHP development with Docker
PHP development with DockerPHP development with Docker
PHP development with DockerYosh de Vos
 
php and sapi and zendengine2 and...
php and sapi and zendengine2 and...php and sapi and zendengine2 and...
php and sapi and zendengine2 and...do_aki
 
Alternative Infrastucture
Alternative InfrastuctureAlternative Infrastucture
Alternative InfrastuctureMarc Seeger
 
How to deploy PHP projects with docker
How to deploy PHP projects with dockerHow to deploy PHP projects with docker
How to deploy PHP projects with dockerRuoshi Ling
 

Viewers also liked (20)

Diploma-GCD-ContentMarketing-Personas-Week2
Diploma-GCD-ContentMarketing-Personas-Week2Diploma-GCD-ContentMarketing-Personas-Week2
Diploma-GCD-ContentMarketing-Personas-Week2
 
Dockerizing Symfony Applications - Symfony Live Berlin 2014
Dockerizing Symfony Applications - Symfony Live Berlin 2014Dockerizing Symfony Applications - Symfony Live Berlin 2014
Dockerizing Symfony Applications - Symfony Live Berlin 2014
 
Fpm module 02 initiation and integration april 11 2013
Fpm module  02 initiation and integration april 11 2013Fpm module  02 initiation and integration april 11 2013
Fpm module 02 initiation and integration april 11 2013
 
Word press on conoha このべん #3
Word press on conoha このべん #3Word press on conoha このべん #3
Word press on conoha このべん #3
 
Running php on nginx
Running php on nginxRunning php on nginx
Running php on nginx
 
From LAMP to LNNP
From LAMP to LNNPFrom LAMP to LNNP
From LAMP to LNNP
 
mod_php vs. FastCGI 原理与比较
mod_php vs. FastCGI 原理与比较mod_php vs. FastCGI 原理与比较
mod_php vs. FastCGI 原理与比较
 
Nginx + PHP
Nginx + PHPNginx + PHP
Nginx + PHP
 
Supercharging your PHP pages with mod_lsapi in CloudLinux OS
Supercharging your PHP pages with mod_lsapi in CloudLinux OSSupercharging your PHP pages with mod_lsapi in CloudLinux OS
Supercharging your PHP pages with mod_lsapi in CloudLinux OS
 
High performance PHP: Scaling and getting the most out of your infrastructure
High performance PHP: Scaling and getting the most out of your infrastructureHigh performance PHP: Scaling and getting the most out of your infrastructure
High performance PHP: Scaling and getting the most out of your infrastructure
 
PHP7実環境ベンチ2016春
PHP7実環境ベンチ2016春PHP7実環境ベンチ2016春
PHP7実環境ベンチ2016春
 
第2回勉強会資料 柏木
第2回勉強会資料 柏木第2回勉強会資料 柏木
第2回勉強会資料 柏木
 
Nginx pres
Nginx presNginx pres
Nginx pres
 
Ultrafast WordPress Virtual Word camp2015
Ultrafast WordPress Virtual  Word camp2015 Ultrafast WordPress Virtual  Word camp2015
Ultrafast WordPress Virtual Word camp2015
 
realpathキャッシュと OPcacheの面倒すぎる関係
realpathキャッシュと OPcacheの面倒すぎる関係realpathキャッシュと OPcacheの面倒すぎる関係
realpathキャッシュと OPcacheの面倒すぎる関係
 
nginxの紹介
nginxの紹介nginxの紹介
nginxの紹介
 
PHP development with Docker
PHP development with DockerPHP development with Docker
PHP development with Docker
 
php and sapi and zendengine2 and...
php and sapi and zendengine2 and...php and sapi and zendengine2 and...
php and sapi and zendengine2 and...
 
Alternative Infrastucture
Alternative InfrastuctureAlternative Infrastucture
Alternative Infrastucture
 
How to deploy PHP projects with docker
How to deploy PHP projects with dockerHow to deploy PHP projects with docker
How to deploy PHP projects with docker
 

Similar to Techtalk2015 MOD_PHP vs PHP-FPM

CFEngine Roadshow Maiden Voyage Cohesion Techsessie
CFEngine Roadshow Maiden Voyage Cohesion TechsessieCFEngine Roadshow Maiden Voyage Cohesion Techsessie
CFEngine Roadshow Maiden Voyage Cohesion TechsessieMartin Simons
 
Wido den Hollander - IPv6
Wido den Hollander - IPv6Wido den Hollander - IPv6
Wido den Hollander - IPv6Splend
 
Joomla Website optimaliseren - jug073 augustus 2018
Joomla Website optimaliseren - jug073 augustus 2018Joomla Website optimaliseren - jug073 augustus 2018
Joomla Website optimaliseren - jug073 augustus 2018Hans Kuijpers
 
Installatie apache, qgis server en lizmap web client
Installatie apache, qgis server en lizmap web clientInstallatie apache, qgis server en lizmap web client
Installatie apache, qgis server en lizmap web clientSandro Pibia
 
Linux Nijmegen - Webserver (LAMP stack) opzetten met VirtualbBox & Vagrant
Linux Nijmegen - Webserver (LAMP stack) opzetten met VirtualbBox & VagrantLinux Nijmegen - Webserver (LAMP stack) opzetten met VirtualbBox & Vagrant
Linux Nijmegen - Webserver (LAMP stack) opzetten met VirtualbBox & VagrantPeter Martin
 
Drupal Deployment demo
Drupal Deployment demoDrupal Deployment demo
Drupal Deployment demodropsolid
 
Projectpaas drupaljam 2013 rotterdam
Projectpaas drupaljam 2013 rotterdamProjectpaas drupaljam 2013 rotterdam
Projectpaas drupaljam 2013 rotterdamBert Boerland
 
Vue storefront MajorRum Get Noticed
Vue storefront MajorRum Get NoticedVue storefront MajorRum Get Noticed
Vue storefront MajorRum Get NoticedStef Geraets
 
IPv6 news-nl-20121009
IPv6 news-nl-20121009IPv6 news-nl-20121009
IPv6 news-nl-20121009Bart Hanssens
 
Neoview - Fundament Voor Datacenter Rabobank - André Van Der Griend
Neoview - Fundament Voor Datacenter Rabobank - André Van Der GriendNeoview - Fundament Voor Datacenter Rabobank - André Van Der Griend
Neoview - Fundament Voor Datacenter Rabobank - André Van Der GriendHPDutchWorld
 
Performance budget @ Joomla! Performance Expert Sessie
Performance budget @ Joomla! Performance Expert SessiePerformance budget @ Joomla! Performance Expert Sessie
Performance budget @ Joomla! Performance Expert SessieSander Potjer
 
Netwerkfunctievirtualisatie: proof-of-concept en demo
Netwerkfunctievirtualisatie: proof-of-concept en demoNetwerkfunctievirtualisatie: proof-of-concept en demo
Netwerkfunctievirtualisatie: proof-of-concept en demoSURFnet
 
03102019 ipv6 ez-company
03102019 ipv6 ez-company03102019 ipv6 ez-company
03102019 ipv6 ez-companyVNG Realisatie
 
Drupaljam2015 logstash
Drupaljam2015 logstashDrupaljam2015 logstash
Drupaljam2015 logstashWebscale
 
Starten met Infobright
Starten met InfobrightStarten met Infobright
Starten met InfobrightDaan Blinde
 
Pricewaterhouse Coopers
Pricewaterhouse CoopersPricewaterhouse Coopers
Pricewaterhouse CoopersHPDutchWorld
 

Similar to Techtalk2015 MOD_PHP vs PHP-FPM (20)

CFEngine Roadshow Maiden Voyage Cohesion Techsessie
CFEngine Roadshow Maiden Voyage Cohesion TechsessieCFEngine Roadshow Maiden Voyage Cohesion Techsessie
CFEngine Roadshow Maiden Voyage Cohesion Techsessie
 
Wido den Hollander - IPv6
Wido den Hollander - IPv6Wido den Hollander - IPv6
Wido den Hollander - IPv6
 
Joomla Website optimaliseren - jug073 augustus 2018
Joomla Website optimaliseren - jug073 augustus 2018Joomla Website optimaliseren - jug073 augustus 2018
Joomla Website optimaliseren - jug073 augustus 2018
 
Installatie apache, qgis server en lizmap web client
Installatie apache, qgis server en lizmap web clientInstallatie apache, qgis server en lizmap web client
Installatie apache, qgis server en lizmap web client
 
Netflow Performance
Netflow PerformanceNetflow Performance
Netflow Performance
 
Linux Nijmegen - Webserver (LAMP stack) opzetten met VirtualbBox & Vagrant
Linux Nijmegen - Webserver (LAMP stack) opzetten met VirtualbBox & VagrantLinux Nijmegen - Webserver (LAMP stack) opzetten met VirtualbBox & Vagrant
Linux Nijmegen - Webserver (LAMP stack) opzetten met VirtualbBox & Vagrant
 
New Relic
New RelicNew Relic
New Relic
 
Vagrant + ansible vs docker
Vagrant + ansible vs dockerVagrant + ansible vs docker
Vagrant + ansible vs docker
 
Drupal Deployment demo
Drupal Deployment demoDrupal Deployment demo
Drupal Deployment demo
 
Projectpaas drupaljam 2013 rotterdam
Projectpaas drupaljam 2013 rotterdamProjectpaas drupaljam 2013 rotterdam
Projectpaas drupaljam 2013 rotterdam
 
Vue storefront MajorRum Get Noticed
Vue storefront MajorRum Get NoticedVue storefront MajorRum Get Noticed
Vue storefront MajorRum Get Noticed
 
IPv6 news-nl-20121009
IPv6 news-nl-20121009IPv6 news-nl-20121009
IPv6 news-nl-20121009
 
Neoview - Fundament Voor Datacenter Rabobank - André Van Der Griend
Neoview - Fundament Voor Datacenter Rabobank - André Van Der GriendNeoview - Fundament Voor Datacenter Rabobank - André Van Der Griend
Neoview - Fundament Voor Datacenter Rabobank - André Van Der Griend
 
Performance budget @ Joomla! Performance Expert Sessie
Performance budget @ Joomla! Performance Expert SessiePerformance budget @ Joomla! Performance Expert Sessie
Performance budget @ Joomla! Performance Expert Sessie
 
Netwerkfunctievirtualisatie: proof-of-concept en demo
Netwerkfunctievirtualisatie: proof-of-concept en demoNetwerkfunctievirtualisatie: proof-of-concept en demo
Netwerkfunctievirtualisatie: proof-of-concept en demo
 
03102019 ipv6 ez-company
03102019 ipv6 ez-company03102019 ipv6 ez-company
03102019 ipv6 ez-company
 
Drupaljam2015 logstash
Drupaljam2015 logstashDrupaljam2015 logstash
Drupaljam2015 logstash
 
Starten met Infobright
Starten met InfobrightStarten met Infobright
Starten met Infobright
 
Windows Server2008
Windows Server2008Windows Server2008
Windows Server2008
 
Pricewaterhouse Coopers
Pricewaterhouse CoopersPricewaterhouse Coopers
Pricewaterhouse Coopers
 

Techtalk2015 MOD_PHP vs PHP-FPM

  • 2. PHP-FPM vs MOD_PHP - Drupal/DVG Performance AGENDA ● WIE ZIJN WIJ? ● HOE WERKT EEN WEBSERVER? ○ Apache ○ Nginx ● MOD_PHP - PHP-FPM ○ MOD_PHP ○ PHP-FPM ● CACHING (UITSTAP) ● BENCHMARKS ● CONCLUSIE ● WEBSCALE AANPAK PHP-FPM vs MOD_PHP - Drupal/DVG Performance
  • 3. WIE ZIJN WIJ? ● Webscale ○ Hosting sinds 2001 ○ Hosting voor professionals ○ Gespecialiseerd in PHP frameworks ■ zoals Drupal ■ maar ook Symfony, Wordpress, Typo3 & Magento ○ ISO 9001 en 27001 NL datacenters ○ CISSP management ○ 100% open source ○ 300+ managed servers ○ 200+ Drupal sites ○ Webscale werkt voor: ■ Rijksoverheid, Gemeenten, Graydon, Jaguar Land Rover ○ Webscale werkt met: ■ Cipix, d-Media, Merge, ezCompany PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
  • 4. HOE WERKT EEN WEBSERVER? ● Client/Server Model ● HTTP of HTTPS(HTTP over SSL) DRUPAL WEBSERVER BROWSER CLIENT HTTP-REQUEST HTTP-RESPONSE PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
  • 5. HOE WERKT APACHE? ● Apache kent een tweetal modes waarin deze kan draaien: ○ PREFORK: Request per proces. httpd listener :80 :443 DRUPAL WEBSERVER HTTPD-PROCESS HTTPD-PROCESS HTTPD-PROCESS PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
  • 6. HOE WERKT APACHE? ● Apache kent een tweetal modes waarin deze kan draaien: ○ WORKER: Ieder proces meerdere requests dmv threads. httpd listener :80 :443 DRUPAL WEBSERVER HTTPD-PROCESS THREAD THREAD THREAD HTTPD-PROCESS THREAD THREAD THREAD PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
  • 7. HOE WERKT NGINX? ● Asynchronous, non-blocking, event-driven connection-handling algorithm. ○ C10K challenge ○ Meerdere worker-processen (vaste waarde). ○ Iedere worker heeft een “event-loop”, welke nieuwe events registreert. ○ De worker haalt de events asynchroon uit de “event-loop” en verwerkt deze. ○ Hierdoor worden de requests non-blocking afgehandeld. nginx master :80 :443 WORKER-Process 1 WORKER-Process 2 WORKER-Process 3 DRUPAL WEBSERVER PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
  • 8. NGINX VS APACHE PROs Nginx t.o.v. Apache: ○ Schaalt enorm ver, zelfs met lage resources. ○ CPU en memory verbruik zeer consistent. ○ Eenvoudigere inschatting benodigde resources. ○ Kan meer concurrent connecties aan dan Apache. ○ Eenvoudiger in te zetten als proxy-server. CONs Nginx t.o.v. Apache: ○ Geen native dynamic-content processing (dus geen mod_php). * ○ Geen .htaccess ondersteuning. * * Dit maakt de worker ook zo klein en snel. * Ook dit is bewust, waardoor er geen “traversal” over het Filesystem nodig is. PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
  • 9. MOD_PHP vs PHP-FPM ● Mod_php alleen mogelijk bij Apache ● Apache biedt keuze uit: ○ mod_php ○ mod_fastcgi (voor het aanspreken van php-fpm) ● Nginx alleen php-fpm mogelijk ● Mod_php = embedded ● Php-fpm = daemon PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
  • 10. MOD_PHP (alleen apache) ● MOD_PHP: httpd listener :80 :443 DRUPAL WEBSERVER HTTPD-PROCESS HTTPD-PROCESS HTTPD-PROCESS mod_php mod_php mod_php ● PROs: ○ PHP uitgevoerd door Apache zelf. ○ Geen externe processen nodig. ○ PHP configuratie aanpasbaar via .htaccess ● CONs: ○ Apache Memory-footprint groter. ○ PHP-interpeter voor non-PHP content. ○ Rechten op bestanden gelijk aan webserver. (www-data). PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
  • 11. MOD_PHP ● MOD_PHP: PROs: ○ Eenvoudiger in beheer. ○ Voor veel sites vaak al voldoende. ○ Bij PHP-only sites is het snel. CONs: ○ Memory-footprint. ○ Lastig met bestandrechten. ○ Restart apache nodig voor wijzigingen in php.ini. ○ Gaat slecht om met php crashes. PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
  • 12. PHP-FPM I.C.M. APACHE ● MOD_FASTCGI: httpd listener :80 :443 DRUPAL WEBSERVER HTTPD-PROCESS HTTPD-PROCESS ● PROs: ○ PHP-code geisoleerd van Apache. ○ Static-content niet via PHP. ○ Rechten op bestanden instelbaar. ● CONs: ○ Geen php-configuratie in .htaccess. ○ Extern process nodig. HTTPD-PROCESS mod_fastcgi PHP-FPM PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
  • 13. PHP-FPM I.C.M. NGINX nginx master :80 :443 WORKER-Process 1 WORKER-Process 2 DRUPAL WEBSERVER WORKER-Process 3 ● Nginx heeft zelf geen native dynamic-content processing. ● Daarom Nginx als proxy, php-requests doorzetten naar php-fpm. PHP-FPM PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
  • 14. pool site02pool site01 PHP-FPM ● FPM - FastCGI Process Manager: PHP-FPM: Master process PHP-FPM-Worker: pool site01 PHP-FPM-Worker: pool site01 PHP-FPM-Worker: pool site01 PHP-FPM-Worker: pool site02 PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance PHP-FPM-Worker: pool site02
  • 15. PHP-FPM ● FPM - FastCGI Process Manager: PROs: ○ Meerdere PHP-Workers (zelfs over meerdere servers). ○ Worker-pools met eigen uids/gids. ○ Meerdere php.ini opties. ○ Logging en slowlogging. ○ Status-interface. ○ Emergency restart. ○ Gracefull php-reload ○ Security. CONs: ○ Complexer om te beheren ○ Niet altijd sneller dan mod_php PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
  • 16. CACHING (UITSTAP) ● Caching houdt opgevraagde resources in memory. ● Hierdoor hoeft het (trage) filesystem niet telkens aangesproken te worden. ● Verbeterde responsiveness van jouw sites. ● Betere performance op dezelfde hardware. ● PHP code hoeft niet opnieuw gecompiled te worden door de PHP-Interpreter. ● Verschillende oplossingen voor caching: ○ Browser-caching. ○ Apache-content-caching. ○ Nginx-content-caching en micro-caching. ○ Varnish. ● Caching via de (web)applicatie: ○ Memcached ○ Redis PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
  • 17. BENCHMARKS Testopstelling: ○ KVM VM, 4GB Memory, 2 vCPU, (E5-2620v2 2.1Ghz) ○ Debian 7.8 (old-stable): ■ Apache 2.2.22 ■ Nginx 1.2 ■ PHP 5.4.36 ■ Varnish 3.0.2 ○ Debian 8.1 (stable) ■ Apache 2.4.10 ■ Nginx 1.6.2 ■ PHP 5.6.9 ■ Varnish 4.0.2 PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
  • 18. Drupal voor Gemeenten PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
  • 19. BENCHMARKS Test 01 - ‘It Works!’: ○ Enkele html pagina met “It Works!” om baseline te bepalen. ○ Apache-mpm-prefork: ab -n10000 -c100 Wheezy Jessie 4.546 3.586 3.556 3.228 3.531 2.971 3.464 3.117 3.637 3.214 PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
  • 20. BENCHMARKS Test 01 - ‘It Works!’: ○ Enkele html pagina met “It Works!” om baseline te bepalen. ○ Nginx: ab -n10000 -c100 Wheezy Jessie 2.255 1.44 2.335 1.445 2.239 1.457 2.18 1.432 2.199 1.429 PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
  • 21. BENCHMARKS Test 01 - ‘It Works!’: ○ Enkele html pagina met “It Works!” om baseline te bepalen. ○ Varnish met Apache-backend: ab -n10000 -c100 Wheezy Jessie 2.624 1.653 2.608 1.666 2.635 1.686 2.601 1.664 2.617 1.639 PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
  • 22. BENCHMARKS Test 02 - DvG Installatie met test-data’: ○ Apache mod-php: ab -n1000 -c20 Wheezy Jessie 236.95 91.668 235.972 91.503 Dit is een extreme belasting! Load op server werd onbruikbaar hoog. PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
  • 23. BENCHMARKS Test 02 - DvG Installatie met test-data’: ○ Apache php-fpm: ab -n1000 -c20 Dit is een extreme belasting! Load op server werd onbruikbaar hoog. Wheezy Jessie 237.328 86.504 238.103 84.998 PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
  • 24. BENCHMARKS Test 02 - DvG Installatie met test-data’: ○ Nginx php-fpm: ab -n1000 -c20 Dit is een extreme belasting! Load op server werd onbruikbaar hoog. PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance Wheezy Jessie 235.874 85.692 234.788 85.026
  • 25. BENCHMARKS Test 03 - DvG Installatie met test-data’: ○ Varnish met Nginx & php-fpm: ab -n1000 -c20 Dit is een extreme belasting! Load op server blijft rustig. Wheezy Jessie 2.208 2.019 2.208 2.03 PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
  • 26. BENCHMARKS Test 03 - DvG Installatie met test-data’: ○ Varnish met Nginx & php-fpm: ab -n10000 -c100 Dit is een ZEER extreme belasting! Load op server blijft rustig. Wheezy Jessie 21.974 19.066 22.386 18.949 PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
  • 27. CONCLUSIE Conclusie van onze benchmarks: ● Nieuwe Debian 8.1 (Jessie) biedt al flinke performance-winst ● Apache 2.4 is weer sneller dan Apache 2.2 ● Nginx 1.6 is weer sneller dan Nginx 1.2 ● Verschil mod-php VS php-fpm minimaal, maar FPM bied meer mogelijkheden. ● Keuze belangrijker voor Ops dan Devs. ● Voor echte winst is caching (Varnish) onmiskenbaar. De toekomst brengt nog meer verbeteringen: ● PHP-7 ● HHVM (HipHop Virtual Machine, ontwikkeld door Facebook) ● Apache-mpm-event PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
  • 28. WEBSCALE AANPAK ● Optimalisatie op meer dan alleen webservers en php: ○ Oplossingen en implementatie toegespitst op behoeften van de klant. ○ Houdt nauwlettend trends in de gaten, om pro-actief aanpassingen door te voeren. ○ Monitoring om pro- en in geval van calamiteit re-actief in te grijpen. ○ Samen met de klant in dialoog voor beste performance en availability. ○ Security staat hoog in ons vaandel. ○ Mysql-Server tuning en optimalisatie. ○ Linux kernel-tuning. ○ Verdeling resources over hypervisors, storage en datacentrum. PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance
  • 29. VRAGEN BIJ DE BORREL! PHP-FPM vs MOD_PHP - Drupal/DVG PerformancePHP-FPM vs MOD_PHP - Drupal/DVG Performance