avaje-http icon indicating copy to clipboard operation
avaje-http copied to clipboard

[Http-Client] Use virtual thread executor by default

Open SentryMan opened this issue 1 year ago • 6 comments

When on JDK 21+, the builder will default to the VirtualThreadPerTask Executor for the underlying HttpClient.

SentryMan avatar Jun 02 '24 17:06 SentryMan

Did someone request this change or do we just think it's a good idea?

rob-bygrave avatar Jun 05 '24 02:06 rob-bygrave

I just think it's cool

SentryMan avatar Jun 05 '24 02:06 SentryMan

@rbygrave yea or nay?

SentryMan avatar Sep 06 '24 21:09 SentryMan

yea or nay?

As I see it, this looks like a good idea but I'm not quite 100% sure myself. So I'm sitting on the fence waiting for someone to hit a use case where they want this as the default. I guess the JDK HttpClient has to be more conservative which is perhaps why this isn't the default in the JDK.

If we merge this so that it becomes the default behaviour then it is hard to "undo" that in that doing so would be a "silent regression" type of change.

In this sense we need to be 100% sure when/if we merge this. For myself I'm not quite 100% yet. Can we keep this on hold for now?

rbygrave avatar Sep 07 '24 21:09 rbygrave

I'm hearing nay (at least for now)

SentryMan avatar Sep 07 '24 22:09 SentryMan

Ok, but if we leave the PR open ... then other people can see it and add a comment. If we delete the PR it's now really unlikely to happen?

[My preference was to keep the PR open]

rbygrave avatar Sep 07 '24 22:09 rbygrave

Maybe best to wait until JEP 491 gets merged

re-thc avatar Oct 08 '24 10:10 re-thc

Maybe best to wait until JEP 491 gets merged

I mean the current implementation of HTTP client doesn't use synchronized anyways

SentryMan avatar Oct 13 '24 18:10 SentryMan

Ok, I'm thinking maybe we should merge this in with the thinking that this should be a reasonable default in a Java 21+ world.

That is, bump the next released version to 3.0 and merge this in.

rbygrave avatar Dec 03 '24 08:12 rbygrave