 |
Linode Forum Linode Community Forums
|
| Author |
Message |
Mark_Stenks
Joined: 13 Jan 2012
Posts: 3
|
| Posted: Wed Jan 25, 2012 2:42 pm Post subject: How To Tuning the performance NGINX - php-fpm |
|
|
Hi @ all,
i don't know how to tuning the performance about my web servers...
i have 2 linode 1024 balanced with LinodeBalancer, serving a website with a high traffic.
configured like this :
NodeBalancers :
Algorithm = leastConnection
Session Stickiness = Table
two web servers :
Code: Ubuntu 10.04 32Bit (Linode Kernel 3.2.1-linode40)
nginx version: nginx/1.0.11
PHP 5.3.5-1ubuntu7.2ppa1~lucid with Suhosin-Patch
php-apc module enabled.
php5-fpm
all this packets was installed from the ppa :
Code: ppa:nginx/stable
ppa:nginx/php5
nginx is configured like this :
Code: user www-data;
worker_processes 4;
worker_rlimit_nofile 32768;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 4096;
multi_accept on;
accept_mutex_delay 50ms;
}
http {
tcp_nodelay on;
expires -1;
server_tokens off;
sendfile on;
tcp_nopush on;
keepalive_timeout 60 60;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
map $scheme $server_https {
default off;
https on;
}
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
php-fpm :
Code: [www]
listen = /etc/php5/php5-fpm.sock
user = www-data
group = www-data
pm = dynamic
pm.max_children = 8
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.max_requests = 1000
request_terminate_timeout = 30s
#request_slowlog_timeout = 1s
#slowlog = /var/log/php5-fpm/$pool.log.slow
rlimit_files = 32768
rlimit_core = unlimited
chdir = /
and the website is configured like this :
Code: server {
server_name webdomain.org;
listen 80; ## listen for ipv4; this line is default and implied
access_log /var/log/nginx/web_access.log combined buffer=32k;
error_log /var/log/nginx/web_error.log info;
root /home/web/;
index index.php index.html index.htm;
try_files $uri $uri/ @rewrite;
location @rewrite {
rewrite ^/(.*)$ /index.php/$1;
}
location ~ \.php {
# try_files $uri =404;
#auth_basic "Restricted";
#auth_basic_user_file /etc/nginx/htpasswd;
fastcgi_index index.php;
fastcgi_pass backend;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~ /\.ht {
deny all;
}
}
upstream backend {
server unix:/etc/php5/php5-fpm.sock;
}
this configuration is the same in the web server no.2
i'm trying to test the website with ab and this is the results :
ab -n 50000 -c 1000 http://localhost/
Code: Server Software: nginx
Server Hostname: localhost
Server Port: 80
Document Path: /en
Document Length: 188 bytes
Concurrency Level: 1000
Time taken for tests: 7.112 seconds
Complete requests: 50000
Failed requests: 0
Write errors: 0
Non-2xx responses: 50296
Total transferred: 19011888 bytes
HTML transferred: 9455648 bytes
Requests per second: 7030.27 [#/sec] (mean)
Time per request: 142.242 [ms] (mean)
Time per request: 0.142 [ms] (mean, across all concurrent requests)
Transfer rate: 2610.52 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 28 60 11.1 60 108
Processing: 36 80 16.4 80 155
Waiting: 25 61 16.5 60 121
Total: 90 141 14.2 140 203
Percentage of the requests served within a certain time (ms)
50% 140
66% 146
75% 150
80% 152
90% 159
95% 164
98% 173
99% 182
100% 203 (longest request)
from this output is not bad, (i think) but if i test the website with loadimpact i have a bad bad bad result.
500 concurrent connection in 10 minutes :
i don't know where to begin.
any help is very very appreciated!
Thanks |
|
| Back to top |
|
Guspaz
Joined: 26 May 2009
Posts: 1150
Location: Montreal, QC
|
| Posted: Thu Jan 26, 2012 10:20 am Post subject: |
|
|
| Your benchmark is showing you can serve over 7000 requests per second... It does't look like you need any tuning to me, unless the page you were benchmarking (your index file) isn't representative of actual user load. |
|
| Back to top |
|
| |
|