Bring Drag & Drop to Dash with Dashboard Engine. 💫 Learn how at our next webinar!

Why aren't the callbacks running at the same time?

Why is there a limit of 12 concurrent callbacks?
Seems like having limitation of concurrent number of callbacks and scheduled.

If you run the example code below,
not all callbacks run at the same time, but 12 callbacks run and the rest are pending, then executed sequentially.

What I want is for all callbacks to run at the same time.

So I tried options like
threaded=True , or processes=20 to app.run_server

or using gunicorn like
gunicorn app:server --bind 0.0.0.0:8050 -w 20 - threads 16 -timeout=10 -k gevent

but non of them works

please help or at least give me a hint.

(my server has 32cores cpu)

# Dash app initialization
import dash
import flask
import time
import dash_bootstrap_components as dbc
from dash import Input, Output, html


# flask server enables to configure the Flask-Login extension
flask_server = flask.Flask(__name__)

app = dash.Dash(
    __name__, 
    server=flask_server
)

loading_spinner = html.Div(
    [
        dbc.Button("Load", id="loading-button", n_clicks=0),
        html.Div(
            [html.Div([html.Div(f"{i}"), dbc.Spinner(html.Div(id=f"loading-output-{i}"))]) for i in range(20)]
        )        
    ]
)



app.layout = dbc.Container([loading_spinner])


for i in range(20):
    @app.callback(
        Output(f"loading-output-{i}", "children"), 
        [Input("loading-button", "n_clicks")]
    )
    def load_output(n):
        if n:
            time.sleep(2)
            return f"Output loaded {n} times"
        return "Output not reloaded yet"

server = app.server



if __name__ == "__main__":
    app.run_server(host="0.0.0.0", debug=True, threaded=True