Why does Jetty consume more threads than specified in start.ini file?

Why does Jetty consume more threads than specified in start.ini file?

Problem Description:

I have my java spring application running inside Jetty 9.48.
These are the properties in start.ini file:

jetty.http.acceptors=30
# jetty.http.selectors=200

jetty.threadPool.minThreads=200
jetty.threadPool.maxThreads=1000
jetty.threadPool.idleTimeout=5000

jetty.http.host=0.0.0.0
jetty.http.port=8080
jetty.http.connectTimeout=2000
jetty.http.reuseAddress=true

jetty.lowresources.accepting=false

jetty.output.buffer.size=32768
jetty.httpConfig.outputAggregationSize=32768
jetty.httpConfig.requestHeaderSize=16384
jetty.httpConfig.responseHeaderSize=16384
jetty.httpConfig.sendServerVersion=false
jetty.httpConfig.sendDateHeader=false

jetty.server.stopAtShutdown=true
jetty.server.stopTimeout=5000
jetty.server.dumpAfterStart=false
jetty.server.dumpBeforeStop=false

jetty.deploy.scanInterval=0

jetty.console-capture.dir=/yyyy_mm_dd.stderrout.log
jetty.console-capture.retainDays=90
jetty.console-capture.timezone=UTC

jetty.debug.retainDays=90

When i run htop i see: "Tasks: 83, 3030 thr, 41 running".
And ps hUH p <JETTY PROCESS PID> | wc -l gives me 2876 jetty threads count.
Is it correct to compare these numbers with jetty.threadPool.maxThreads? If so, why maxThreads doesn’t limit number of threads? And why there is such a big gap between existing and running threads?

To be clear, i expect Jetty to consume less memory. I assumed that huge amount of threads can affect it. Because at the moment jetty consumes almost all available memory (120/125G) but OOM is never happens.
I may not understand some of the basic concepts, but I would be grateful if you could help me figure it out.

Solution – 1

Jetty 9.x is now at End of Community Support (soon to be End of Life)

See: https://github.com/eclipse/jetty.project/issues/7958


You are not paying attention to what those threads are.

Jetty threads will have a name that start with qtp.

All other threads are from things that are not Jetty.

Rate this post
We use cookies in order to give you the best possible experience on our website. By continuing to use this site, you agree to our use of cookies.
Accept
Reject