Apache Tomcat performance

mschipperheyn nginx-forum at nginx.us
Mon Jan 3 04:36:14 MSK 2011


Hi,

I'm a newbie on Nginx and I became interested in it because Apache 2 is
so wasteful with resources. However, Nginx seems a lot slower than
Apache. It takes about 3 seconds to return a request even when I'm
within the cache timeout period which surprises me. 

My test server is 512MB, Lucid Lynx with Apache Tomcat 6.0.24 and Nginx
0.7.65.

I've set up an asset server configuration and an application server
configuration. 

Any help's appreciated.

server.xml
[code]

[/code]

I also tried the Nio protocol with the same result.
I used apt-get install libtcnative-1 (1.1.19) to install the APR support
for Tomcat and I can see that the native libraries are being loaded

default nginx
[code]
server {
	listen          80 default;
	server_name     _;
	server_name_in_redirect  off;
	charset utf-8;
	root            /usr/shared/apache-tomcat-6.0.x/webapps/ROOT;
	add_header  Cache-Control public;
	
	location /WEB-INF/ {
		deny all;
	}
	location ~ /\.ht {
		deny  all;
	}
	
	location / {
		try_files $uri $uri/ @proxy;
	}
	
	location @proxy {
		proxy_pass              http://localhost:8080;
		proxy_set_header        X-Real-IP $remote_addr;
		proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header        Host $http_host;
		proxy_max_temp_file_size 0;
		proxy_buffering off;
		proxy_store         off;
		proxy_connect_timeout 120;
		proxy_send_timeout    120;
		proxy_read_timeout    120;

		# All POST requests go directly
		if ($request_method = POST) {
			proxy_pass http://localhost:8080;
			break;
		}
	}
}
[/code]
assets nginx
[code]
server {
	listen          80;
	server_name     assets.mercadosa.com;
	root            /usr/share/apache-tomcat-6.0.24/webapps/ROOT/assets;
	
	location / {
		rewrite ^/[^/]+(/.*)	/$1;
		expires 90d;
	}
}
[/code]

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,162986,162986#msg-162986




More information about the nginx mailing list