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

I'm running an instance of Apache Tomcat (5.5) on a Windows 2008 platform. I think I'm seeing an issue related to concurrent file access / locking.

When the number of concurrent HTTP threads is increased beyond the default setting (150), I see (using a site monitoring tool) an increasing number of 'unnatural' delays when serving some static content (.js .gif .png etc). By this, I mean that the server takes 20 seconds plus before starting to send or taking 30 seconds to serve a small (2KiB) file.

When Tomcat is busy (serving over 300 threads), CPU usage averages around 50-60% and disk usage is around 10-30mbps.

Are there any tools I can use for Java to establish whether this is the case? Would the Tomcat APR / Apache Native Library potentially resolve this?

Alternatively, is there anything else I should be looking into?

Screenshot of site analysis tool: enter image description here

share|improve this question

migrated from stackoverflow.com Mar 8 '11 at 11:28

This question came from our site for professional and enthusiast programmers.

    
you want NIO for static resources. –  bestsss Mar 7 '11 at 19:31
    
Have a look here, it has been discussed already: stackoverflow.com/questions/654701/… –  mindas Mar 7 '11 at 21:43
    
@mindas: That's not really the issue here, the normal throughput of Tomcat is more than acceptable. I'm trying to ascertain why the occasional piece of content takes and extremely long time. –  Mikaveli Mar 8 '11 at 8:53

2 Answers 2

up vote 3 down vote accepted

Tomcat 7 supports serving static files outside of the WAR. See here (point 4.) Have you tried it?

Can you confirm that it's the Tomcat that generates such a delay (for instance using Tomcat's access log)? It shouldn't be hard to correlate slowly downloaded file with entry in access log on the server side.

What are the HTTP threads doing during the test? It would be amazing to dump stack traces when this phenomenon happens. If you see that some resource takes excessively long time to download, just perform dump and find the guilty thread (with tuned access log you can print the thread name).

share|improve this answer

Have an apache web server before the tomcat and serve images and js from there. Route the rest of traffic to tomcat through proxy settings or ajp.

share|improve this answer
2  
All the whitepapers I've read indicate that when on a single server, the combination is slower. In any case, Tomcat is supposed to cache small files - the data start-time seen in the example (90+ seconds) is more than just HTTP throughput, surely? –  Mikaveli Mar 7 '11 at 17:04
    
I want to make sure if you have verified with an apache in the front. In my experience found that apache was much more efficient for static content. –  Vinod R Mar 7 '11 at 17:25

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.