Refreshing app takes 10-15 seconds. Too many graphs?

Hello there! I’ve have some performance issues. Im not quite sure why.

My app is designed as a multipage app.

App1 takes 1 second to load and navigate to.
App2 takes 10-15 to load and navigate. (snapshot: 12.98 seconds)

Im running my multipage locally, and im not currenly using any WSGI servers yet.

So the callback “url” returned the app2.layout at 12.98 seconds. App1.layout would take about 1 second.

App1 contains 3 graphs
App2 contains 15 graphs

There is no callbacks in either App1 and App2.

What is the reason for this 12.98 second load time? You could say the obvious reason is that App2 seems to contain more elements and data.

I genuinely thought that long as I initialized my graphs beforehand in the code performance wouldnt be an issue.

Is it too many DOM elements for the webpage to load quickly? No?

My plan to resolve the 12.98 seconds on requesting App2.layout is initializing App2 with just a small portion of data, and add the rest of the original data to the App2.layout later with a callback or something.

Please post some example code. Without seeing the code, we can only guess what is going on :slight_smile:

App1 is equivalent LPage
App2 is equivalent PView

PView has 1300 lines of code. So I wont publish that portion of code here. Unless someone is hyped for it.

Here is the multipage index.py file though. Where the url callback is stated

import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output

from dashboard import dashboard
from dashboard import server

from apps import LPage,PView

dashboard.layout = html.Div([
    dcc.Location(id='url', refresh=False),
    html.Div(id='page-content', children=[])
])

@dashboard.callback(Output('page-content', 'children'),
                    [Input('url', 'pathname')])
def display_page(pathname):
    if pathname == '/apps/Landing_Page':
        return LPage.layout
    elif pathname == '/apps/Portfolio_View':
        return PView.layout
    else:
        return LPage.layout


if __name__ == '__main__':
    dashboard.run_server(debug=True)


There is nothing in you index.py file that indicates where the time is spent. General advice could be to pre process/preload data whenever possible, but ýou would probably need to do some performance diagnostics on the code to identify what takes so long.