Long-lived TCP connection stalls


I run a gRPC application (written in Go) on a droplet (without a firewall) and use server streaming to send updates to the clients. The frequency of the updates is low (even a few in a day). The gRPC protocol is over HTTP/2, e.g. there are open TCP connections to the clients. If I run my application on a local machine everything is okay, but if I run it on the droplet, the connections stalls after a few minutes.

I think it is related to the TCP keepalive settings of DigitalOcean. Some device is dropping the connection due to lack of traffic.

Of course, I can increase the keep-alive period from the client-side (the current setting is 15 minutes), but I would like to minimize the network traffic because the client devices use LTE Cat M1 with IoT SIM and the network provider will also bill me for the data used for keep alive. (1 keep-alive message pair is about 100 bytes, sending these every minute means 30,5 days * 24 hours * 60 minutes * 100 = 4.4 MBytes / month plus, without exchanging any real information.)

Is it possible to increase the minimum keep-alive? What is the current setting?

How it is solved in the case of MQTT (on low-level the problem is the same)?

Submit an answer
Answer a question...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Is it possible to increase the minimum keep-alive? What is the current setting?

Of course, on DigitalOcean’s side.