Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maximum (client request) thread pool size in spring

I am developing application server using spring boot app but now I want to know what is the default maximum (client request) thread pool size in spring and how can I customize that value?

like image 679
sagar Avatar asked Aug 20 '14 07:08

sagar


People also ask

What is the max thread pool size?

Starting thread pool size is 1, core pool size is 5, max pool size is 10 and the queue is 100. As requests come in, threads will be created up to 5 and then tasks will be added to the queue until it reaches 100. When the queue is full new threads will be created up to maxPoolSize .

How do I limit the number of threads in spring boot?

Maximum number of threads in Spring Boot Application If you are using Tomcat as your embedded server (default), then you can use the property server. tomcat. max-threads to control how many threads you want to allow. This is set to 0 by default which means- use the Tomcat default which is 200 .

How does spring boot handle 1000 requests per second?

To handle high traffic, you should setup Load Balancer with multiple node/instances. Better to go with Auto Scaling on Cloud server. It will increase the instances as per high load (number or request) and again decrease the instances when there will be low number of requests. Which is cost effective.


1 Answers

Assuming that you're using embedded Tomcat, Spring Boot uses the server.tomcat.max-threads property to control the size of the client request thread pool. Its default value is zero which leaves Tomcat to use its default of 200.

To customise the size of this thread pool you should specify a non-zero value for the server.tomcat.max-threads property in your application.properties or application.yml file.

like image 63
Andy Wilkinson Avatar answered Oct 11 '22 14:10

Andy Wilkinson