@@ -64,13 +64,15 @@ cache.evict.secret-key=1234
6464async.enabled =true
6565# according to the springboot source,
6666# https://github.com/spring-projects/spring-boot/blob/master/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/task/TaskExecutorBuilder.java#L279
67- # the default implementation uses ThreadPoolTaskExecutor under the hood. Thus, create one that mimics a bit the newCacheTheadPool:
68- # have a long keep alive (so threads are reused), set limits to the number of threads/tasks (to ensure we don't run out of memory),
69- # and ensure we wait for the threads to finish before shutdown.
70- spring.task.execution.pool.core-size =1
67+ # the default implementation uses ThreadPoolTaskExecutor under the hood. See the ThreadPoolTaskExecutor documentation.
68+ # Main idea: when a task is submitted, the executor will first try to use a free thread if the number of active threads is
69+ # currently less than the core size. If the core size has been reached, then the task will be added to the queue as long as
70+ # its capacity has not yet been reached. Only then, if the queue's capacity has been reached, will the executor create a
71+ # new thread beyond the core size. If the max size has also been reached, then the calling thread will handle the task (CallerRuns policy).
72+ spring.task.execution.pool.core-size =2
7173spring.task.execution.pool.max-size =20
7274spring.task.execution.pool.keep-alive =120s
73- spring.task.execution.pool.queue-capacity =1000
75+ spring.task.execution.pool.queue-capacity =10
7476spring.task.execution.shutdown.await-termination =true
7577spring.task.execution.shutdown.await-termination-period =5m
7678spring.task.execution.thread-name-prefix =async-executor-
0 commit comments