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?

1 Like

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!

Hello, I was just wondering if there are any updates on this topic? Also what if we are using EC2 and not streamlit cloud .

There still isn’t a built-in way to handle this. If you are using a service other than Streamlit Community Cloud, you can refer to that service’s documentation on how to set concurrency limits.