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

Keep alive limitations #4301

Open
ajutzeler opened this issue Oct 31, 2021 · 1 comment
Open

Keep alive limitations #4301

ajutzeler opened this issue Oct 31, 2021 · 1 comment

Comments

@ajutzeler
Copy link

As issue #3052 was closed I am creating a new one.

I am encountering weird connection persistence behavior at least with Binance (I haven't tried other exchanges yet).

If the interval between the API calls is less than 5 seconds, the connection is reused without any problem.

However if it is longer, the first connection is actively closed (I can intercept the tcp FIN in the trafic) by the client somehow just before the subsequent call.

To my knowledge there is no argument/property to specify the max duration of persistent connections at the level of ResCU, HTTPClient or the JVM.

I've checked my OS settings and I've got the default value of 7200 seconds.

Regarding the HTTP headers, Binance does respond with Connection: keep-alive, but does not provide any Keep-Alive header.

Any idea as where this 5 seconds value can be changed?

@ajutzeler
Copy link
Author

I've tried a lot of things, but the connections are never persisted more than a few seconds with HttpsURLConnection no matter what JVM (openjdk 11-17, oracle 11-17) and what settings I am using.

This is clearly an issue that has been encountered by other many time over the years.

I quickly modified ResCU to use OKHttp client instead of HttpsURLConnection and it just works flawlessly without any custom configuration.

I am going to open an issue about that on https://github.com/mmazi/rescu requesting the support of an alternative http client, HttpsURLConnection being clearly not flexible enough (even broken in my opinion).

@ajutzeler ajutzeler changed the title Keep alive limitations (with Binance) Keep alive limitations Nov 1, 2021
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

1 participant