-
Notifications
You must be signed in to change notification settings - Fork 895
JettyClientEngine: elide buffering #3418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JettyClientEngine: elide buffering #3418
Conversation
e02b194 to
aba979a
Compare
|
Just an FYI, this is not being ignored. I've just been away at meetings all week so I likely won't have time to look at this until next week. |
|
No rush! We haven't observed any problems with the new code yet, but will continue testing. |
|
@jamezp anything I can do to help this get reviewed? :) |
|
@stevenschlansker Sorry, the last two weeks got away from me. I'm out of the office tomorrow, but I'll try to have a look on Monday. |
|
Hello, stevenschlansker. I'm waiting for one of the admins to verify this patch with /ok-to-test in a comment. |
...ent-jetty/src/main/java/org/jboss/resteasy/client/jaxrs/engines/jetty/JettyClientEngine.java
Outdated
Show resolved
Hide resolved
...ent-jetty/src/main/java/org/jboss/resteasy/client/jaxrs/engines/jetty/JettyClientEngine.java
Show resolved
Hide resolved
...ent-jetty/src/main/java/org/jboss/resteasy/client/jaxrs/engines/jetty/JettyClientEngine.java
Show resolved
Hide resolved
...ent-jetty/src/main/java/org/jboss/resteasy/client/jaxrs/engines/jetty/JettyClientEngine.java
Show resolved
Hide resolved
c22d475 to
84750cc
Compare
|
Ok thanks for the review @jamezp , I have addressed your feedback. The try-with-resources is a bit odd style since I wanted to make sure to catch any exception thrown by I'll build this and start testing the new version internally. I doubt it'll be any different, but you never know... |
62a44f6 to
f41d22a
Compare
f41d22a to
50b8cf6
Compare
|
I don't understand the Javadoc failure, probably not related to this change? |
50b8cf6 to
8498ad0
Compare
|
The JavaDoc issue isn't related to this PR. It's also an issue on main. The other two timeouts might be. I'm looking into that part now. |
|
@stevenschlansker One last request, If you could squash the commits and prefix the commit message with |
8498ad0 to
591a230
Compare
|
thanks @jamezp , I reworded and squished the commits. |
|
I think these tests keep timing out because of how some kind of network download slowdown. |
|
Awesome, thank you! |
As originally implemented, the JettyClientEngine could not extract responses without buffering the entire response body, since the MessageBodyReader is sync only. Now, RESTEasy has an asynchronous Executor available to the engine.
So, instead of buffering the full response, let's push the body reader to the async executor pool and feed it content as it becomes available. This should play well with the upcoming virtual threads support in the JVM. This also allows us to implement proper flow control: instead of buffering the whole response, we tell Jetty when we have consumed its buffers, so it will limit the amount of in-flight data.
As an added bonus, the request content send is restructured so the content is also streamed out without buffering the entire request body in a ByteArrayOutputStream.
In the best case, this should remove an entirely unnecessary byte[] copy of both request and response data.
I have completed some light testing and will continue to run the code over the coming days to make sure there's no obvious problems.