Welcome! Log In Create A New Profile


New server already set up, performance

Posted by andresb 
New server already set up, performance
February 10, 2010 01:47PM
Hello friends. I'm new to nginx, but I'm also an old dog in terms of hosting/platform/development.

I've just set up the first server with no apache whatsoever, only nginx, php-cgi and mysql.

Here's a typical top screen on the server: http://andresb.net/ab/snaps/344ba90e6cd061fbfc7c71e47fda7f2d.png

The hardware is a low-end dedicated server at JaguarPC.com, dual core AMD cpu, 2Gb RAM, 250Gb HDD, CentOS 5.4.

I just can't bring down the average load, no matter how idle is the CPU and how much available RAM I have. Can you tell if there's something stupidly wrong by just looking at top?

The snapshot was taken at peak hour with a single wordpress site configured on the server getting around 50K visits/day. PHP has APC extension installed and working, Wordpress has WP-Super-Cache enabled and MySql has the my-medium.cnf file and query cache enabled, with around 1000 queries constantly in cache and no lom-mem-prunes. No mail server/traffic. csf firewall on top of iptables and the main server configuration is:

user nobody;
worker_processes 2;

error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;

events {
worker_connections 1024;

http {
include mime.types;
default_type application/octet-stream;

ignore_invalid_headers on;
limit_zone gulag $binary_remote_addr 1m;
limit_conn gulag 5;
recursive_error_pages on;
sendfile on;
#server_name_in_redirect off;
server_tokens off;

## TCP options
tcp_nodelay on;
tcp_nopush on;

## Compression
gzip on;
gzip_static on;
gzip_buffers 16 8k;
gzip_comp_level 9;
gzip_http_version 1.0;
gzip_min_length 0;
gzip_types text/plain text/css text/javascript application/javascript
application/x-javascript image/x-icon image/bmp;
gzip_vary on;

## Timeouts
client_body_timeout 5;
client_header_timeout 5;
keepalive_timeout 10 10;
send_timeout 5;

server {
listen 80;
server_name localhost;

location / {
root html;
index index.html index.htm;

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;

# pass the PHP scripts to FastCGI server listening on
location ~ \.php$ {
root html;
fastcgi_pass unix:/var/lib/nginx/php_cgi.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
location ~ /\.ht {
deny all;

#Virtual hosts
include /etc/nginx/sites/*.conf;


Am I being stupid about something?

Re: New server already set up, performance
February 11, 2010 01:21AM
I don't see anything striking in the nginx.conf that you posted. Those don't seem like high loads during peak hours on commodity hardware. Probably a dumb question, but are you running the PAE kernel? If so, and you only have 2GB of RAM, try booting with the standard kernel and see what happens. Have you tried using a TCP socket for PHP and seeing if it makes a difference? I don't think it will necessarily but it's worth a look. I see you have gzip on for bitmap files. Are you serving a lot of them? Converting them to png's might decrease your system load and data transfer.

Jim Ohlstein
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 106
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready