2

what is the maximum corepoolsize,maxpoolsize ,queuecapacity can we allocate in java spring boot framework.i am working n corporate which in need to handle more thread requests. i have to increase thread performance.The existing one is with default values.

public Executor asyncExecutor() {
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(corePoolSize);
    executor.setMaxPoolSize(maxPoolSize);
    executor.setQueueCapacity(queueCapacity);
    return executor;
}
Gunasekari
  • 21
  • 2
  • 1
    There is a good article about the numbers: https://engineering.zalando.com/posts/2019/04/how-to-set-an-ideal-thread-pool-size.html – Simon Martinelli Jul 27 '21 at 09:56
  • Increasing threads might even slow down your application. Creating/adding more threads isn't the solution. Depending on your processor etc. it might even make things worse. Also if you need to increase request throughput messing about with a `ThreadPoolTaskExecutor` isn't going to help (unless you use this one for async servlet API processing). – M. Deinum Jul 27 '21 at 10:41

1 Answers1

0

The default configuration of core pool size is 1, max pool size and queue capacity as 2147483647.

Gunasekari
  • 21
  • 2