Streamlit app on kubernetes keeps refreshing every 30 seconds


I have created a simple app which is deployed on k8s. Its an app which is intended for downloading data.
I have observed that it keeps refreshing every 30 seconds, which is not acceptable as we need time to select date and time.
Also I see that it happens only when access via ingress, if I port forward the service then it keeps working ok.
I was wondering it may be because of hard coded value in tornado settings in streamlit/web/server/
But I was wrong :frowning:
TORNADO_SETTINGS = { # Gzip HTTP responses. "compress_response": True, # Ping every 1s to keep WS alive. # 2021.06.22: this value was previously 20s, and was causing # connection instability for a small number of users. This smaller # ping_interval fixes that instability. # "websocket_ping_interval": 1, # If we don't get a ping response within 30s, the connection # is timed out. "websocket_ping_timeout": 30, }

We run k8s on our own server so the work around mentioned in this post is not relevant. Probably Iā€™m doing something absolutely wrong :slight_smile:

Finally we found out that issue was due to the default time out of gcp load balancer, which was causing the web socket connection to re-initialize every 30 secs. All we needed to do was change the time out in the backend configuration of load balancer. I hope it helps.

1 Like

Is there a way to increase the request time out? Like 1 day. Because the max in gcp is 1hr only. The interaction in my app could take like 4hrs.