I have deployed my streamlit app on Google cloud run (Dockerized and everything).
The app is essentially doing some llms calls and that takes a while to finish (10+ mins), so there is a progress bar while it’s running. Locally I have no problem running it for even hours in a row, but in cloud run there are some get /health requests (and other endpoints) that happen roughly every 240 seconds (that is the maximum that can be set) and when that happens the streamlit app basically resets exactly as I had just refreshed the page.
here are some logs of the requests:
2024-10-08 10:40:30.609 CEST
GET304242 B2 msChrome 123 https://yunoai-mergeracquisition-streamlit-demo-*****.europe-west1.run.app/_stcore/health
2024-10-08 10:40:30.857 CEST
GET101799 B301 sChrome 123 https://yunoai-mergeracquisition-streamlit-demo-*****.europe-west1.run.app/_stcore/stream
2024-10-08 10:45:31.968 CEST
GET304154 B2 msChrome 123 https://yunoai-mergeracquisition-streamlit-demo-*****.europe-west1.run.app/_stcore/host-config
I think these automatic health/uptime checks are the culprits which are resetting my application, and unfortuntely there is nothing I can do on the cloud run side as these cannot be deactivated …
Does anybody know how to solve this? Perhaps something can be done on the application side to prevent the checks to interrupt everything?
I am not sure about the issue you’re having, but it might be worth looking into the Request timeout of the Cloud Run instance.
If you go to the cloud run instance, and press:
Edit & Deploy new version
You can adjust the Request timeout setting. The maximum time that can be set is 3600 seconds, which should be enough for your needs.
Too bad that this wasn’t the solution! After some more reading, I now also see what you mean with the maximum time of 240 seconds for the health check. It seems like the app is just too busy during the time the health check is happening.
One other thing I saw in the settings is that you can also set a failure threshold. You might be able to set this to n (higher than the default of 1), so that you have x*240 seconds for the process to finish. I’m not entirely sure if this works, but it might be worth a try.
What you could try as well is to run your llms calls as a seperate process, while keeping the streamlit process available.
Ciao Dirk, sorry for not updating the thread but that was indeed the solution, set the failure threshold to 10 and now it takes 2400 secs for the app to reset, which is more than enough for me!
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.