Apache Tomcat performance

Jérôme Balducci jerome at plugaround.com
Mon Jan 3 12:40:25 MSK 2011


http://www.ruby-forum.com/topic/194600 may be useful.
Short answer is : build tomcat with apr native

Le 3 janv. 2011 à 02:36, mschipperheyn a écrit :

> 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
> 
> 
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20110103/1c5f665c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4708 bytes
Desc: not available
URL: <http://nginx.org/pipermail/nginx/attachments/20110103/1c5f665c/attachment.bin>


More information about the nginx mailing list