Set limit of active/simultaneous users

Summary

I am working on a Streamlit app which (from time to time) runs some expensive computations. Since the computation runs on the GPU and the memory is quite limited I’m looking for a way to limit the number of “active” (i.e. simultaneous) users to one.

The definition of “active” can be quite flexible here, depending on what is possible, i.e. it could be defined as “one user is logged in” or “one user has the application open”. Any ideas how this could be achieved easily?

Hey @mibaumgartner,

If you’re hosting your app with Streamlit Community Cloud, you might consider using st.experimental_user in conjunction with session state – that said, there isn’t a built-in way to do this, so I can’t guarantee that this would work perfectly for this specific use case, but I think that would probably be your best bet.

1 Like

Thanks for the quick answer, I’ll give it a try!