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/server.py
But I was wrong 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. # https://github.com/streamlit/streamlit/issues/3196 "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
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.
Hello Ikarimov,
Indeed that is annoying. I fixed by navigating to Network Services -->Load Balancing , then click on edit the button on top next to load balancer details. Click on backend configuration, select the backend service being used and click on edit.
Youโll see timeout is set to 30 seconds, increase this value to your desired value and save.
Thatโs it. Reload your app in new session it should work.
I know its hacky but Iโm pretty sure it is configurable via gcloud sdk but I didnโt really had the time to do that.
I hope it helps, good luck!