Files
llm-wiki/raw/official-docs/spring-boot-task-execution-scheduling-reference.md

7.6 KiB

title, source_type, url, archive_url, related_branches, related_projects, tags, created
title source_type url archive_url related_branches related_projects tags created
Spring Boot Task Execution and Scheduling — Official Reference official-doc https://docs.spring.io/spring-boot/reference/features/task-execution-and-scheduling.html
feature-background-job-async-contract
ca-skeleton
official-doc
ca-skeleton
application
spring-boot
virtual-threads
2026-06-11

Spring Boot Task Execution and Scheduling — Official Reference

Layer: raw/ — Spring Boot 공식 레퍼런스의 Task Execution and Scheduling 섹션 원문 발췌. 검증된 요약은 /ingestwiki/concepts/source-summary-template 형식으로 별도 작성.

Parent / 활용 branch

Branch 이 자료가 정당화하는 결정
raw/branch-notes/feature-background-job-async-contract D7 — Spring Boot auto-configured executor 기본값(8 core threads, queue 무제한 → max 미발동)과 bounded queue 설정 시 max pool 이 발동하는 공식 근거; virtual threads 대안(spring.threads.virtual.enabled=true) 존재 확인

출처 / Source

왜 저장했는지 / Why archived

Spring Boot 의 ThreadPoolTaskExecutor auto-configuration 기본값(8 core threads, unbounded queue)과 bounded queue 로 전환했을 때 max pool 이 발동하는 동작을 공식 문서가 명시하고 있기 때문. feature-background-job-async-contract 의 D7(executor pool sizing) 이 UNSUPPORTED_DECISION 상태이며, 본 자료가 그 결정의 공식 대비 근거 및 virtual threads 대안 존재를 제공한다.

핵심 인용 / Key quotes (verbatim)

[§Default ThreadPoolTaskExecutor Settings] "8 core threads that grow and shrink according to load"

[§Default ThreadPoolTaskExecutor Settings] "Unbounded queue by default"

[§Customizing Thread Pool Configuration] "This example creates a bounded queue (100 tasks) that triggers scaling to a maximum of 16 threads when full, with more aggressive shrinking (threads reclaimed after 10 seconds idle)."

[§Auto-Configuration Overview] "With Virtual Threads (Java 21+ and spring.threads.virtual.enabled=true): Uses SimpleAsyncTaskExecutor with virtual threads"

[§Auto-Configured Scheduler] "Without Virtual Threads: ThreadPoolTaskScheduler with 1 thread default"

Claims Extracted / 추출된 주장

Claim ID Claim (이 자료가 직접 말하는 것) Evidence quote Strength Applies to Does not prove
SB-TASK-C1 Spring Boot auto-configured ThreadPoolTaskExecutor 는 기본적으로 8개 core thread 를 사용하며 부하에 따라 증가·감소한다 [§Default ThreadPoolTaskExecutor Settings] "8 core threads that grow and shrink according to load" official-vendor-doc Spring Boot auto-configuration (별도 Executor bean 미정의 시) 특정 부하 프로파일에서 8이 최적이라는 주장; Executor bean 커스텀 시에도 이 기본값이 유지된다는 것
SB-TASK-C2 auto-configured executor 의 기본 queue 는 무제한(unbounded)이며, 이로 인해 max-size 설정이 있어도 queue 가 차지 않으면 max pool 이 발동하지 않는다 [§Default ThreadPoolTaskExecutor Settings] "Unbounded queue by default" official-vendor-doc Spring Boot auto-configuration 기본 동작 unbounded queue 가 항상 문제라는 것; 모든 Spring Boot 버전에서 동일 기본값을 유지한다는 것
SB-TASK-C3 queue-capacity 를 bounded 로 설정하면 queue 가 가득 찼을 때 thread pool 이 max-size 까지 확장된다 [§Customizing Thread Pool Configuration] "This example creates a bounded queue (100 tasks) that triggers scaling to a maximum of 16 threads when full, with more aggressive shrinking (threads reclaimed after 10 seconds idle)." official-vendor-doc spring.task.execution.pool.queue-capacity 를 명시적으로 설정한 경우 최적 queue-capacity 수치; rejection policy 기본값(AbortPolicy/CallerRunsPolicy) 어느 쪽이 기본인지
SB-TASK-C4 Java 21+ 환경에서 spring.threads.virtual.enabled=true 설정 시 auto-configured executor 가 SimpleAsyncTaskExecutor (virtual threads) 로 교체된다 [§Auto-Configuration Overview] "With Virtual Threads (Java 21+ and spring.threads.virtual.enabled=true): Uses SimpleAsyncTaskExecutor with virtual threads" official-vendor-doc Java 21+, Spring Boot virtual threads 지원 버전 virtual threads 가 ThreadPoolTaskExecutor 대비 항상 더 낫다는 것; 모든 blocking I/O 케이스에서 동일 효과를 보인다는 것
SB-TASK-C5 scheduling(@EnableScheduling) 의 auto-configured scheduler 는 virtual threads 미사용 시 ThreadPoolTaskScheduler 단일 스레드(1 thread)가 기본이다 [§Auto-Configured Scheduler] "Without Virtual Threads: ThreadPoolTaskScheduler with 1 thread default" official-vendor-doc @EnableScheduling + Spring Boot auto-configuration scheduler pool 을 늘릴 경우의 동작 보장; 여러 @Scheduled 메서드가 동시에 실행될 수 있는 조건

