Hi,
I switched to Linode (512) a couple of days ago from shared hosting (HostMonster).
After 3 days of work I managed to perfectly install a Wordpress site running on CentOS 6, Nginx, PHP-FPM, MySQL. I decided to test the speeds and compare the same identical sites: one running on Linode servers and the other on HostMonster servers.
Note: this website gets a
"Grade A" on Yslow and
"Overall performance score 96". I don't use any caching plugins (W3TC, WPSC, DB Cache) for Wordpress. I know I can make it load faster if I do. And if I run the website through Cloudflare. I'm not looking for
that kind of replies to this thread...
I did some tests with Apache bench (4 x 200). The results are:
4.5 – 4.9 requests per second
~800 ms time per request
and takes around 40 seconds to complete
And for the shared hosting:
2-3 requests per second
~1400 ms time per request
and it takes around 90 seconds to complete
"It's great" you'd say, "it's around twice as fast". But real testing shows different results (using
http://whichloadsfaster.com):
Over 50 runs an improvement of only
15% (
1426ms average HostMonster |
1227ms average Linode)
And it's not only these tools. I also feel that they load the same!
Is that normal? From what I read over the Internet about nginx and PHP-FPM
I expected much better results.
There is also the cost: I pay
3.3 times more ($6 over $20), get bandwidth cap, endless headaches (SSH noob) for trying to setup a server myself, for only ~15% improvement? I switched hoping my websites would load faster! Am I doing something wrong here?
So, I am asking you to help me!
I do want to like Linode! I do presume it's not their fault! But if things stay the same I don't see me staying here...
Are there any nginx tricks you could recommend me to make this setup somehow faster? Should I mess with the HTTPD.conf at all? What else?
Thanks for your time!
P.S. I am attaching below (irrelevant code is missing, for the sake of length) the nginx.conf file, single website conf file and my httpd.conf (both improved from what I read over the Internet). In the php.ini I didn't change anything except allow for larger files to be uploaded via PHP (20MB):
=======
nginx.conf
=======
Code:
user nginx;
worker_processes 4;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
client_max_body_size 20M;
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush off;
tcp_nodelay on;
#Improved security (allow only 5 connections, timeout faster, limit buffer size)
limit_zone slimits $binary_remote_addr 5m;
limit_conn slimits 5;
client_body_timeout 10;
client_header_timeout 10;
keepalive_timeout 30;
send_timeout 10;
client_body_buffer_size 3K;
client_header_buffer_size 3k;
large_client_header_buffers 2 1k;
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_disable "MSIE [1-6].(?!.*SV1)";
gzip_comp_level 2;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
include /etc/nginx/blockips.conf;
}
=====
single_website.conf
=====
Code:
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
access_log off;
expires 30d;
root /srv/www/sicanstudios.com;
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}=====
httpd.conf
=====
Code:
Timeout 30
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 6
<IfModule prefork.c>
StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 512
MaxClients 512
MaxRequestsPerChild 4000
</IfModule>
# worker MPM (commented out)