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

Improve performance of BulkTracking and QueuedTracking #7688

Merged
merged 1 commit into from Apr 17, 2015
Merged

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Apr 16, 2015

I profiled QueuedTracking with Redis (actually inserting the requests from Redis to DB) and made some improvements that as well effect mainly BulkTracking but also normal tracking. In some cases it improved performance by 30-70%.

For example 50% of the total time (180seconds) is spent in https://github.com/piwik/piwik/blob/2.13.0-b2/core/UrlHelper.php#L153 (down to 20% wall time now) . 33.3% of total time is spent in Common::sanitizeInputValue https://github.com/piwik/piwik/blob/2.13.0-b2/core/Common.php#L342 (which is also called by UrlHelper partially), 21% is spent in Common::sanitizeString https://github.com/piwik/piwik/blob/2.13.0-b2/core/Common.php#L314 .

Also Common::getRequestVar is very expensive when performed a million times (eg 20% wall time easily), same for Piwik::postEvent() (> 10% of the time) etc.

Those changes are needed by Thursday/Friday for a client to make inserting tracking requests fast enough.


if (!isset($shouldUndo)) {
$shouldUndo = version_compare(PHP_VERSION, '5.4', '<') && get_magic_quotes_gpc();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When inserting in bulk this can be executed easily a million times.

@tsteur tsteur added the Needs Review PRs that need a code review label Apr 16, 2015
@tsteur tsteur added this to the Piwik 2.13.0 milestone Apr 16, 2015
@tsteur tsteur added the c: Performance For when we could improve the performance / speed of Matomo. label Apr 16, 2015
mattab pushed a commit that referenced this pull request Apr 17, 2015
Improve performance of BulkTracking and QueuedTracking
@mattab mattab merged commit a1c4c83 into master Apr 17, 2015
@diosmosis diosmosis deleted the tracker_tweaks branch April 17, 2015 01:59
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. Needs Review PRs that need a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants