I am trying to host a Dash app with streaming data. I have 7 plots in the app which use data stored in dcc.Store. Every 10 seconds, dcc.Interval triggers the callback to update dcc.Store. Store’s ‘modified_timestamp’ component triggers callbacks for the plots.
I tried hosting the app on a server with “threaded=True”, but was not able to make it work for more than 5-6 users (5-6 tabs of Chrome) in parallel. With increase in number of users, more and more HTTP requests made by the app go unresolved or delayed with each taking more time to get resolved. I tried hosting using IIS manager too, but the result was more or less the same.
I wanted to know if there are ways to improve the performance of my app.
You might have better luck using multiple workers rather than multiple threads. If your callbacks involve much Python computation, then you won’t see any real improvement (and possibly a performance hit) due to Python’s global interpreter lock (GIL). Threads are only useful for Python when your program spends time waiting for I/O, as the GIL can be released while waiting for I/O requests.