Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various performance improvements, especially for Range period and installations with many sites #7119

Merged
merged 4 commits into from Feb 9, 2015

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Feb 2, 2015

  • In the DataTableManipulator we requested the metadata for all websites. If an installation has many websites we ended up building the report metadata for all sites. This takes a long time, especially since some reports get site information eg getFor('sitesearch'). If an installation has 100 Piwik websites it resulted in 100 queries to piwik_site which resulted in 100 posted events in Piwik::setSite etc.
  • Post much less events. Eg we posted two events for each row in a GetSearchEngines datatable (which is slow as it will always notify all plugins). Instead we do now cache SearchEngineUrls / Names and SocialUrls. This saves about 100-200ms on a simple Referrers.getSearchEngine request if not more.
  • When requesting a date range eg date=last30&period=range about 40% of the request time was spent in generating the sub periods. In one simple request we did this eg. 20 times for the same date range which took about 700ms on my server. As we cache it now it will take only about 35ms making all calls to range dates faster. I just this is more or less "only" a performance boost for flat=1 as it looks like it generates the subperiods for each subtable. Note: If there was any long/endless running job this cache could result in a memory issue.

On our demo test server this call does now take only about 0.75s instead of 1.7s:
index.php?date=2015-01-04,2015-02-02&module=Referrers&action=getSearchEngines&widget=1&isFooterExpandedInDashboard=true&flat=1&idSite=1&period=range

…d the metadata for each site and if one has 20k sites would request it 20k times!
…gers an event for each label in a datatable which can be many!
…ting the footerIcons. Instead cache the result to save many postEvents etc
This is a bit experimental and I need to see whether any test will
fail. It takes a long time to generate subperiods for period=range.
Eg requesting date=2015-01-04,2015-02-02&module=Referrers&action=getSearchEngines&period=range
took about 700ms for each request of 1500ms in total. It now takes
only 40ms which means it is 30-40% faster. With the other optimizations
the request in total does now only take 700-800ms instead of 1500ms.
@tsteur tsteur added c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. c: Performance For when we could improve the performance / speed of Matomo. and removed c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. labels Feb 2, 2015
@mattab mattab added this to the Piwik 2.11.0 milestone Feb 9, 2015
@mattab mattab added the Pull Request WIP Indicates the current pull request is still work in progress and not ready yet for a review. label Feb 9, 2015
mattab pushed a commit that referenced this pull request Feb 9, 2015
Various performance improvements, especially for Range period and installations with many sites
@mattab mattab merged commit 19acdb5 into master Feb 9, 2015
@tsteur tsteur deleted the performance_improvements branch February 9, 2015 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Performance For when we could improve the performance / speed of Matomo. Pull Request WIP Indicates the current pull request is still work in progress and not ready yet for a review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants