-
Notifications
You must be signed in to change notification settings - Fork 296
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
Request to set default tcp keepalive interval #115
Comments
Thanks for pointing this out! To be clear, Linux(which is most used) offers 3 kernel params:
All of them should be configured to a proper value. Personally I consider it reasonable to set them in our app. It is similar to the |
@MeteorsLiu I'm not sure which toolchain you are using. Switch to the latest nightly one, and run |
after
My rustc version: |
@MeteorsLiu |
I have finished the job, can i open a PR? |
Of course. Thanks! |
In Golang, a default tcp keepalive interval(15 Seconds) is set when the connection is established, which prevents the super long interval set by Linux or other system causing the connection "unhealthy"(In Chinese, "unhealthy" means 断流).
However, in Rust, there's no default keepalive interval, which means it will use the system default tcp keepalive.
For example, in Linux, the tcp keepalive interval is 7200s, which means that it have to wait for 7200s to confirm whether the connection is healthy or not. If the connection is broken, it will cause the ETIMEDOUT error and shut down by user space programs.
In high traffic cases, 7200s makes kernel spend a lots of times to do interruption of checking "unhealthy tcp" and makes the numbers of connection increasing(old broken connection cannot be shutdown as soon as possible).
So request to set default tcp keepalive interval to 15s.
I tried to modify some codes (https://github.com/MeteorsLiu/realm) to archive that.
However, i cannot compile due to
The text was updated successfully, but these errors were encountered: