SlideShare a Scribd company logo
1 of 50
Download to read offline
1 #Dynatrace
Proper	
  configura-on	
  for	
  high	
  performance	
  websites	
  
Harald	
  Zeitlhofer	
  
February	
  2015	
  
	
  
Boost	
  your	
  website	
  by	
  running	
  
PHP	
  on	
  Nginx	
  
@HZeitlhofer	
  
harald.zeitlhofer@dynatrace.com	
  
	
  
2 #Dynatrace
Nginx	
  
3 #Dynatrace
• Lightweight	
  HTTP	
  server	
  
• Fast	
  especially	
  at	
  high	
  load	
  
• Open	
  Source	
  project	
  (BSD)	
  	
  
by	
  Igor	
  Sysoev	
  
• Nginx,	
  Inc.	
  founded	
  in	
  2011	
  
• Nginx+:	
  enhanced	
  func-onality	
  
and	
  enterprise	
  support	
  
•  Load	
  balancer	
  
•  Media	
  server	
  
4 #Dynatrace
Leading	
  among	
  	
  
top	
  10.000	
  websites	
  
5 #Dynatrace
Nginx	
  vs	
  Apache	
  
6 #Dynatrace
Request	
  handling	
  
7 #Dynatrace
• mod_php	
  
• mod_fcgid	
  
• mod_fastcgi	
  
	
  
Integra-on	
  
• ngx_h+p_fastcgi_modul	
  
8 #Dynatrace
PHP	
  
FastCGI	
  Process	
  Manager	
  
9 #Dynatrace
• Apache	
  Module	
  
•  used	
  for	
  most	
  PHP	
  environments	
  
• CGI	
  
•  Command	
  Line	
  Interface	
  (CLI)	
  
• FastCGI	
  (PHP-­‐FPM)	
  
•  Available	
  since	
  5.3.3,	
  stable	
  since	
  5.4.1	
  
•  Run	
  mul-ple	
  PHP	
  worker	
  processes	
  to	
  serve	
  CGI	
  requests	
  
•  Mul-ple	
  connec-on	
  pools	
  (different	
  uid/gid	
  environments	
  possible)	
  
•  Isola-on	
  from	
  webserver	
  (fastcgi_finish_request)	
  
PHP	
  run	
  modes	
  
10 #Dynatrace
• Installa-on	
  
	
  
• Pool	
  configura-on	
  
/etc/php5/fpm/pool.d/www.conf
PHP-­‐FPM	
  
[www]
user = www-data
group = www-data
listen = 127.0.0.1:9000 # for Unix socket: unix:/var/run/php5-fpm.sock;
root@hzvm01:/etc/nginx/sites-enabled# ps -ef | grep php
root 6435 1 0 14:39 ? 00:00:32 php-fpm: master process (/etc/php5/fpm/php-fpm.conf)
spelix 6439 6435 0 14:39 ? 00:00:00 php-fpm: pool batch
spelix 6440 6435 0 14:39 ? 00:00:00 php-fpm: pool batch
www-data 10576 6435 1 18:45 ? 00:00:48 php-fpm: pool www
www-data 10920 6435 1 18:47 ? 00:00:47 php-fpm: pool www
www-data 10927 6435 1 18:47 ? 00:00:46 php-fpm: pool www
sudo apt-get install php5-fpm
11 #Dynatrace
• Pool	
  configura-on	
  
/etc/php5/fpm/pool.d/www.conf
PHP-­‐FPM	
  
[pool_name]
...
pm = [dynamic/static]
pm.max_children = 10
;only used for dynamic:
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.max_children
	
  
	
   	
  =	
  total	
  available	
  memory	
  /	
  memory	
  used	
  by	
  1	
  PHP	
  process	
  
12 #Dynatrace
Nginx	
  and	
  PHP-­‐FPM	
  
Integra-on	
  
13 #Dynatrace
• /etc/nginx/nginx.conf	
  
	
  
	
  
# max_clients = worker_processes * worker_connections
worker_processes 8; # number of CPUs
worker_rlimit_nofile 40000;
events {
worker_connections 1024;
multi_accept on;
}
14 #Dynatrace
• Communica-on	
  via	
  sockets	
  
•  TCP	
  vs	
  Unix	
  
•  Unix	
  slightly	
  faster	
  when	
  used	
  on	
  localhost	
  
•  Use	
  TCP	
  for	
  high	
  load	
  
