Datageek
Datageek

Reputation: 26729

Same Jetty code, different number of threads

We are running same Jetty service on two servers but are seeing different number of threads created by both services (50 vs ~100 threads).

Both servers are running identical Java code on RedHat5 (they do have slightly different kernels). Yet Jetty on one of the servers creates more threads than the other one. How is it possible?

Upvotes: 0

Views: 291

Answers (1)

Joakim Erdfelt
Joakim Erdfelt

Reputation: 49555

Thread counts are dynamic, depends on many many factors.

The number of threads that you see at any one point can vary greatly, based on hardware differences (number of cpu cores, number of network interfaces, etc), kernel differences, java differences, load differences, active user counts, active connection counts, transactions per second, if there are external dependencies (like databases), how async processing is done, how async I/O is done, use of http/2 vs http/1, use of websocket, and even ${jetty.base} configuration differences.

As for the counts you are seeing, 50 vs 100, that's positively tiny for a production server. Many production servers on moderately busy systems can use 500 (java) threads, and on very busy commodity systems its can be in the 5,000+ range. Even on specialized hardware (like an Azul systems devices) its not unheard of to be in the 90,000+ thread range with multiple active network interfaces.

Upvotes: 1

Related Questions