How exactly does streamlit handle multiple simultaneous users? Will it run compute for each additional user on a new thread or do requests get processed serially on the same thread?
When you deploy a Streamlit app, there is a single, Python backend (server). Different threads run to handle different users. If you write anything to
st.session_state, that information is only going to be available to the session in which it was written. (If a person opens multiple tabs in their browser to the same app, then each tab is going to be its own session, by the way.)
Where it gets a little interesting is with caching. When you cache information for a function, that cached inform is available to all sessions. Whether your cached function returns a shared singleton or a copy depends the choice of caching function: