Hi I have a dash app deployed on AWS elastic beanstalk. There is one pandas data frame CSV that the entire app runs off of and generates plots. How many concurrent users can the app handle? How would I test this? How exactly does it work considering everyone is reading from the same flat file? Do threads/workers come into account here?
Here’s my uneducated 2 cents on the question, with hopes that someone else has a better input or more experience on the subject…
The biggest point in terms of scalability is how your callbacks are structured and how much time/memory they take, not necessarily what is the origin of the data “behind” the application.
If you have a single file that is loaded in the global scope, then each process running your application will load this data once. If you have multiple workers, each one of them will load the same data in memory and serve the requests to update the application (the callbacks). Besides, I believe Dash (Flask) will process a single request per thread concurrently, so a single worker can already in principle handle multiple requests.
The whole shebang of services like EB is that they can scale up and down processes based on CPU/RAM/Network usage, so it is less a matter of how scalable the solution is and more of how much you want to pay for the service. You can do load testing with tools like Locust and keep an eye on the metrics reported in the EB console, but it is something I haven’t tried and might require some adjusts to make a good mock of user behavior… It can be helpful to do so to get a better feeling of where the bottleneck is or optimize the autoscaling settings to avoid having too many resources running with low usage.
Lastly, there are a few things that can drastically improve the performance of your app, like switching simple callbacks to client-side (so no server requests are made) and/or use server-side caching (
dash-extensions can be very helpful with it).
I hope you will find this a bit informative, and I would also encourage you to do some research on the same topic for Flask applications (which is essentially the same as Dash for this purpose).