Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Improve dashboard performance: streamline 2 http requests #3065

Closed
mattab opened this Issue · 12 comments

2 participants

@mattab
Owner

When loading the dashboard, there is a noticeable slowness since recent changes. I think there is aneasy way to make the dashboard fast again.

explanation: when loading dashboard, the following http requests are made:

  • first: index.php?module=Dashboard&action=embeddedIndex&idSite=1&period=month&date=2012-03-21
  • Then, once loaded this triggers 2 requests

    • Get dashboard layout for user: index.php?module=Dashboard&action=getDashboardLayout&idDashboard=1&token_auth=anonymous&idSite=1
    • Get available widgets: index.php?module=Dashboard&action=getAvailableWidgets&token_auth=anonymous&idSite=1
  • Then, standard widgets are displayed once these 2 are finished loading.

The requests 2) and 3) should be streamlined and included in the output of the first one module=Dashboard&action=embeddedIndex

This way, the dashboard should be fast again :-)

@sgiehl
Collaborator

I'll have a look at that.

@sgiehl
Collaborator

(In [6142]) fixes #3065, refs #3011 initial version of multiple dashboard feature
refs #2857 fixed id collisions in modal confirm windows by using an role attribute instead of id

@mattab
Owner

(1) In trunk when loading /piwik/ there is still an extra http request:
index.php?module=Dashboard&action=getAvailableWidgets&token_auth=XYZ&idSite=1

This can be seen

  • Loading data...
  • Few seconds later: & Dashboard appears
    • here request fires to getAvailableWidgets
  • 1s later: All widgets load

For performance improvement the request getAvailableWidgets could be included in the response of embeddedIndex.

(2) Also, another way to slightly improve perf: the JS that is inlined in embeddedIndex could be put instead in a JS file so that it's loaded only once in the big minified JS rather than on each dashboard load.

(3) A small UX feedback which maybe is related: after the response from getAvailableWidgets currently comes back, I can see the [Widgets&dashboard] menu moving to the right a few pixels. Instead it should be at the right position from the start so that there is no "pixel" jumping when the content loads.

@sgiehl
Collaborator

(In [6253]) refs #3065 moved js code from template to additional js file

@sgiehl
Collaborator

(In [6254]) refs #3065 fixes UX regression

@sgiehl
Collaborator

well, it would be quite easy to include the seperate request for the widgets. But that would mean we would have to transfer that data whenever the user switches to a dashboard. that would be useless, as we need that data only once.

@mattab
Owner

What I propose is that the request to Dashboard controller returns directly the Menu data, Widget data for the dashboard loaded by default, and layout of dashboard loaded by default.

Then when clicking on another dashboard the http request would return layout, widgets available for this dashboard in the same http request.

  • index.php?module=Dashboard&action=getAllDashboards
  • index.php?module=Dashboard&action=getAvailableWidgets

Maybe these requests still need to be made when a widget is added/ a dashboard renamed/removed. Could we then just trigger in these functions the requests above to update the json data?

Streamlining these 2 json objects in the main request to the embed dashboard will speed up embed dashboard speed quite a lot and is experienced by all users as the first thing in piwik.

@sgiehl
Collaborator

(In [6409]) refs #3065 include available widgets in embeddedIndex, so no additional request is required

@sgiehl
Collaborator

now index.php?module=Dashboard&action=getAvailableWidgets is not requested anymore. the allDashboards request ist not required to render the page, it only updates the dashboard list in the menu, which is allready available before.

@mattab
Owner

Nice change!

It seems the widgets are not recorded anymore: when I add a widget to dashboard 2 it adds it to dashboard 1 as well.

  • The problem is that click on another custom dashboard does not update "idDashboard" in the menu, it is still idDashboard=1

Regarding performance:

  • getAllDashboards is not required to render, but the http request is queued before any of the widgets. Could we force the http request to queue like 1s later on ?

Thanks!

@mattab
Owner

It can be improved a bit more as per previous, but definitely the main things have been fixed and it is not a blocker for release anymore. Thanks Stefan!!

@sgiehl
Collaborator

I had another look at this issue and I don't think that can be improved that mutch.
Requests for widgets are already queued before the getAllDashboards request.

@mattab mattab added this to the 1.12.x - Piwik 1.12.x milestone
@sgiehl sgiehl was assigned by mattab
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.