Problem
When you deploy your app on Streamlit Community Cloud, after some time you may get an error message stating This app has gone over its resource limits
.
This is what you may see on your app when receiving this error:
Before diving into the specifics on how you can solve this error, let’s first talk about the compute resource of your Streamlit app.
All Streamlit Community Cloud users have access to the same resources and are subject to the same limits. These limits may change at any time without notice. If your app meets or exceeds its limits, it may slow down from throttling or become nonfunctional. The limits as of February 2024 are approximately as follows:
- CPU: 0.078 cores minimum, 2 cores maximum
- Memory: 690MB minimum, 2.7GBs maximum
- Storage: No minimum, 50GB maximum
The error message that you see indicates that your app has exceeded this allocated limit.
Solution
Let’s now consider how to tackle this error. You’ll also notice that the error message itself provides a good starting point on how you can resolve this by clicking on the list of bullet links.
1. Reboot the app:
A temporary and probably the quickest fix is to simply reboot the app, which after the reboot the app should work as usual. This may be helpful when you need to use the app immediately. However, it should be noted that this does not resolve the underlying root cause.
2. Optimizing the app
A more sustainable approach is to optimize the app so that it uses less memory (e.g. use caching, profiling the app’s memory usage, etc.). See the Resources section for tutorial blogs to get you started.
3. Upgrade Streamlit
Another simple fix is to upgrade your Streamlit version to the latest release. You’ve guessed it, this would allow you to leverage all the latest enhancements that may affect your app performance.
4. Request for a resource boost
If your app has a good-for-the-world use case or is used by a non-profit or educational organization, you can fill out this form to request additional resources.
Resources
- Clearing up the app’s memory by rebooting
- Fixing the app’s memory usage:
- Building performant apps:
- Optimizing performance through caching