Spring Boot – Limit on number of connections created

This setting is derived from the embedded container (tomcat, jetty…).

Tomcat’s number of threads

You may specify this property in your application.properties

server.tomcat.max-threads=400

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:

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.

Also, the property for:

  • undertow: server.undertow.worker-threads

  • jetty: server.jetty.acceptors

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

Leave a Comment