Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a tomcat v6 which contains 2 web applications (JSF2.0 and JSP). The physical server is RedHat Enterprise with 16GB memory.

In current form, the tomcat is exposed to the internet via apache 2.2 and we're by using mod_jk v1.28 connector. so in essence when a user types in www1.example.com/myWebApp where webApp has been configured in httpd.conf as worker1 which in turn points to above mentioned tomcat v6 above listening on port 8009 to handle the request.

Tomcat server.xml has the following relevant bits:

 <Connector port="8080"
             protocol="HTTP/1.1"
             maxThreads="150"
             connectionTimeout="20000"
             redirectPort="8443"
  />

 <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

in workers.properties worker1 has been configured as:

worker.worker1.type = ajp13
worker.worker1.host =localhost
worker.worker1.port = 8009

and in httpd.conf :

JkMount     /myWebApp/* worker1

In testing the page load speeds, when i access the web application by accessing the above tomcat directly using its localhost address (localhost:8080/myWebApp), the web application is fast and page load averages about 2-3 seconds max.

Now if i access the same web application, on same network except this time by going via apache (www1.example.com/myWebApp) the page is visibly slower and page load speed average between 10-12 seconds.

is this normal? I am suspecting that the leg work that happens between apache ---> mod_jk --> tomcat v6 to handle any given request is adding up to the slow speeds? Can someone suggest ways in which i can improve the responsiveness of the web applications when requesting are coming from apache?

UPDATE:

DNS lookup delays is out of question given www1.example.com which is mapped to our local IP address so there is definitely no DNS look up delays contributing to this delay.

share|improve this question
1  
Do you have reverse DNS lookups enabled anywhere? HostnameLookups in apache, or maybe in your application. Is DNS correctly set up in your environment? –  Oliver May 31 '12 at 13:13
    
@Oliver HostnameLookups Off . I am not sure how to answer "Is DNS set-up correctly" as i don't really know how to test and find out if issues with DNS is slowing things sown. My role in this company is a Developer and you would normally think Networking/Infrastructure team would deal with such issues but unless i can prove there is an actual problem no one in interested in looking into it... –  techventure May 31 '12 at 23:55
    
The reason I am asking about DNS is that such long delays are an indication of something such as a DNS lookup timing out. To check if your server does some DNS lookups it shouldn't, you could sniff port 53 traffic with tcpdump: tcpdump port 53. –  Oliver Jun 1 '12 at 5:47
    
@Oliver please see updated question but in short DNS lookup does not seem to be causing the delay. –  techventure Jun 5 '12 at 12:14

1 Answer 1

up vote 0 down vote accepted

Try testing on the localhost hostname first:

i.e with the localhost hostname via Apache. If it is faster, then you know you have a DNS issue.

If it is still slow try using mod_proxy to reverse proxy requests to 8080 and see if that slow e.g.

so firstly do

a2enmod proxy

and then in your VirtualHost (put in a separate conf, don't use http.conf), and remove the JKMount from http.conf

ProxyPassReverse /myWebApp/ http://localhost:8080/myWebApp/

If it isn't then you know its the AJP connector. It it is, then their is something else on your Apache server causing the problem

share|improve this answer
    
"try with the localhost hostname via Apache...." how can localhost name go through apache? i.e. if localhost name is interna.melbourne.com and typing interna.melbourne.com:8080/myWebApp takes me to directly to tomcat (equivalent of typing localhost:8080/myWebApp) what do i need to do to make it go through apache? right now you would have to type wwww.example.com/myWebApp to go through apache. –  techventure May 31 '12 at 23:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.