support tcp_keepalive #2603
Unanswered
jiemingwang
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi team,
Can we support tcp keepalive for server socket ? I understand that uvicorn provides a simiplar timer at http layer (timeout_keep_alive). But there is a problem when there is a network device (firewall) between client and server. The device can monitor the connection and drop it when idle time exceeds the timer set by network device (firewall_timeout), but is still less than timeout_keep_alive.
E.g.,
firewall_timeout=60
timeout_keep_alive=90
So in this case, a connection will be dropped when idle time exceeds 60 seconds.
By enabling tcp_keepalive, a connection will treated as active and prevent from being dropped (i.e., by firewall) as long as tcp keepalive packet is sent within firewall_timout, even though there is no http data sent.
I have tweaked the uvicorn codes to support tcp_keepalive. It should be a small change. But just want to consult with team here before I raise an issue ?
Thanks
J. Wang
Beta Was this translation helpful? Give feedback.
All reactions