I developed a microservice using Spring Boot. I was performance testing the service by stubbing the backend calls. When I looked at the thread count , I see that the maximum number of threads that created to the service is 20 at any point in time even though the number of calls made is much higher. Are there any limitations with respect to number of calls that can be made to a microservice developed using Spring Boot. Please can you guide in what steps I need to follow to troubleshoot / increase the number of connections accepted by the service?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Tomcat - maxThreads vs maxConnections
Try to set
maxConnections
property to be more than 10000.From the doc:
There is a properties for spring boot, tomcat max-connection, which needs to be set in application.properties file
More info visit here , here and here
This setting is derived from the embedded container (tomcat, jetty...).
Tomcat's number of threads
You may specify this property in your application.properties
You say you counted 20 threads, however according to this other stackoverflow question/answer, the default number of thread should be 200 with tomcat, since server.tomcat.max-threads's default value is 0. See tomcat's documentation:
Also, the property for:
undertow:
server.undertow.worker-threads
jetty:
server.jetty.acceptors
You'll find the list of properties in Spring's documentation
While the accepted answer is very useful, I recently experienced what I believe to be the same problem as the original poster. This is the only search result I could find that directly correlated with my experience, so I thought I'd add my solution in case it helps someone.
In my case, the observed concurrency limit of 20 was imposed by the default setting of 20 for the
maxConcurrentStreamExecution
property inorg.apache.coyote.http2.Http2Protocol
.If you're experiencing this problem and you're using HTTP/2, there's a good chance that increasing
maxConcurrentStreamExecution
will help.You can find more info in the Tomcat Configuration Reference, which actually states that this should be set to 200 by default (not 20). You can definitely see the default setting of 20 in
org.apache.coyote.http2.Http2Protocol
, though, so I'm not sure if this is a typo or just something that presents itself differently in the embedded version of Tomcat.Increase
maxConcurrentStreamExecution
(set 200) for HTTP/2 in Spring Boot 2: