Skip to content

Using JDK21 virtual threads as compute pool #3926

Description

@jacum

Dear maintainers,

May I bother you with a question?

I did some research recently
https://jacum.medium.com/running-cats-effect-on-virtual-threads-of-jdk21-7a68ea97fd65
TLDR:
The current way of dealing with occasional blocking contexts in Cats Effect is sub-optimal, when compared to native fiber scheduling implemented on JDK21.

Of course - JDK21 is still fresh, and may not (yet) available for all and every JVM workload, but it is clearly very efficient. It is also next LTS after JDK 17, and likely will be most widely used one in a year or two.

I wonder what is your take on the future of the runtime on JDK21?

Is the whole runtime going to be replaced to thread-per-runnable?

Or just maybe rewrite blockOn() method

override def blockOn[T](thunk: => T)(implicit permission: CanAwait): T = {

to run that 'thunk' on Executors.newVirtualThreadPerTaskExecutor() and leave the rest of non-blocking executor to use the same Thread API?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions