Skip to content
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

Migrate to JDK 11 client or AHC5 #246

Open
berezovskyi opened this issue Feb 12, 2022 · 2 comments
Open

Migrate to JDK 11 client or AHC5 #246

berezovskyi opened this issue Feb 12, 2022 · 2 comments

Comments

@berezovskyi
Copy link
Member

https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpClient.html

Add support for HTTP2 and eliminates an unnecessary dependency.

@berezovskyi
Copy link
Member Author

berezovskyi commented Feb 19, 2022

I am pretty sure we won't get it into Lyo 5.x (also for the purpose of not introducing more breaking incompatibilities) but here is some info I have been collecting:

Alternatively, we should consider migrating from AHC 4.5 to AHC 5.0. AHC5 supports HTTP2 and there is a 4.5 to 5 migration guide with performance in mind. Feature comparison: https://www.mocklab.io/blog/which-java-http-client-should-i-use-in-2020/. AHC5 seems to win in every way except for the WebSocket support. I think that this is where we can use JDK 11 client as the communication modes are sufficiently different for HTTP req/resp and WebSocket: https://usoar.es/posts/consuming-websocket-with-java-http-client/.

More important could be to shift towards a more complex async model. We can safely make at least 6 requests to a server in parallel, IE8 in 2009 had such a limit. This is already logged as LYO-169.

@berezovskyi berezovskyi changed the title Migrate to JDK 11 client Migrate to JDK 11 client or AHC5 Feb 20, 2022
@berezovskyi
Copy link
Member Author

Interesting discussion on https://forum.open-services.net/t/rmsample-connectionclosedexception-exception/651/5:

  1. Properly consuming responses is not a solved problem yet, migrating to Jakarta Restful-WS 2.1 would allow us to use try-with-resources in Java, which is less error-prone.
  2. AsyncHttpClient from the comparison above is not going to support HTTP/2 ever as its semi-abandoned.
  3. Java new default client also doesn't support HTTP forms requests, which we sadly need due to Jazz forms auth. Maybe not a big deal but adds to the lack of OOB compression support.

I'd say it leaves us with AHC 5 or OkHttp. OkHttp has Android support while I suspect that our AHC 4 code will be easier to migrate to AHC 5. I therefore think we should zero in on AHC 5 (with async in mind due to how spectacular #169 is with 50+ rps on a slow laptop against an OSLC adaptor with no perf tuning whatsoever).

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

No branches or pull requests

1 participant