Hi everyone.
We have deployed streamlit app on google cloud run.
Streamlit version → 1.31
With 1 gb container, 1 vcpu and minimum to moderate traffic it’s costing us 1.5-2$ everyday.
Is there a way to deploy it on gcp with less cost?
We want application to be scalable for concurrent users.
I’m having the exact same problem. It’s because it’s constantly pinging the health check endpoints (/_stcore/health , /_stcore/host-config , and /_stcore/stream ). This makes streamlit absolutely useless for a lot of use cases with GCP, and no one seems to either know why it’s constantly keeping the container alive with those checks, or how to disable them. I see requests every 5 minutes or so in the logs, and I’m using version 1.32.
Note that my specific application is for testing purposes and has nearly 0 uses (which I can double check because the app makes api calls on another backend and that backend is absolutely dead) and it’s still costing me 2$ daily, and of course I have min instances set to 0 (which you should check as well, having the one instance running in idle would produce the 1-2$ daily charge as well)
I’ve deployed a Streamlit app on Google Cloud Run (using Streamlit version 1.37.0) and I’ve noticed that even when users leave the app open, the page keeps reconnecting due to the constant WebSocket pings.
Streamlit uses WebSockets for real-time updates and interactive user experiences. This results in unnecessary charges, which add up to around $1.5-2 per day with minimal usage. Additionally, because the connection is constantly maintained, the more inactive users or open browser tabs there are, the more the number of instances increases. This can lead to increased costs, degraded performance, and delayed scaling.
I’m curious if there’s any way to close the WebSocket connection when there’s no data update for a certain period. Alternatively, I’m interested in exploring other solutions. Has anyone found a solution to this?
I do not know for spesifically 1 cpu but if you consider multiple process and if you need non-blocking functions. You can read the blog post about scaling streamlit by redis queue. Background processes were very useful in my case, it works.
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.