Consultor Eletrônico



Kbase P7895: Why do I see so many Java processes on Linux?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   11/01/2010
Status: Verified

GOAL:

Why do I see so many Java processes on Linux?

GOAL:

Why there is such a large number of Java process spawned on a Linux system ?

FACT(s) (Environment):

Linux Intel
OpenEdge 10.x
OpenEdge Explorer
OpenEdge Management

FIX:

In Java release on Linux, the Hotspot virtual machine uses system threads to implement java threads. Because Linux threads are implemented as a cloned process, each Java thread shows up in the process table if you run the ps command. This is normal behavior on Linux.

For the Progress AdminServer product, depending on what you have installed, the thread count in AdminServer can vary. With this simplest configuration, there are 16 threads already in the jvm. If Fathom is installed on top of it, the thread count for AdminServer will jump to 30+. The additional threads are created in the Fathom plugin. On Linux, each Java "thread" is actually a process. Since the ubroker uses threads extensively, this would result in many processes on Linux.
Following algorithm can be used to estimate the number of threads (Java processes) on Linux used by a ubroker:


for each server 3 threads
for each concurrent client connection 1 thread
NameServer interface 1 thread
RMI interface 1 thread
auto-trim watchdog 1 thread
main thread 1 thread
When the AdminServer starts a database it creates an instance of ProcessReader to monitor the output of each database process started. Basically each thread is in a blocking read looking for output from the process. If it gets output, it examines it to determine if it is an error message and if so generates an event so the error can be handled. The purpose of this is to be able to detect error messages when starting a a database process. The problem is that these threads never go away. The stick around even if the process has successfully started. The impact on thread count can be huge. If your DB is running with auxilary process (AI, BI, APW, WDOG, ...), its very easy to get 5 or more process started for the database. That results in 5 or more instances of ProcessReader. If you are starting 30 databases thats 150 or more threads just to monitor the output of these processes.