~/talk

StructuredTaskScope And ScopedValue - Get The Most Out of Virtual Threads

Talkat Voxxed Days Zürich 2025 · on Tuesday, 2025-03-25· [java]
links:none on file
slides:none on file

Live-coding builds a Spring Boot demo that swaps blocking REST calls for virtual threads plus StructuredTaskScope and ScopedValue (both in third preview), showing how to fork/join virtual-thread subtasks, extend StructuredTaskScope for aggregation, and replace ThreadLocal with ScopedValue so child scopes see values. Under JMeter with 1,000 concurrent users the demo drops median latency from about 2.5 seconds to 1 second by parallelizing IO; ThreadLocal becomes null inside child virtual threads while ScopedValue retains the header.

AI-written summary · about

  1. 0:00Introduction
  2. 1:26Virtual threads overview
  3. 6:20Fixing performance
  4. 10:52StructuredTaskScope intro
  5. 16:36Replacing reactive code
  6. 21:37Cleaner code with StructuredTaskScope
  7. 24:46Concurrent tasks
  8. 27:57Benchmarking performance
  9. 29:00Key benefits
  10. 30:26ScopedValues vs ThreadLocals
  11. 36:04When to use ScopedValues
  12. 39:14Recap
  13. 39:56Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.