Streamlit cache uses too much ram


I’ve deployed streamlit in a container and ram usage keeps growing into many GB’s. I’ve set all cache to save to disk so it’s unclear why ram grows.

I have two related questions;

  1. Does setting persist=“disk” inside the cache_decorator still use up ram?
  2. How I can point streamlit cache location to a dedicated container volume?


Hi @CharlesFr

There are a few things that you can do.

Firstly, see if recommendations in the following blogs might help:

After use, cache can be cleared via:

Insights could also be gained on the individual processes that is slowing down the app by profiling the app:

Hope these resources are helpful.

Thanks @dataprofessor - that is helpful indeed.

Would you mind advising on the second question; how can I provide path for persisting cache to disk?

1 Like