0

I have deployed a pretty big application that is used all across the country (Canada), meaning lots of concurrent connections.

Recently we have reached the maximum amount of concurrent threads as our jBoss was configured to 40 maximum threads. Now it is 250 so we are fine.

Every now and then I am looking at the Tomcat status page, and I see threads to javascript files, css files, struts (java) actions, etc.

How could a thread on a javascript or css file be alive for my than a few seconds? I thought the thread was only during the page load (when the client downloads the javascript file to cache). Am I right?

Example entry

Stage: S
Time: 1127110823 ms
B Sent: 0 KB
B Recv: 0 KB
Client: client's ip address...
VHost: server's vhost...
Request: GET /que/2715/jsp/common/js/jquery/jquery.maskedinput.js HTTP/1.1 

This one is always here.. I don't understand why...

I would like to understand all these information and then change the way I code in order to free up some current threads.

Thank you for help

Charles

Charles Morin
  • 1,449
  • 4
  • 32
  • 50

1 Answers1

2

A misbehaving HTTP client may not be ack'ing your TCP packets, even for very small files, and Tomcat is waiting for the acks because it doesn't want to close the connection until it is sure the client got all the info. Check the timeout values for your HTTP Connectors in server.xml (especially connectionTimeout) and make sure they are not set to very large values or -1 (wait infinitely).

See http://tomcat.apache.org/tomcat-7.0-doc/config/http.html for more info on timeout settings in the configuration.

 -Larry
lreeder
  • 12,047
  • 2
  • 56
  • 65
  • None of the server.xml timeouts affect this behaviour. What you describe is done by the TCP stack, not by Tomcat. – user207421 May 28 '13 at 21:39
  • Looks like the environment where we are hosted uses mod_jk in front of jBoss. See: http://1.bp.blogspot.com/_y8SmAu6cJZ4/TTpexxSN10I/AAAAAAAAAH4/lYekuJOxwMQ/s1600/Tomcat-cluster-diagram.png – Charles Morin May 29 '13 at 12:28
  • The thing is that we were not having that kind of problem before on our Windows environment (jBoss running as a service on Windows, using the HTTP protocol directly). Is there any configuration that could be done to solve that problem on the new environment (apache & mod_jk)? Thanks for help – Charles Morin May 29 '13 at 12:31
  • @EJP - Recent versions of tomcat have several timeout options (e.g., keep alive and connection timeouts) which may not allow you control over the lower level TCP behavior, but is good enough to close hanging connections. – lreeder May 29 '13 at 18:35
  • @CharleyDC5 - I'm not a mod_jk expert, but reviewing the docs, it appears like there may be a few cases that would have the symptoms you describe, in particular if there is a firewall between mod_jk and Tomcat. See http://tomcat.apache.org/connectors-doc/generic_howto/timeouts.html for the JK connector docs and see if you can get more information from your hosting service. – lreeder May 29 '13 at 19:40