~/talk

StructuredTaskScope And ScopedValue - Get The Most Out of Virtual Threads

Talkat Voxxed Days Ticino 2025 · 2025-01-16..01-17· [java]
slides:none on file

Demonstrates using Java 21 virtual threads plus two Java preview features StructuredTaskScope and ScopedValue to convert an empty Spring Boot app (tested on Spring Boot 3.3 / Java 23) into a concurrent web service. Live code shows enabling spring.threads.virtual.enabled, JMeter with 1,000 concurrent users and a 200-thread pool (responses rose to ~4–5s); switching to virtual threads cuts simple calls to ~1s. Adding StructuredTaskScope runs three info calls concurrently (2.5s → ~1.5s), nesting scopes to parallelize talk and infos reaches ~1s. Explains thread locals fail across virtual-thread subtasks while scoped values are read-only and inherited by child scopes.

AI-written summary · about

  1. 0:00Introduction
  2. 1:46Virtual threads matter
  3. 6:02Virtual threads demo
  4. 11:17Limitations of virtual threads
  5. 16:56Structured concurrency
  6. 22:20Custom task scopes
  7. 27:42Sealed interfaces with scopes
  8. 31:11Thread locals vs scoped values
  9. 38:55Recap
  10. 39:37Q&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.