When i configure my embedded Tomcat server with the default settings:
server.tomcat.threads.max=200
And start sending 400 HTTP calls simultaneously with JMeter, I see logs with worker threads > 200.
"thread":"http-nio-8100-exec-16"
"thread":"http-nio-8100-exec-263"
"thread":"http-nio-8100-exec-207"
After reducing the configuration to 100
server.tomcat.threads.max=100
I still see logs of worker threads > 100
"thread":"http-nio-8100-exec-13"
"thread":"http-nio-8100-exec-173"
"thread":"http-nio-8100-exec-107"
Strangely, when i configure the maximum amount of threads somewhere between to 1-15, the limit is respected and only logs appear within the limit:
Setting it to 1:
"thread":"http-nio-8100-exec-1"
"thread":"http-nio-8100-exec-1"
"thread":"http-nio-8100-exec-1"
Setting it to 15:
"thread":"http-nio-8100-exec-2"
"thread":"http-nio-8100-exec-14"
"thread":"http-nio-8100-exec-9"
I have not tried to find the tipping point between 15-100.
Furthermore, when running with 100-200 threads, the only way the limit is respected, is by also decreasing the server.tomcat.max-connections from the default 8192 to something low like 25.
I have difficulty in understanding this behavior.
- Why is a very low thread number respected
- Why is the default thread amount (or even another high number like 100) not respected until (extremely) decreasing the server.tomcat.max-connections.
Java 17 running on 2 cores in Kubernetes with dependencies:
| +- org.springframework.boot:spring-boot-starter-web:jar:3.2.5:compile
| | +- org.springframework.boot:spring-boot-starter-tomcat:jar:3.2.5:compile
| | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:10.1.20:compile
| | | - org.apache.tomcat.embed:tomcat-embed-websocket:jar:10.1.20:compile