File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes Tomcat spawns many new processes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat spawns many new processes" Watch "Tomcat spawns many new processes" New topic

Tomcat spawns many new processes

Steven Lister

Joined: Nov 15, 2004
Posts: 3
I want to state off the top that I didnt develop the application. I have been slowly bringing the server and application up to some respecitablity. I have upgraded the Java to 1.4.2 (it was at 1.3.2) and added Apache/Mod_jk2 and upgraded to Tomcat 5. What I am about to describe has been happening since I took the project over. I start the application and there are 41 processes that are present when I do a ps -aef, later on there are 15 more, a little later there are 10, for a total of 66. This grows and I cant tell if it shrinks. There is also a watcher application that starts and restarts Tomcat processes if it can not connect to the application.

Okay enough of that. I have a test server I setup myself, and have done all the same stuff on, Apache/Tomcat/Mod_jk. However when I start up there is one one process that starts. When I hit it with some load, it stays the same, one process.

Also in JAVA_OPTS i have seen many people referring to -server, I have set the JAVA_OPTS to headless.

Any help, or pointers about TOmcat and servers would be appreciated.
Scott Dunbar
Ranch Hand

Joined: Sep 23, 2004
Posts: 245
On Linux, especially the older 2.4 based kernels, threads == processes. Therefore, whenever Tomcat spawns a new thread your 'ps' will show a new process. As with all servlet containers it is up to Tomcat when to reap those threads. It may not - and that is why you see that the number of processes is growing.

Unless you're getting several hundred I wouldn't be concerned about it.

<a href="" target="_blank" rel="nofollow">Java forums using Java software</a> - Come and help get them started.
Steven Lister

Joined: Nov 15, 2004
Posts: 3
Okay thats what I thought. The way I was thinking of handling this, is something that I have done on other sites that are older and had some problems with clearing out and that is to restart the application occasionally, 2-3 times a week.

Think that would be a good idea.
I agree. Here's the link:
subject: Tomcat spawns many new processes
It's not a secret anymore!