Home > Software engineering >  spring boot how to see thread pool size default value
spring boot how to see thread pool size default value

Time:12-27

I have a spring boot application using @EnabledAsync and @Async annotations, not defining any thread pool and taking the default values.

Cheking some metrics on Grafana, it seems thread count never stop increasing and EC2 instance eventually crashes.

I know I could define thread pool size and all those values but first I'd like to know what values spring boot is using. Is there a way to see them from the code? like getThreafPoolSize() or something like that?

I tried with debug=true in property file but I couldn't see those values. Any idea?

CodePudding user response:

You can find the default behavior in the ThreadPoolTaskExecutor class of the Spring Framework.

The maximum thread pool size within the class is defined as follows.

private int corePoolSize = 1;

private int maxPoolSize = Integer.MAX_VALUE;

private int keepAliveSeconds = 60;

ThreadPoolTaskExecutor details can be found here.

  • Related