Strength 허용값 적용 근거

본 자료는 Spring 공식 레퍼런스 문서이므로 official-vendor-doc 적용.

Usage Boundaries / 적용 경계

  • 이 자료가 직접 증명하는 것:
    • SB-TASK-C1·C2: Spring Boot auto-config 기본값이 "8 core / unbounded queue" 임을 공식 문서가 명시.
    • SB-TASK-C3: bounded queue 설정 시 max pool 발동 메커니즘을 공식 문서 예시가 직접 설명.
    • SB-TASK-C4: virtual threads 전환 설정 키(spring.threads.virtual.enabled=true)와 효과를 공식 문서가 명시.
    • SB-TASK-C5: scheduler 기본 1 thread 를 공식 문서가 명시.
  • 이 자료가 증명하지 않는 것:
    • feature-background-job-async-contract D7 의 core=10, max=50, queue=200 정량값이 최적임을 증명하지 않는다 (해당 수치는 D7 에서 UNSUPPORTED_DECISION 상태 유지).
    • rejection policy(AbortPolicy vs CallerRunsPolicy)의 기본값이 무엇인지 이 자료에서 직접 명시하지 않는다.
    • 특정 부하 프로파일에서 어떤 설정값이 적합한지 증명하지 않는다.
  • 내 프로젝트(ca-skeleton)에 적용하려면 추가 확인이 필요한 것:
    • SB-TASK-C3 를 근거로 bounded queue 채택 시 rejection policy 기본값 확인 필요 (ThreadPoolTaskExecutor JavaDoc 또는 Spring source).
    • SB-TASK-C4 적용 시 Java 21+ 런타임 전제가 ca-skeleton 배포 환경에서 충족되는지 확인 필요.
    • SB-TASK-C5 scheduler 단일 thread 기본값이 ca-skeleton 의 scheduled job overlap 요구사항과 충돌하는지 검토 필요.

메모 / Notes

  • D7 의 core=10, max=50, queue=200 는 본 자료가 제공하지 않는 수치 — 별도 load-test 근거 또는 ThreadPoolTaskExecutor 공식 doc 의 정량 권고가 있어야 UNSUPPORTED_DECISION 탈출 가능.
  • virtual threads 대안(SB-TASK-C4)은 D7 의 pool sizing 문제를 우회하는 선택지로 검토 가능하나, Java 21+ 전제 확인 필요.
  • 추가로 봐야 할 동일 출처 페이지: Spring ThreadPoolTaskExecutor JavaDoc, TaskDecorator Javadoc (D5·D6 미지원 claim 근거용).