typelevel / cats-effect

The pure asynchronous runtime for Scala
https://typelevel.org/cats-effect/
Apache License 2.0
1.99k stars 512 forks source link

More efficient monitoring of fibers on virtual threads #4014

Open armanbilge opened 4 months ago

armanbilge commented 4 months ago

Spinning out of https://github.com/typelevel/cats-effect/issues/3929#issuecomment-1896382827.

We fixed the memory leak, but monitoring fibers on virtual threads still has a single point of contention.

djspiewak commented 3 months ago

In general this is going to be a difficult space for us. There are probably a ton of places where we assume the absolute number of threads is small while the number of fibers is large. I agree we should try to fix this issue, but we're probably going to be playing whack-a-mole a bit.

Overall, we should probably consider where along the spectrum from "ignoring virtual threads" to "we have a dedicated runtime and fiber implementation when we detect virtual thread support" we want to fall.