location ~* .php$ {
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
fastcgi_pass unix:/var/run/php5-fpm.sock;
15 #Dynatrace
Nginx	
  –	
  PHP	
  transac-on	
  flow	
  
16 #Dynatrace
•  Sta-c	
  content	
  to	
  be	
  served	
  by	
  Nginx	
  
•  Dynamic	
  requests	
  to	
  be	
  sent	
  to	
  PHP-­‐FPM	
  
Integra-on	
  
server {
listen 80;
root /var/www/test;
index index.php index.html index.htm;
server_name test.whateveryourdomain.is;
location ~ .(html|js|css|gif|jpg|jpe|jpeg|png|bmp|tif|pdf|ico)$ {
try_files $uri @notfound;
}
location / {
try_files $uri $uri/ =404;
}
location ~* .php$ {
fastcgi_index index.php;
fastcgi_pass php;
include fastcgi_params;
}
}
17 #Dynatrace
hdp://www.mysite.com/news/browse/2014	
  
è	
  to	
  be	
  handled	
  by	
  index.php	
  
URL	
  rewrite	
  
...
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php
...
18 #Dynatrace
hdp://www.mysite.com/news/browse/2014	
  
è	
  to	
  be	
  handled	
  by	
  index.php	
  
URL	
  rewrite	
  
upstream php {
server unix:/var/run/php5-fpm.sock;
}
server {
listen 80;
root /var/www;
index index.php index.html index.htm;
server_name www.mysite.com;
location / {
try_files $uri $uri/ @missing;
}
location @missing {
rewrite (.*) /index.php;
}
location ~ .php$ {
fastcgi_index index.php;
include fastcgi_params;
fastcgi_pass php;
}
}
19 #Dynatrace
using	
  Nginx/PHP-­‐FPM	
  there’s	
  a	
  beder	
  way:	
  
URL	
  rewrite	
  
upstream php {
server unix:/var/run/php5-fpm.sock;
}
server {
listen 80;
root /var/www;
index index.php index.html index.htm;
server_name www.mysite.com;
location /images {
try_files $uri $uri/ =404;
}
location /scripts {
try_files $uri $uri/ =404;
}
location / {
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /var/www/index.php;
fastcgi_pass php;
}
}
<?php
$params = explode('/', trim($_SERVER["DOCUMENT_URI"],'/'));
...
20 #Dynatrace
• Easy	
  way	
  to	
  deploy	
  your	
  applica-on	
  
• All	
  source	
  files	
  packed	
  into	
  one	
  *.phar	
  file	
  
PHAR	
  –	
  PHP	
  Archives	
  
location ~* .(php|phar)$ {
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/myapp.phar;
}
21 #Dynatrace
PHAR	
  example	
  
root@hzvm01:/var/www/app/src# ls -lrtR
.:
total 8
drwxrwxr-x 2 root root 4096 Oct 10 16:27 lib
-rw-r--r-- 1 root root 27 Oct 10 16:27 index.php
./lib:
total 4
-rw-r--r-- 1 root root 87 Oct 10 16:27 App.php
root@hzvm01:/var/www/app/src# cat index.php
<?php
$app = new App();
?>
root@hzvm01:/var/www/app/src# cat lib/App.php
<?php
class App {
function __construct() {
echo "Starting Applicationn";
}
}
22 #Dynatrace
PHAR	
  example	
  
location /myapp {
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/myapp.phar;
}
root@hzvm01:/var/www/app# phar pack -f myapp.phar src
lib/App.php
index.php
root@hzvm01:/var/www/app# l myapp.phar
-rw-r--r-- 1 root root 6923 Oct 10 19:51 myapp.phar
23 #Dynatrace
PHAR	
  execu-on	
  
24 #Dynatrace
Performance	
  
25 #Dynatrace
• Nginx	
  running	
  with	
  default	
  sehngs	
  
• Apache	
  
•  AllowOverride	
  None	
  
•  Mul--­‐process	
  mode	
  to	
  allow	
  usage	
  of	
  mod_php	
  
Benchmarking	
  Nginx	
  vs	
  Apache	
  
26 #Dynatrace
Sta-c	
  HTML,	
  10k	
  requests	
  
0	
  
1	
  
2	
  
3	
  
4	
  
5	
  
6	
  
7	
  
8	
  
9	
  
100	
   500	
   1000	
   2000	
  
Apache/2.4.9	
  
nginx/1.1.19	
  
concurrency	
  
Total	
  response	
  -me	
  [sec]	
  
27 #Dynatrace
Nginx	
  and	
  Caching	
  
28 #Dynatrace
• Part	
  of	
  the	
  Nginx	
  FastCGI	
  module	
  
Nginx	
  FastCGI	
  cache	
  
fastcgi_cache_path /etc/nginx/cache levels=1:2 keys_zone=APPKEY:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
location ~* .php$ {
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_cache APPKEY;
fastcgi_cache_valid 200 60m;
}
29 #Dynatrace
Tes-ng	
  FastCGI	
  cache	
  
30 #Dynatrace
Tes-ng	
  FastCGI	
  cache	
  
31 #Dynatrace
Tes-ng	
  FastCGI	
  cache	
  
<?php
echo time()."n";
?>
32 #Dynatrace
• ngx_hdp_memcached_module	
  
Full	
  page	
  cache	
  with	
  Nginx	
  and	
  Memcached	
  
server {
location / {
set $memcached_key "$uri";
memcached_pass localhost:11211;
error_page 404 502 504 = @fallback;
}
location @fallback {
proxy_pass http://backend;
}
}
33 #Dynatrace
• PHP	
  	
  
Full	
  page	
  cache	
  with	
  Nginx	
  and	
  Memcached	
  
<?php
...
function cachePage($content) {
$c = new Memcached();
$c->addServer('localhost',11211);
$c->set($_SERVER[”REQUEST_URI"], $content);
}
...
$content = $this->renderPage();
$this->cachePage($content);
...
?>
34 #Dynatrace
PHP,	
  5k	
  requests,	
  concurrency	
  100	
  
0	
  
1	
  
2	
  
3	
  
4	
  
5	
  
6	
  
7	
  
8	
  
Apache+PHP	
   Nginx+PHP	
   Nginx+Memcached	
  
<?php
echo “Hello World”;
?>
35 #Dynatrace
Server Software: Apache/2.4.7
Server Hostname: test.hzvm01
Server Port: 88
Document Path: /index.php
Document Length: 10 bytes
Concurrency Level: 100
Time taken for tests: 7.296 seconds
Complete requests: 5000
Failed requests: 0
Total transferred: 985000 bytes
HTML transferred: 50000 bytes
Requests per second: 685.31 [#/sec] (mean)
Time per request: 145.920 [ms] (mean)
Time per request: 1.459 [ms] (mean, across all concurrent requests)
Transfer rate: 131.84 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 6 6.5 4 56
Processing: 30 138 57.2 120 938
Waiting: 30 135 56.4 117 937
Total: 55 144 55.8 126 938
PHP,	
  5k	
  requests,	
  concurrency	
  100	
  
36 #Dynatrace
Server Software: Nginx + PHP
Server Hostname: test.hzvm01
Server Port: 80
Document Path: /index.php
Document Length: 10 bytes
Concurrency Level: 100
Time taken for tests: 4.514 seconds
Complete requests: 5000
Failed requests: 0
Total transferred: 625000 bytes
HTML transferred: 50000 bytes
Requests per second: 1107.62 [#/sec] (mean)
Time per request: 90.284 [ms] (mean)
Time per request: 0.903 [ms] (mean, across all concurrent requests)
Transfer rate: 135.21 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 2 3.2 1 38
Processing: 22 88 13.1 87 148
Waiting: 21 87 13.1 86 148
Total: 42 89 12.5 88 148
PHP,	
  5k	
  requests,	
  concurrency	
  100	
  
37 #Dynatrace
Server Software: Nginx + Memcached
Server Hostname: test.hzvm01
Server Port: 82
Document Path: /index.php
Document Length: 23 bytes
Concurrency Level: 100
Time taken for tests: 3.058 seconds
Complete requests: 5000
Failed requests: 0
Total transferred: 865000 bytes
HTML transferred: 115000 bytes
Requests per second: 1634.92 [#/sec] (mean)
Time per request: 61.165 [ms] (mean)
Time per request: 0.612 [ms] (mean, across all concurrent requests)
Transfer rate: 276.21 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 7 24 6.0 24 59
Processing: 8 36 7.8 36 75
Waiting: 6 28 7.4 29 69
Total: 32 60 9.3 60 101
PHP,	
  5k	
  requests,	
  concurrency	
  100	
  
38 #Dynatrace
• set	
  HTTP	
  response	
  expires	
  header	
  
Client	
  Side	
  Caching	
  
location ~ .(html|js|css|gif|jpg|jpe|jpeg|png|bmp|tif|pdf|ico)$ {
expires 90d;
access_log off;
error_log off;
try_files $uri =404;
}
39 #Dynatrace
• keep	
  handlers	
  for	
  requested	
  sta-c	
  files	
  open	
  
Filehandle	
  Caching	
  
open_file_cache max=1000 inactive=5m;
open_file_cache_valid 60s;
open_file_cache_min_uses 5;
open_file_cache_errors off;
40 #Dynatrace
•  ngx_hdp_upstream_module	
  
Load	
  balancing	
  PHP	
  
upstream php_loadbalancer {
ip_hash;
server unix:/var/run/php5-fpm.sock weight=5;
server 192.168.56.12:7777 weight=2;
server 192.168.56.13:7777;
}
server {
listen 80;
root /home/www/test;
server_name test.hzvm01;
location / {
try_files $uri =405;
}
location ~ .php$ {
fastcgi_pass php_loadbalancer;
fastcgi_index index.php;
include fastcgi_params;
}
}
41 #Dynatrace
Load	
  balancing	
  PHP	
  
42 #Dynatrace
Load	
  balancing	
  /	
  Reverse	
  Proxy	
  
upstream backend {
ip_hash;
server 192.168.56.11 weight=5;
server 192.168.56.12 weight=2;
server 192.168.56.13;
}
server {
listen 80;
root /var/www/mysite.com/html;
server_name www.mysite.com;
location / {
try_files $uri =405;
proxy_pass http://backend;
}
}
43 #Dynatrace
Reverse	
  Proxy	
  /	
  Load	
  balancing	
  /	
  Caching	
  
proxy_cache_path /etc/nginx/cache keys_zone=APPKEY:10m;
proxy_cache_key "$host$request_uri$cookie_user";
proxy_cache_min_uses 5;
proxy_cache_methods GET HEAD;
proxy_cache_valid 200 302 10m;
proxy_cache_valid 404 1m;
upstream backend {
ip_hash;
server 192.168.56.11 weight=5;
server 192.168.56.12 weight=2;
server 192.168.56.13;
}
server {
listen 80;
root /var/www/mysite.com/html;
server_name www.mysite.com;
proxy_cache APPKEY;
location / {
proxy_pass http://backend;
}
}
44 #Dynatrace
Performance	
  Monitoring	
  
45 #Dynatrace
End-­‐To-­‐End	
  Monitoring	
  
46 #Dynatrace
User	
  Experience	
  Management	
  
47 #Dynatrace
48 #Dynatrace
49 #Dynatrace
• Load	
  Generator	
  (Apache	
  Benchmark,	
  JMeter)	
  
• Firebug,	
  Google	
  Developer	
  Tools	
  
Dynatrace	
  Ajax	
  Edi-on	
  
• Google	
  PageSpeed	
  
• Dynatrace	
  Free	
  Trial	
  
•  Free	
  trial	
  license	
  for	
  30	
  days	
  
•  Free	
  for	
  developers	
  on	
  local	
  machine	
  
Tools	
  
hdp://bit.ly/ddrial	
  
50 #Dynatrace
Thank You
harald.zeitlhofer@dynatrace.com	
  
@HZeitlhofer	
  
	
  
www.dynatrace.com	
  

More Related Content

What's hot

Stupid Boot Tricks: using ipxe and chef to get to boot management bliss
Stupid Boot Tricks: using ipxe and chef to get to boot management blissStupid Boot Tricks: using ipxe and chef to get to boot management bliss
Stupid Boot Tricks: using ipxe and chef to get to boot management blissmacslide
 
Caching with Memcached and APC
Caching with Memcached and APCCaching with Memcached and APC
Caching with Memcached and APCBen Ramsey
 
Rails Caching Secrets from the Edge
Rails Caching Secrets from the EdgeRails Caching Secrets from the Edge
Rails Caching Secrets from the EdgeMichael May
 
Integrated Cache on Netscaler
Integrated Cache on NetscalerIntegrated Cache on Netscaler
Integrated Cache on NetscalerMark Hillick
 
Background Tasks in Node - Evan Tahler, TaskRabbit
Background Tasks in Node - Evan Tahler, TaskRabbitBackground Tasks in Node - Evan Tahler, TaskRabbit
Background Tasks in Node - Evan Tahler, TaskRabbitRedis Labs
 
ITB2019 NGINX Overview and Technical Aspects - Kevin Jones
ITB2019 NGINX Overview and Technical Aspects - Kevin JonesITB2019 NGINX Overview and Technical Aspects - Kevin Jones
ITB2019 NGINX Overview and Technical Aspects - Kevin JonesOrtus Solutions, Corp
 
Apache Traffic Server
Apache Traffic ServerApache Traffic Server
Apache Traffic Serversupertom
 
Altitude SF 2017: Advanced VCL: Shielding and Clustering
Altitude SF 2017: Advanced VCL: Shielding and ClusteringAltitude SF 2017: Advanced VCL: Shielding and Clustering
Altitude SF 2017: Advanced VCL: Shielding and ClusteringFastly
 
Postgres & Redis Sitting in a Tree- Rimas Silkaitis, Heroku
Postgres & Redis Sitting in a Tree- Rimas Silkaitis, HerokuPostgres & Redis Sitting in a Tree- Rimas Silkaitis, Heroku
Postgres & Redis Sitting in a Tree- Rimas Silkaitis, HerokuRedis Labs
 
HTTP Caching in Web Application
HTTP Caching in Web ApplicationHTTP Caching in Web Application
HTTP Caching in Web ApplicationMartins Sipenko
 
PHP projects beyond the LAMP stack
PHP projects beyond the LAMP stackPHP projects beyond the LAMP stack
PHP projects beyond the LAMP stackCodemotion
 
Kea DHCP – the new open source DHCP server from ISC
Kea DHCP – the new open source DHCP server from ISCKea DHCP – the new open source DHCP server from ISC
Kea DHCP – the new open source DHCP server from ISCMen and Mice
 
Caching basics in PHP
Caching basics in PHPCaching basics in PHP
Caching basics in PHPAnis Ahmad
 
Into The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and dockerInto The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and dockerOrtus Solutions, Corp
 

What's hot (19)

Stupid Boot Tricks: using ipxe and chef to get to boot management bliss
Stupid Boot Tricks: using ipxe and chef to get to boot management blissStupid Boot Tricks: using ipxe and chef to get to boot management bliss
Stupid Boot Tricks: using ipxe and chef to get to boot management bliss
 
Caching with Memcached and APC
Caching with Memcached and APCCaching with Memcached and APC
Caching with Memcached and APC
 
Rails Caching Secrets from the Edge
Rails Caching Secrets from the EdgeRails Caching Secrets from the Edge
Rails Caching Secrets from the Edge
 
ReplacingSquidWithATS
ReplacingSquidWithATSReplacingSquidWithATS
ReplacingSquidWithATS
 
Integrated Cache on Netscaler
Integrated Cache on NetscalerIntegrated Cache on Netscaler
Integrated Cache on Netscaler
 
Fluentd and WebHDFS
Fluentd and WebHDFSFluentd and WebHDFS
Fluentd and WebHDFS
 
Background Tasks in Node - Evan Tahler, TaskRabbit
Background Tasks in Node - Evan Tahler, TaskRabbitBackground Tasks in Node - Evan Tahler, TaskRabbit
Background Tasks in Node - Evan Tahler, TaskRabbit
 
ITB2019 NGINX Overview and Technical Aspects - Kevin Jones
ITB2019 NGINX Overview and Technical Aspects - Kevin JonesITB2019 NGINX Overview and Technical Aspects - Kevin Jones
ITB2019 NGINX Overview and Technical Aspects - Kevin Jones
 
Memcached Study
Memcached StudyMemcached Study
Memcached Study
 
How to monitor NGINX
How to monitor NGINXHow to monitor NGINX
How to monitor NGINX
 
Apache Traffic Server
Apache Traffic ServerApache Traffic Server
Apache Traffic Server
 
Altitude SF 2017: Advanced VCL: Shielding and Clustering
Altitude SF 2017: Advanced VCL: Shielding and ClusteringAltitude SF 2017: Advanced VCL: Shielding and Clustering
Altitude SF 2017: Advanced VCL: Shielding and Clustering
 
Postgres & Redis Sitting in a Tree- Rimas Silkaitis, Heroku
Postgres & Redis Sitting in a Tree- Rimas Silkaitis, HerokuPostgres & Redis Sitting in a Tree- Rimas Silkaitis, Heroku
Postgres & Redis Sitting in a Tree- Rimas Silkaitis, Heroku
 
HTTP Caching in Web Application
HTTP Caching in Web ApplicationHTTP Caching in Web Application
HTTP Caching in Web Application
 
PHP projects beyond the LAMP stack
PHP projects beyond the LAMP stackPHP projects beyond the LAMP stack
PHP projects beyond the LAMP stack
 
Oscon 2010 - ATS
Oscon 2010 - ATSOscon 2010 - ATS
Oscon 2010 - ATS
 
Kea DHCP – the new open source DHCP server from ISC
Kea DHCP – the new open source DHCP server from ISCKea DHCP – the new open source DHCP server from ISC
Kea DHCP – the new open source DHCP server from ISC
 
Caching basics in PHP
Caching basics in PHPCaching basics in PHP
Caching basics in PHP
 
Into The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and dockerInto The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and docker
 

Viewers also liked

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
 
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
 
PHP7実環境ベンチ2016春
PHP7実環境ベンチ2016春PHP7実環境ベンチ2016春
PHP7実環境ベンチ2016春Ryo Tomidokoro
 
Techtalk2015 MOD_PHP vs PHP-FPM
Techtalk2015 MOD_PHP vs PHP-FPMTechtalk2015 MOD_PHP vs PHP-FPM
Techtalk2015 MOD_PHP vs PHP-FPMWebscale
 
PHP Files: An Introduction
PHP Files: An IntroductionPHP Files: An Introduction
PHP Files: An IntroductionJacques Woodcock
 
第2回勉強会資料 柏木
第2回勉強会資料 柏木第2回勉強会資料 柏木
第2回勉強会資料 柏木beyond0iwamoto
 
mod_php vs FastCGI vs FPM vs CLI
mod_php vs FastCGI vs FPM vs CLImod_php vs FastCGI vs FPM vs CLI
mod_php vs FastCGI vs FPM vs CLIJacques Woodcock
 
PHP-FPMとuWSGI——mod_php以外の選択肢を探る
PHP-FPMとuWSGI——mod_php以外の選択肢を探るPHP-FPMとuWSGI——mod_php以外の選択肢を探る
PHP-FPMとuWSGI——mod_php以外の選択肢を探るYoshio Hanawa
 
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
 
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 (19)

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
 
Word press on conoha このべん #3
Word press on conoha このべん #3Word press on conoha このべん #3
Word press on conoha このべん #3
 
mod_php vs. FastCGI 原理与比较
mod_php vs. FastCGI 原理与比较mod_php vs. FastCGI 原理与比较
mod_php vs. FastCGI 原理与比较
 
From LAMP to LNNP
From LAMP to LNNPFrom LAMP to LNNP
From LAMP to LNNP
 
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
 
PHP7実環境ベンチ2016春
PHP7実環境ベンチ2016春PHP7実環境ベンチ2016春
PHP7実環境ベンチ2016春
 
Techtalk2015 MOD_PHP vs PHP-FPM
Techtalk2015 MOD_PHP vs PHP-FPMTechtalk2015 MOD_PHP vs PHP-FPM
Techtalk2015 MOD_PHP vs PHP-FPM
 
PHP Files: An Introduction
PHP Files: An IntroductionPHP Files: An Introduction
PHP Files: An Introduction
 
第2回勉強会資料 柏木
第2回勉強会資料 柏木第2回勉強会資料 柏木
第2回勉強会資料 柏木
 
mod_php vs FastCGI vs FPM vs CLI
mod_php vs FastCGI vs FPM vs CLImod_php vs FastCGI vs FPM vs CLI
mod_php vs FastCGI vs FPM vs CLI
 
Nginx pres
Nginx presNginx pres
Nginx pres
 
PHP-FPMとuWSGI——mod_php以外の選択肢を探る
PHP-FPMとuWSGI——mod_php以外の選択肢を探るPHP-FPMとuWSGI——mod_php以外の選択肢を探る
PHP-FPMとuWSGI——mod_php以外の選択肢を探る
 
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の面倒すぎる関係
 
PHP development with Docker
PHP development with DockerPHP development with Docker
PHP development with Docker
 
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
 
How Flipkart scales PHP
How Flipkart scales PHPHow Flipkart scales PHP
How Flipkart scales PHP
 

Similar to Running php on nginx

Nginx, PHP, Apache and Spelix
Nginx, PHP, Apache and SpelixNginx, PHP, Apache and Spelix
Nginx, PHP, Apache and SpelixHarald Zeitlhofer
 
Load Balancing Applications with NGINX in a CoreOS Cluster
Load Balancing Applications with NGINX in a CoreOS ClusterLoad Balancing Applications with NGINX in a CoreOS Cluster
Load Balancing Applications with NGINX in a CoreOS ClusterKevin Jones
 
NGINX Installation and Tuning
NGINX Installation and TuningNGINX Installation and Tuning
NGINX Installation and TuningNGINX, Inc.
 
Php through the eyes of a hoster confoo
Php through the eyes of a hoster confooPhp through the eyes of a hoster confoo
Php through the eyes of a hoster confooCombell NV
 
High Availability Content Caching with NGINX
High Availability Content Caching with NGINXHigh Availability Content Caching with NGINX
High Availability Content Caching with NGINXKevin Jones
 
5 things you didn't know nginx could do velocity
5 things you didn't know nginx could do   velocity5 things you didn't know nginx could do   velocity
5 things you didn't know nginx could do velocitysarahnovotny
 
Deploying Apache Flume to enable low-latency analytics
Deploying Apache Flume to enable low-latency analyticsDeploying Apache Flume to enable low-latency analytics
Deploying Apache Flume to enable low-latency analyticsDataWorks Summit
 
What’s New in NGINX Plus R16?
What’s New in NGINX Plus R16?What’s New in NGINX Plus R16?
What’s New in NGINX Plus R16?NGINX, Inc.
 
Nginx internals
Nginx internalsNginx internals
Nginx internalsliqiang xu
 
Scale Apache with Nginx
Scale Apache with NginxScale Apache with Nginx
Scale Apache with NginxBud Siddhisena
 
Using NGINX as an Effective and Highly Available Content Cache
Using NGINX as an Effective and Highly Available Content CacheUsing NGINX as an Effective and Highly Available Content Cache
Using NGINX as an Effective and Highly Available Content CacheKevin Jones
 
High Availability Content Caching with NGINX
High Availability Content Caching with NGINXHigh Availability Content Caching with NGINX
High Availability Content Caching with NGINXNGINX, Inc.
 
Php through the eyes of a hoster phpbnl11
Php through the eyes of a hoster phpbnl11Php through the eyes of a hoster phpbnl11
Php through the eyes of a hoster phpbnl11Combell NV
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.jsorkaplan
 
Nginx وب سروری برای تمام فصول
Nginx وب سروری برای تمام فصولNginx وب سروری برای تمام فصول
Nginx وب سروری برای تمام فصولefazati
 
Php through the eyes of a hoster
Php through the eyes of a hosterPhp through the eyes of a hoster
Php through the eyes of a hosterCombell NV
 
IT Operations for Web Developers
IT Operations for Web DevelopersIT Operations for Web Developers
IT Operations for Web DevelopersMahmoud Said
 
Clug 2011 March web server optimisation
Clug 2011 March  web server optimisationClug 2011 March  web server optimisation
Clug 2011 March web server optimisationgrooverdan
 
php & performance
 php & performance php & performance
php & performancesimon8410
 

Similar to Running php on nginx (20)

Nginx, PHP, Apache and Spelix
Nginx, PHP, Apache and SpelixNginx, PHP, Apache and Spelix
Nginx, PHP, Apache and Spelix
 
Load Balancing Applications with NGINX in a CoreOS Cluster
Load Balancing Applications with NGINX in a CoreOS ClusterLoad Balancing Applications with NGINX in a CoreOS Cluster
Load Balancing Applications with NGINX in a CoreOS Cluster
 
NGINX Installation and Tuning
NGINX Installation and TuningNGINX Installation and Tuning
NGINX Installation and Tuning
 
Php through the eyes of a hoster confoo
Php through the eyes of a hoster confooPhp through the eyes of a hoster confoo
Php through the eyes of a hoster confoo
 
Nginx conf.compressed
Nginx conf.compressedNginx conf.compressed
Nginx conf.compressed
 
High Availability Content Caching with NGINX
High Availability Content Caching with NGINXHigh Availability Content Caching with NGINX
High Availability Content Caching with NGINX
 
5 things you didn't know nginx could do velocity
5 things you didn't know nginx could do   velocity5 things you didn't know nginx could do   velocity
5 things you didn't know nginx could do velocity
 
Deploying Apache Flume to enable low-latency analytics
Deploying Apache Flume to enable low-latency analyticsDeploying Apache Flume to enable low-latency analytics
Deploying Apache Flume to enable low-latency analytics
 
What’s New in NGINX Plus R16?
What’s New in NGINX Plus R16?What’s New in NGINX Plus R16?
What’s New in NGINX Plus R16?
 
Nginx internals
Nginx internalsNginx internals
Nginx internals
 
Scale Apache with Nginx
Scale Apache with NginxScale Apache with Nginx
Scale Apache with Nginx
 
Using NGINX as an Effective and Highly Available Content Cache
Using NGINX as an Effective and Highly Available Content CacheUsing NGINX as an Effective and Highly Available Content Cache
Using NGINX as an Effective and Highly Available Content Cache
 
High Availability Content Caching with NGINX
High Availability Content Caching with NGINXHigh Availability Content Caching with NGINX
High Availability Content Caching with NGINX
 
Php through the eyes of a hoster phpbnl11
Php through the eyes of a hoster phpbnl11Php through the eyes of a hoster phpbnl11
Php through the eyes of a hoster phpbnl11
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.js
 
Nginx وب سروری برای تمام فصول
Nginx وب سروری برای تمام فصولNginx وب سروری برای تمام فصول
Nginx وب سروری برای تمام فصول
 
Php through the eyes of a hoster
Php through the eyes of a hosterPhp through the eyes of a hoster
Php through the eyes of a hoster
 
IT Operations for Web Developers
IT Operations for Web DevelopersIT Operations for Web Developers
IT Operations for Web Developers
 
Clug 2011 March web server optimisation
Clug 2011 March  web server optimisationClug 2011 March  web server optimisation
Clug 2011 March web server optimisation
 
php & performance
 php & performance php & performance
php & performance
 

More from Harald Zeitlhofer

Running PHP on Nginx / PHP wgtn
Running PHP on Nginx / PHP wgtnRunning PHP on Nginx / PHP wgtn
Running PHP on Nginx / PHP wgtnHarald Zeitlhofer
 
PHP App Performance / Sydney PHP
PHP App Performance / Sydney PHPPHP App Performance / Sydney PHP
PHP App Performance / Sydney PHPHarald Zeitlhofer
 
Nginx performance monitoring with Dynatrace
Nginx performance monitoring with DynatraceNginx performance monitoring with Dynatrace
Nginx performance monitoring with DynatraceHarald Zeitlhofer
 
Performance optimisation - scaling a hobby project to serious business
Performance optimisation - scaling a hobby project to serious businessPerformance optimisation - scaling a hobby project to serious business
Performance optimisation - scaling a hobby project to serious businessHarald Zeitlhofer
 

More from Harald Zeitlhofer (9)

PHP and databases
PHP and databasesPHP and databases
PHP and databases
 
Improve Magento Performance
Improve Magento PerformanceImprove Magento Performance
Improve Magento Performance
 
Running PHP on Nginx / PHP wgtn
Running PHP on Nginx / PHP wgtnRunning PHP on Nginx / PHP wgtn
Running PHP on Nginx / PHP wgtn
 
PHP App Performance / Sydney PHP
PHP App Performance / Sydney PHPPHP App Performance / Sydney PHP
PHP App Performance / Sydney PHP
 
PHP application performance
PHP application performancePHP application performance
PHP application performance
 
PHP Application Performance
PHP Application PerformancePHP Application Performance
PHP Application Performance
 
Nginx performance monitoring with Dynatrace
Nginx performance monitoring with DynatraceNginx performance monitoring with Dynatrace
Nginx performance monitoring with Dynatrace
 
Nginx, PHP and Node.js
Nginx, PHP and Node.jsNginx, PHP and Node.js
Nginx, PHP and Node.js
 
Performance optimisation - scaling a hobby project to serious business
Performance optimisation - scaling a hobby project to serious businessPerformance optimisation - scaling a hobby project to serious business
Performance optimisation - scaling a hobby project to serious business
 

Recently uploaded

Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Exploring ChatGPT Prompt Hacks To Maximally Optimise Your Queries
Exploring ChatGPT Prompt Hacks To Maximally Optimise Your QueriesExploring ChatGPT Prompt Hacks To Maximally Optimise Your Queries
Exploring ChatGPT Prompt Hacks To Maximally Optimise Your QueriesSanjay Willie
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Visualising and forecasting stocks using Dash
Visualising and forecasting stocks using DashVisualising and forecasting stocks using Dash
Visualising and forecasting stocks using Dashnarutouzumaki53779
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 

Recently uploaded (20)

Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Exploring ChatGPT Prompt Hacks To Maximally Optimise Your Queries
Exploring ChatGPT Prompt Hacks To Maximally Optimise Your QueriesExploring ChatGPT Prompt Hacks To Maximally Optimise Your Queries
Exploring ChatGPT Prompt Hacks To Maximally Optimise Your Queries
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Visualising and forecasting stocks using Dash
Visualising and forecasting stocks using DashVisualising and forecasting stocks using Dash
Visualising and forecasting stocks using Dash
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 

Running php on nginx

  • 1. 1 #Dynatrace Proper  configura-on  for  high  performance  websites   Harald  Zeitlhofer   February  2015     Boost  your  website  by  running   PHP  on  Nginx   @HZeitlhofer   harald.zeitlhofer@dynatrace.com    
  • 3. 3 #Dynatrace • Lightweight  HTTP  server   • Fast  especially  at  high  load   • Open  Source  project  (BSD)     by  Igor  Sysoev   • Nginx,  Inc.  founded  in  2011   • Nginx+:  enhanced  func-onality   and  enterprise  support   •  Load  balancer   •  Media  server  
  • 4. 4 #Dynatrace Leading  among     top  10.000  websites  
  • 7. 7 #Dynatrace • mod_php   • mod_fcgid   • mod_fastcgi     Integra-on   • ngx_h+p_fastcgi_modul  
  • 8. 8 #Dynatrace PHP   FastCGI  Process  Manager  
  • 9. 9 #Dynatrace • Apache  Module   •  used  for  most  PHP  environments   • CGI   •  Command  Line  Interface  (CLI)   • FastCGI  (PHP-­‐FPM)   •  Available  since  5.3.3,  stable  since  5.4.1   •  Run  mul-ple  PHP  worker  processes  to  serve  CGI  requests   •  Mul-ple  connec-on  pools  (different  uid/gid  environments  possible)   •  Isola-on  from  webserver  (fastcgi_finish_request)   PHP  run  modes  
  • 10. 10 #Dynatrace • Installa-on     • Pool  configura-on   /etc/php5/fpm/pool.d/www.conf PHP-­‐FPM   [www] user = www-data group = www-data listen = 127.0.0.1:9000 # for Unix socket: unix:/var/run/php5-fpm.sock; root@hzvm01:/etc/nginx/sites-enabled# ps -ef | grep php root 6435 1 0 14:39 ? 00:00:32 php-fpm: master process (/etc/php5/fpm/php-fpm.conf) spelix 6439 6435 0 14:39 ? 00:00:00 php-fpm: pool batch spelix 6440 6435 0 14:39 ? 00:00:00 php-fpm: pool batch www-data 10576 6435 1 18:45 ? 00:00:48 php-fpm: pool www www-data 10920 6435 1 18:47 ? 00:00:47 php-fpm: pool www www-data 10927 6435 1 18:47 ? 00:00:46 php-fpm: pool www sudo apt-get install php5-fpm
  • 11. 11 #Dynatrace • Pool  configura-on   /etc/php5/fpm/pool.d/www.conf PHP-­‐FPM   [pool_name] ... pm = [dynamic/static] pm.max_children = 10 ;only used for dynamic: pm.start_servers = 2 pm.min_spare_servers = 1 pm.max_spare_servers = 3 pm.max_children      =  total  available  memory  /  memory  used  by  1  PHP  process  
  • 12. 12 #Dynatrace Nginx  and  PHP-­‐FPM   Integra-on  
  • 13. 13 #Dynatrace • /etc/nginx/nginx.conf       # max_clients = worker_processes * worker_connections worker_processes 8; # number of CPUs worker_rlimit_nofile 40000; events { worker_connections 1024; multi_accept on; }
  • 14. 14 #Dynatrace • Communica-on  via  sockets   •  TCP  vs  Unix   •  Unix  slightly  faster  when  used  on  localhost   •  Use  TCP  for  high  load   location ~* .php$ { fastcgi_index index.php; fastcgi_pass 127.0.0.1:9000; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; } fastcgi_pass unix:/var/run/php5-fpm.sock;
  • 15. 15 #Dynatrace Nginx  –  PHP  transac-on  flow  
  • 16. 16 #Dynatrace •  Sta-c  content  to  be  served  by  Nginx   •  Dynamic  requests  to  be  sent  to  PHP-­‐FPM   Integra-on   server { listen 80; root /var/www/test; index index.php index.html index.htm; server_name test.whateveryourdomain.is; location ~ .(html|js|css|gif|jpg|jpe|jpeg|png|bmp|tif|pdf|ico)$ { try_files $uri @notfound; } location / { try_files $uri $uri/ =404; } location ~* .php$ { fastcgi_index index.php; fastcgi_pass php; include fastcgi_params; } }
  • 17. 17 #Dynatrace hdp://www.mysite.com/news/browse/2014   è  to  be  handled  by  index.php   URL  rewrite   ... RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^(.+)$ index.php ...
  • 18. 18 #Dynatrace hdp://www.mysite.com/news/browse/2014   è  to  be  handled  by  index.php   URL  rewrite   upstream php { server unix:/var/run/php5-fpm.sock; } server { listen 80; root /var/www; index index.php index.html index.htm; server_name www.mysite.com; location / { try_files $uri $uri/ @missing; } location @missing { rewrite (.*) /index.php; } location ~ .php$ { fastcgi_index index.php; include fastcgi_params; fastcgi_pass php; } }
  • 19. 19 #Dynatrace using  Nginx/PHP-­‐FPM  there’s  a  beder  way:   URL  rewrite   upstream php { server unix:/var/run/php5-fpm.sock; } server { listen 80; root /var/www; index index.php index.html index.htm; server_name www.mysite.com; location /images { try_files $uri $uri/ =404; } location /scripts { try_files $uri $uri/ =404; } location / { fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME /var/www/index.php; fastcgi_pass php; } } <?php $params = explode('/', trim($_SERVER["DOCUMENT_URI"],'/')); ...
  • 20. 20 #Dynatrace • Easy  way  to  deploy  your  applica-on   • All  source  files  packed  into  one  *.phar  file   PHAR  –  PHP  Archives   location ~* .(php|phar)$ { fastcgi_index index.php; fastcgi_pass 127.0.0.1:9000; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root/myapp.phar; }
  • 21. 21 #Dynatrace PHAR  example   root@hzvm01:/var/www/app/src# ls -lrtR .: total 8 drwxrwxr-x 2 root root 4096 Oct 10 16:27 lib -rw-r--r-- 1 root root 27 Oct 10 16:27 index.php ./lib: total 4 -rw-r--r-- 1 root root 87 Oct 10 16:27 App.php root@hzvm01:/var/www/app/src# cat index.php <?php $app = new App(); ?> root@hzvm01:/var/www/app/src# cat lib/App.php <?php class App { function __construct() { echo "Starting Applicationn"; } }
  • 22. 22 #Dynatrace PHAR  example   location /myapp { fastcgi_index index.php; fastcgi_pass 127.0.0.1:9000; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root/myapp.phar; } root@hzvm01:/var/www/app# phar pack -f myapp.phar src lib/App.php index.php root@hzvm01:/var/www/app# l myapp.phar -rw-r--r-- 1 root root 6923 Oct 10 19:51 myapp.phar
  • 25. 25 #Dynatrace • Nginx  running  with  default  sehngs   • Apache   •  AllowOverride  None   •  Mul--­‐process  mode  to  allow  usage  of  mod_php   Benchmarking  Nginx  vs  Apache  
  • 26. 26 #Dynatrace Sta-c  HTML,  10k  requests   0   1   2   3   4   5   6   7   8   9   100   500   1000   2000   Apache/2.4.9   nginx/1.1.19   concurrency   Total  response  -me  [sec]  
  • 28. 28 #Dynatrace • Part  of  the  Nginx  FastCGI  module   Nginx  FastCGI  cache   fastcgi_cache_path /etc/nginx/cache levels=1:2 keys_zone=APPKEY:100m inactive=60m; fastcgi_cache_key "$scheme$request_method$host$request_uri"; location ~* .php$ { fastcgi_index index.php; fastcgi_pass 127.0.0.1:9000; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_cache APPKEY; fastcgi_cache_valid 200 60m; }
  • 31. 31 #Dynatrace Tes-ng  FastCGI  cache   <?php echo time()."n"; ?>
  • 32. 32 #Dynatrace • ngx_hdp_memcached_module   Full  page  cache  with  Nginx  and  Memcached   server { location / { set $memcached_key "$uri"; memcached_pass localhost:11211; error_page 404 502 504 = @fallback; } location @fallback { proxy_pass http://backend; } }
  • 33. 33 #Dynatrace • PHP     Full  page  cache  with  Nginx  and  Memcached   <?php ... function cachePage($content) { $c = new Memcached(); $c->addServer('localhost',11211); $c->set($_SERVER[”REQUEST_URI"], $content); } ... $content = $this->renderPage(); $this->cachePage($content); ... ?>
  • 34. 34 #Dynatrace PHP,  5k  requests,  concurrency  100   0   1   2   3   4   5   6   7   8   Apache+PHP   Nginx+PHP   Nginx+Memcached   <?php echo “Hello World”; ?>
  • 35. 35 #Dynatrace Server Software: Apache/2.4.7 Server Hostname: test.hzvm01 Server Port: 88 Document Path: /index.php Document Length: 10 bytes Concurrency Level: 100 Time taken for tests: 7.296 seconds Complete requests: 5000 Failed requests: 0 Total transferred: 985000 bytes HTML transferred: 50000 bytes Requests per second: 685.31 [#/sec] (mean) Time per request: 145.920 [ms] (mean) Time per request: 1.459 [ms] (mean, across all concurrent requests) Transfer rate: 131.84 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 6 6.5 4 56 Processing: 30 138 57.2 120 938 Waiting: 30 135 56.4 117 937 Total: 55 144 55.8 126 938 PHP,  5k  requests,  concurrency  100  
  • 36. 36 #Dynatrace Server Software: Nginx + PHP Server Hostname: test.hzvm01 Server Port: 80 Document Path: /index.php Document Length: 10 bytes Concurrency Level: 100 Time taken for tests: 4.514 seconds Complete requests: 5000 Failed requests: 0 Total transferred: 625000 bytes HTML transferred: 50000 bytes Requests per second: 1107.62 [#/sec] (mean) Time per request: 90.284 [ms] (mean) Time per request: 0.903 [ms] (mean, across all concurrent requests) Transfer rate: 135.21 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 2 3.2 1 38 Processing: 22 88 13.1 87 148 Waiting: 21 87 13.1 86 148 Total: 42 89 12.5 88 148 PHP,  5k  requests,  concurrency  100  
  • 37. 37 #Dynatrace Server Software: Nginx + Memcached Server Hostname: test.hzvm01 Server Port: 82 Document Path: /index.php Document Length: 23 bytes Concurrency Level: 100 Time taken for tests: 3.058 seconds Complete requests: 5000 Failed requests: 0 Total transferred: 865000 bytes HTML transferred: 115000 bytes Requests per second: 1634.92 [#/sec] (mean) Time per request: 61.165 [ms] (mean) Time per request: 0.612 [ms] (mean, across all concurrent requests) Transfer rate: 276.21 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 7 24 6.0 24 59 Processing: 8 36 7.8 36 75 Waiting: 6 28 7.4 29 69 Total: 32 60 9.3 60 101 PHP,  5k  requests,  concurrency  100  
  • 38. 38 #Dynatrace • set  HTTP  response  expires  header   Client  Side  Caching   location ~ .(html|js|css|gif|jpg|jpe|jpeg|png|bmp|tif|pdf|ico)$ { expires 90d; access_log off; error_log off; try_files $uri =404; }
  • 39. 39 #Dynatrace • keep  handlers  for  requested  sta-c  files  open   Filehandle  Caching   open_file_cache max=1000 inactive=5m; open_file_cache_valid 60s; open_file_cache_min_uses 5; open_file_cache_errors off;
  • 40. 40 #Dynatrace •  ngx_hdp_upstream_module   Load  balancing  PHP   upstream php_loadbalancer { ip_hash; server unix:/var/run/php5-fpm.sock weight=5; server 192.168.56.12:7777 weight=2; server 192.168.56.13:7777; } server { listen 80; root /home/www/test; server_name test.hzvm01; location / { try_files $uri =405; } location ~ .php$ { fastcgi_pass php_loadbalancer; fastcgi_index index.php; include fastcgi_params; } }
  • 42. 42 #Dynatrace Load  balancing  /  Reverse  Proxy   upstream backend { ip_hash; server 192.168.56.11 weight=5; server 192.168.56.12 weight=2; server 192.168.56.13; } server { listen 80; root /var/www/mysite.com/html; server_name www.mysite.com; location / { try_files $uri =405; proxy_pass http://backend; } }
  • 43. 43 #Dynatrace Reverse  Proxy  /  Load  balancing  /  Caching   proxy_cache_path /etc/nginx/cache keys_zone=APPKEY:10m; proxy_cache_key "$host$request_uri$cookie_user"; proxy_cache_min_uses 5; proxy_cache_methods GET HEAD; proxy_cache_valid 200 302 10m; proxy_cache_valid 404 1m; upstream backend { ip_hash; server 192.168.56.11 weight=5; server 192.168.56.12 weight=2; server 192.168.56.13; } server { listen 80; root /var/www/mysite.com/html; server_name www.mysite.com; proxy_cache APPKEY; location / { proxy_pass http://backend; } }
  • 49. 49 #Dynatrace • Load  Generator  (Apache  Benchmark,  JMeter)   • Firebug,  Google  Developer  Tools   Dynatrace  Ajax  Edi-on   • Google  PageSpeed   • Dynatrace  Free  Trial   •  Free  trial  license  for  30  days   •  Free  for  developers  on  local  machine   Tools   hdp://bit.ly/ddrial  
  • 50. 50 #Dynatrace Thank You harald.zeitlhofer@dynatrace.com   @HZeitlhofer     www.dynatrace.com