Spring Boot - Limit on number of connections created

后端 未结 5 1179
轮回少年
轮回少年 2020-12-12 23:43

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 maximu

5条回答
  •  庸人自扰
    2020-12-13 00:21

    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

提交回复
热议问题