A JVM will have a single process, and the process identification number (PID) can be found using the ps command (Linux). A process will contain numerous threads. Some examples of threads are the JVMs garbage collector, a code optimizer thread, and a finalizer thread. Every task carried out by the JVM is done in a thread.
ps -ef | grep jvm_name
A WebSphere JVM has pools for threads, appropriately called thread pools.
- In the left panel of the WebSphere admin console, select Servers > Server types.
- Select a JVM.
- Select Thread pools.
The thread pools that are created when the JVM was created will be displayed, as well as the minimum and maximum number of threads that can be active in the thread pool. Once the minimum has been reached, the pool will never drop below the minimum, even if threads are idle. The reason there is a minimum is because the creation and destruction of a thread uses resources (memory, CPU), thus it is less resource intensive to reuse a thread than it is to create a new thread.
The three the most commonly used thread pools are:
- Web container - Used for HTTP requests.
- ORB - Used for RMI/IIOP requests for an enterprise bean
- Default - Used for a message driven bean or if a transport chain has not been defined in a different thread pool.
Thread Inactivity Timeout
Thread inactivity timeout is the number of milliseconds that should elapse before an active thread is ended. If you want to disable the inactivity timeout, so that threads never time out, you would enter a negative value, such as -1. You cannot enter a negative value in the WebSphere admin console. Instead, you would need to enter the negative value in server.xml. Disabling the timeout is usually ill advised, as this is usually a waste of resources (CPU, memory) and would eventually result in all of the available threads being used.
The Tivoli Performance Monitor can be used to view the number of threads being used in a pool.
- In the left panel of the WebSphere admin console, select Monitoring and Tuning > Performance Viewer > Current activity.
- Select a JVM
- Expand JVM > Summary Reports > Thread Pool.
In this example, the TCPChannel.DCS pool has 20 threads, which matches the minimum:maximum size for the TCPChannel.DCS pool.