Java 21의 Virtual Threads 소개 [48p 슬라이드]
(drive.google.com)- Virtual Threads 개요
- Virtual Threads (Loom project) 란
- Platform Threads vs Virtual Threads - Blocking ?
- Platform Threads 작동 방식
- Virtual Threads 작동 방식
- Rules & Best practices
- Rule 1 - Create Threads
- Rule 2 - Do Not use CompletableFuture
- Rule 2 - Do use Virtual Threads
- Rule 3 - Do not use Thread Pool
- Rule 3 - Do use newThreadPerTaskExecutor
- Rule 4 - Do not use FixedThreadPool for concurrency
- Rule 4 - Do use Semaphore for Concurrency
- Rule 5 - Do use ScopedValue
- Rule 6 - Do use ReentranceLock instead of synchronized
- Rule 7 - Do Structured Concurrency
- Rule 8 - Test Virtual Threads
- Spring Boot with Virtual Threads
- Spring Boot MVC with Virtual Threads
- Spring Boot MVC Async Tasks
- RestController use Virtual Threads
- Legacy Code 변경
- 기존 시스템에 Virtual Threads 적용하기
Jdk24에서 synchronized가 더이상 pinning을 발생시키지 않도록 수정되어서 rule 6도 다음 LTS 쯤에는 필요없을겁니다.
Scoped Value, Structured Concurrency는 아직 "미리 보기" 단계라서 Virtual Thread가 상용화되기까진 좀 오래 걸릴 것 같습니다.