yaoweibin/nginx_ajp_module — Issue #5: There are too many "TIME_WAIT" between nginx and tomcat when your ajp module is in use.
Author: HelloJamesLee
Created: 2011-11-04 05:17:34+00:00
State: open

Hi,

When I use Nginx+ajp_module+tomcat and Apache+mod_jk+tomcat, I found two problems. What's the reason? Can you help?

(1) There are too many TIME_WAIT between nginx and tomcat
The TIME_WAIT/Total connection is 13890/16030
When I use the Apache+mod_jk+tomcat, the TIME_WAIT/Total is 92/952.

(2) The %CPU of tomcat in Nginx is higher than that of tomcat in apache. -- This is the main problem.
The tomcat in Apache used all the maxThreads(512), but tomcat in Nginx only uses 125 threads, via "ps -efL | grep catalina "

The configuration of tomcats in these two situatin are the same, and the concurrency is also the same. The configuration of ajp module is as follow:
ajp_connect_timeout 10;
ajp_read_timeout 10;
upstream loadbalancer {
server 127.0.0.1:8001;
server 127.0.0.1:8002;
server 127.0.0.1:8003;

#keepalive 6400;
}
Whether i enable keepalive in upstream directive or not, the two problem exists all the same.
The ajp_module version is 0.2.5, the latest version.

Can you give me some clues to reslove these problems? Thank you!