Hello, Streamlit newbie here. I’m building a web app to label data, which will run on an AWS instance. In short, it consists of Streamlit + MongoDB (local database). In first approximation, how many concurrent users could the app have? In your opinion, are there limitations that I should take into account? Thanks heaps!
Hi @albusdemens -
Streamlit is built upon Tornado, which provides this passage in their documentation:
Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed. By using non-blocking network I/O, Tornado can scale to tens of thousands of open connections, making it ideal for long polling, WebSockets, and other applications that require a long-lived connection to each user.
So ignoring the fact that Streamlit could be using Tornado wrong (not saying that it’s not possible, let’s just assume we aren’t or that it’s a fixable issue), the next question is whether every other library you want to use is also written for performance. Of course, that’s a big assumption!
The biggest place where you will run into issues is thread-safety. matplotlib is a notorious performance trap in Streamlit, because the user needs to add some code for thread-safety. You can extend this line of thinking even further…is the Python mongodb library thread-safe, and so on.
So how many concurrent users a Streamlit app can support can be viewed as a function of:
- the machine you are running on, what machine mongodb is running on
- the Python libraries you use
- what you are doing, and how performant that underlying Streamlit function is
- data size
- and so on
We do have large corporate users, and within Streamlit Cloud we do have enterprise customers where we scale their resources up considerably higher than the ‘community’ free tier, so it can be done. It just becomes a systems integration issue than purely a Streamlit one.
That is a very accurate statement.