aspose file tools*
The moose likes Tomcat and the fly likes Apache+mod_jk+Tomcat : something wrong? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Apache+mod_jk+Tomcat : something wrong?" Watch "Apache+mod_jk+Tomcat : something wrong?" New topic
Author

Apache+mod_jk+Tomcat : something wrong?

J You
Greenhorn

Joined: Jul 31, 2001
Posts: 29
Hi,
In our Solaris(SunOS5.6) system, I installed the Apache 1.3.27, mod_jk_1.3_no_eapi.so, and 2 copies
of Tomcat 4.1.8. The apache will act as frontend
and dispatch requests to the 2 instances of Tomcat.
There is no error shown when I configure,install
and run the servers.
I also use the Grinder as stress test tool:http://grinder.sourceforge.net/
To test the system, I changed the Tomcat1, Tomcat2 http listening port to 9990,9991,
the Apache is listening at 2947, the mod_jk
ports are 11009, and 12009.
From the server.xml, it seems the Tomcat can serve at most 75 concurrent requests. From httd.conf, the Apache can serve 175 requests.
I placed a very simple JSP file in the web application root, and wrote a grinder test script
which sends 70 requests in very short time.
Here is the testing results:
1, if I use the grinder to send requests directly
to Tomcat, the mean response time is about 600ms
2, if I use the grinder to send requests to Apache, the mean response time becomes pretty big,
like 4s. this result is really weired.
I then checked the Tomcat log, it seems all 70 requests were dispatched to Tomcat1, which I guess
is normal since the limit of Tomcat1 is 75.
But in the Apache/logs/mod_jk.log, there were some
error messages like
Fri Jan 10 08:45:01 2003] loadbalancer
my.com my.com 2947 200 0.167065
[Fri Jan 10 08:45:01 2003] loadbalancer my.com my.com 2947 200 0.116934
[Fri Jan 10 08:45:01 2003] loadbalancer my.com my.com 2947 200 0.146300
[Fri Jan 10 08:45:01 2003] [jk_ajp_common.c (681)]: ERROR: can't receive the response message from tomcat, network problems or tomcat is down.
[Fri Jan 10 08:45:01 2003] [jk_ajp_common.c (1050)]: Error reading reply from tomcat. Tomcat is down or network problems.
[Fri Jan 10 08:45:01 2003] [jk_ajp_common.c (1187)]: ERROR: Receiving from tomcat failed, recoverable operation. err=0
[Fri Jan 10 08:45:01 2003] [jk_ajp_common.c (681)]: ERROR: can't receive the response message from tomcat, network problems or tomcat is down.
[Fri Jan 10 08:45:01 2003] [jk_ajp_common.c (1050)]: Error reading reply from tomcat. Tomcat is down or network problems.
[Fri Jan 10 08:45:01 2003] [jk_ajp_common.c (1187)]: ERROR: Receiving from tomcat failed, recoverable operation. err=0
[Fri Jan 10 08:45:01 2003] loadbalancer my.com my.com 2947 200 0.117587
[Fri Jan 10 08:45:01 2003] loadbalancer my.com my.com 2947 200 0.125157
[Fri Jan 10 08:45:01 2003] loadbalancer my.com my.com 2947 200 0.122595
This errors shows that the communication between Apache(mod_jk) and Tomcat got trouble randomly.
I also made another tests which sent 100 requests to Apache, and from the tomcat log, it seems this
time the Tomcat2 got some hits.
From my testing, I feel the mod_jk did work, as load balancer, to dispatch requests to multi tomcat instances.But the whole performance is bad
because of the error shown in mod_jk.log.
I will post the httpd.conf, server.xml, workers.properties files in following posts.
Any advice is greatly appreciated!
J You
Greenhorn

Joined: Jul 31, 2001
Posts: 29
here is the part of httpd.conf:
# load module JK
LoadModule jk_module libexec/mod_jk-1.3-noeapi.so
JKWorkersFile conf/workers.properties
JKLogFile logs/mod_jk.log
JKLogLevel info
JkRequestLogFormat "%w %q %V %v %p %s %T"
....
DocumentRoot "/opt/Apache1.3.27/htdocs"
JKMount /*.jsp loadbalancer
JKMount /servlet/* loadbalancer
JKMount /myapplication/* loadbalancer
J You
Greenhorn

Joined: Jul 31, 2001
Posts: 29
here is the conf/workers.properties file:
#work properties
ps=/
worker.list=tomcat1,tomcat2,loadbalancer
worker.tomcat1.port=11009
worker.tomcat1.host=localhost
worker.tomcat1.type=ajp13
#worker.tomcat1.cachesize
worker.tomcat1.lbfactor=1
worker.tomcat2.port=12009
worker.tomcat2.host=localhost
worker.tomcat2.type=ajp13
#worker.tomcat2.cachesize
worker.tomcat2.lbfactor=1
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=tomcat1,tomcat2
J You
Greenhorn

Joined: Jul 31, 2001
Posts: 29
here is the change I made to the Tomcat/conf/server.xml
1, comment the mbean, because I use mod_jk, and got errors if the mbean is not commented.
<!-- <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
debug="0"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
debug="0"/>
-->
2, open the non-ssl coyote http listener
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
port="9990" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443"
acceptCount="100" debug="0" connectionTimeout="20000"
useURIValidationHack="false" disableUploadTimeout="true" />
3, comment the coyote/jk2 listener and open the
jk AJP13 listener
<Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
port="11009" minProcessors="5" maxProcessors="75"
acceptCount="10" debug="0"/>
4, create the context path of my web application.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Apache+mod_jk+Tomcat : something wrong?
 
Similar Threads
getting apache 2 to work with tomcat 4.1.27
Errors with Apache/Tomcat server setup
JBoss clustering
Apache/Tomcat strange behavior
JBoss Clustering