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

Feature request: Switch HTTP client library from Apache HttpClient 4.x to Apache HttpClient 5.x (or okhttp / etc...) #44

Closed
JellyBrick opened this issue Apr 25, 2022 · 7 comments

Comments

@JellyBrick
Copy link
Contributor

Apache HttpClient 5.x and okhttp (or ktor) support HTTP/2 (and asynchronous HTTP requests).

Switching to these libraries is expected to enable more efficient HTTP requests.

Migrate issue from sedmelluq/lavaplayer#652

@Walkyst
Copy link
Owner

Walkyst commented Apr 25, 2022

Feel free to do PR

@jocull
Copy link

jocull commented Mar 25, 2023

Is there a major benefit to doing this? Is the current version causing any problems?

@JellyBrick
Copy link
Contributor Author

JellyBrick commented Apr 8, 2023

@jocull

Is there a major benefit to doing this? Is the current version causing any problems?

HttpClient has the problem of being overly complex and requires writing tons of class implementation. This issue makes it difficult to resolve issues like #86.

In addition, HttpClient 4 does not support HTTP 2.0. This is not appropriate for lavaplayer where video streams need to be downloaded continuously.

@EncryptSL
Copy link

This need very great knowledge of changes between 4x and 5x.

@jocull
Copy link

jocull commented Apr 25, 2023

I did take a look at this there are two things worth noting:

  1. Many of the public interfaces accept specific configurations or builders and then seems to use them throughout the library. Because of the public facing nature of the client, this upgrade is a breaking change that will require other uses to update their code to use and configure for the new HTTP library as well.
  2. The scope of work is relatively large, requiring something like 50 classes to be changed.

I haven't been able to scope or examine the changes further. I think at this point the value should be questioned again since it's a major change for not just the library itself, but everyone that depends on it 🙂

@JellyBrick
Copy link
Contributor Author

JellyBrick commented Apr 25, 2023

Agree, I think it can cause a lot of breaking changes.

Pros:

Cons:

  • It requires a large amount of change (over 50 classes)
  • Can break third-party libraries that rely on lavaplayer caused by breaking changes

@jocull
Copy link

jocull commented Apr 25, 2023

I skimmed some of the issues. I can't tell how much of the issue is from user provided misconfiguration vs the library is not cleaning up after itself.

I think I would personally make the goal to make the library harder to misconfigure (and fix any obvious bugs within it like not closing connections that should be closed). Those can be treated separately.

Perhaps instead of exposing implementation to specific HttpBuilders for example, expose a number of tunable properties. The max number of connections, the max time to hold a connection open, etc. Maybe there's ways to improve specific issues people are having before a wholesale library change?

mxscowc1ty pushed a commit to MoscowMusic/lavaplayer-fork that referenced this issue Nov 8, 2023
@Walkyst Walkyst closed this as completed Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants