Streamlit unstable under heavy load

Hi folks!
Thanks for creating such an easy to use dashboarding tool. My team has used it to deploy a COVID-19 hospital capacity planning tool called CHIME

We’re running into an issue with our deploy that is very hard to reproduce unless the application is under heavy load. I’ve documented this issue here:

Any advice on how to stabilize the app would be greatly appreciated. You can reach me directly on our slack at

I filed a github issue for this at


Hey @beckerfuffle, welcome to Streamlit!

It looks like your issue was mitigated by switching away from pyplot to altair?

This looks like a race condition inside matplotlib; under heavy load, Streamlit is spins up many threads concurrently, and I wonder if (a) we’re mistaken about the thread-safety of matplotlib operations or (b) matplotlib is buggy in concurrent scenarios.

Are you able to move away from pyplot entirely? This should also reduce any server load you’re having, as pyplot charts are rendered server-side and delivered to the browser as images, and altair charts are sent as JSON to the browser, which then renders them locally.