How to parallelize callbacks for speeding up Plotly-Dash?

I tried

import waitress

app = dash.Dash(__name__)

....

I don’t find any good description on how to use threading. My callbacks are all taking a little while. So updating the dashboard with a new style, takes quite a while.

I tried each of these lines, with pretty much the same results.

app.run_server(debug=True, threaded=False)

app.run_server(debug=True, threaded=False, processes=4)  # this seems to work

app.run_server(debug=True, threaded=True)

waitress.serve(app.server, threads=4)

waitress.serve(app.server, threads=1)

What is the difference between those lines?

app.run_server(debug=True, threaded=False, processes=4)  # this seems to work
app.run_server(debug=True, threaded=True)

And how can I correctly enable parallel processing with waitress?

2 Likes