Maximum number of callbacks in a single Dash app?

I’m curious if there is a maximum number of callbacks that a single Dash app can reasonably handle. By this I mean, is there a limit to the quantity of callbacks before performance degradation or something else?

I’m experiencing long loading times (ie. “Loading” displayed in upper left corner on refresh or navigation to new page) and I have about 150 callbacks. I usually only have about 10 callbacks on a page at a time; however, there are 3 pages that have about 40 callbacks each.

Performance of the app is great once everything loads; however, I have noticed that loading is significantly degraded as I add pages past this point. Is this typical?

I’m trying to narrow down my investigation at the moment and it seems the quantity that I have is the limiting factor. Which points me towards some optimization efforts I can undertake but I want to make sure first.

Appreciate all of the help and happy to share more information as needed.

Not sure if this is applicable to your use case, but in my case running the app with prevent_initial_callbacks=True significantly sped up the initial load.

Thanks, I do set that as almost a matter of principle in my callbacks, except when I need newly loaded components to fire for whatever reason.

What I’ve found so far is that the main issue was coming from a single page I have that uses many complex callbacks with some long callback chains. I think there are close to 60 callbacks and each one has many inputs, outputs, and states (maybe 10 arguments for each callback). I also have about 5 other pages (at the moment) that are much simpler with only 10-16 callbacks, and maybe 6 of those are somewhat complex. It seems that the biggest strain on initial load of the app comes from the big page with complex chains. I’ve replicated the smaller pages 4x and saw a very small increase to loading time.

I’ve taken some suggestions from another thread (that I hijacked… sorry) and made sure that everything operates with no page refreshes, except for some OAuth redirects that occur. The big, more complex page was optimized in a manner that allows for dynamic content creation by users, thus allowing me to only have 1 page/file in the app. My next step is to go through everywhere I can to change any callbacks to clientside_callbacks that don’t require some server operation to complete.

For anyone that’s interested I’ll continue to share any findings.

1 Like