BLOCKING BUG - memory and ephemeral storage leak issue in a Kubernetes deployment

@Ian_B To lower the memory usage, there are two quick things you could try:

  1. Use this wheel file which fixes a memory leak. This leak was fixed last week and will be released with 1.32.
  2. Deactivate the backend storage of forward messages in config.toml via (requires at least 1.30):
    storeCachedForwardMessagesInMemory = false
    This is a bit of an old artifact that most likely doesn’t have any use. And its a bit of a problem if there is a spike of user sessions.

These two aspects might help with the issue, but there are other memory inefficiencies we are currently investigating. To give you more specific help, it would be great if you can tell us which of the following features your app is using:
st.file_uploader , st.image , , , st.pyplot, st.download_button , long running sessions using st.rerun , large dataframes/charts, or any of the caching decorators?

For my understanding, what does Streamlit use ephemeral/disc storage for? Are cached and pickled objected stored on disc or in memory?

I think everything in a normal Streamlit setup is stored in memory. However, you can configure certain aspects to store on disk (e.g. via st.cache_data(persist="disk")). But you are probably not doing that, or?

1 Like