Punter Vicky Punter Vicky - 11 months ago 357
Java Question

Spring Boot - Limit on number of connections created

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?

Answer Source

I believe this setting is derived from the embedded container (tomcat, jetty...).

For tomcat, you may specify this 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. and tomcat's documentation:

The maximum number of request processing threads to be created by this Connector, which therefore determines the maximum number of simultaneous requests that can be handled. If not specified, this attribute is set to 200. If an executor is associated with this connector, this attribute is ignored as the connector will execute tasks using the executor rather than an internal thread pool.

For undertow: server.undertow.worker-threads

For jetty: server.jetty.acceptors

You'll find the list of properties in Spring's documentation