~/talk

The Good, The Bad, and the Ugly: A Journey from this synchronized to Asynchronous Code

Talkat Scala Days 2023 Madrid · 2023-09-12..09-14· [concurrency, scala]
slides:none on file

A legacy Scala blockchain codebase with pervasive synchronized blocks and deadlocks is refactored incrementally into functional async using cats-effect 2 -> cats-effect 3, migrating synchronous locks to IO/Resource/Ref/fibers/supervisor patterns and separating CPU, blocking and sync thread pools. Context-shift gymnastics disappear, blocking ops hop to an internal pool, and graceful shutdown uses supervisors. Results: deadlocks vanish, average CPU drops from 20% → 2–3%, and the pipeline handles up to 80k tx/s in testing.

AI-written summary · about

  1. 0:00Journey introduction
  2. 1:15Blockchain project challenge
  3. 4:04Synchronized code nightmare
  4. 6:13Synchronized swamp
  5. 8:01Manual sync fails
  6. 10:09Cats Effect IO
  7. 12:22Concurrency vs parallelism
  8. 14:49Shared resources safely
  9. 17:23Thread-safe state with Ref
  10. 20:19Fibers in Cats Effect
  11. 23:15Threadpool juggling
  12. 25:46Thread pool assignment
  13. 27:11Year-long threadpool struggle
  14. 27:55Refactoring tangled code
  15. 28:59Cats Effect 3 shift
  16. 31:25Fire-and-forget tasks
  17. 32:54Supervisors for fibers
  18. 33:58Remarkable efficiency
~/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.