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 tracker performance when using custom dimensions (one less update query per tracking request) #17521

Merged
merged 11 commits into from May 5, 2021

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented May 4, 2021

Description:

Performance improvement to have one less update on log_visit for existing visits if action dimensions are used: fix #17173

New visit scenario

Before this PR

  • Insert new visit -> so get idVisit
  • Insert log link action -> so we get idlink_va
  • update visit to set value of the created idlink_va on the column last_idlink_va.

After this PR

Same logic as before. We always have to create visit first before creating any log link action.

Existing visit scenario

Before this PR

  • Update visit (we have idvisit already at this stage)
  • Insert log link action -> so we get idlink_va
  • update visit to set value of the created idlink_va on the column last_idlink_va.

After this PR

  • Insert log link action -> so we get idlink_va
  • Update visit including setting the value of the created idlink_va on the column last_idlink_va.

Review

  • Functional review done
  • Potential edge cases thought about (behavior of the code with strange input, with strange internal state or possible interactions with other Matomo subsystems)
  • Usability review done (is anything maybe unclear or think about anything that would cause people to reach out to support)
  • Security review done see checklist
  • Code review done
  • Tests were added if useful/possible
  • Reviewed for breaking changes
  • Developer changelog updated if needed
  • Documentation added if needed
  • Existing documentation updated if needed

@tsteur tsteur added the Needs Review PRs that need a code review label May 4, 2021
if (!$isNewVisit && $processor instanceof ActionsRequestProcessor) {
// already processed earlier when handling exisitng visit see {@link self::handleExistingVisit()}
continue;
}
Copy link
Member

Choose a reason for hiding this comment

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

could this be put in ActionsRequestProcessor? ie, return if conditions are met?

Copy link
Member

Choose a reason for hiding this comment

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

oh i see, this has to be done before updating a visit... seems like it would all be clearer if this was all in ActionsRequestProcessor, though i'm not sure if that's possible

Copy link
Member Author

Choose a reason for hiding this comment

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

I know it's not really clear which is why I'm not sure yet if it's worth merging it. Problem is for new visits we have to execute the actions processor later vs for existing visits we have to execute it before updating a visit...

Copy link
Member

@diosmosis diosmosis left a comment

Choose a reason for hiding this comment

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

not sure if there's anything else to do here, but this looks good to merge

@tsteur tsteur merged commit 52a3fe8 into 4.x-dev May 5, 2021
@tsteur tsteur deleted the cdupdate branch May 5, 2021 23:30
@tsteur tsteur added the c: Performance For when we could improve the performance / speed of Matomo. label May 5, 2021
@tsteur tsteur added this to the 4.3.0 milestone May 5, 2021
@mattab mattab added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label May 17, 2021
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 not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve tracker performance when using custom dimensions (one less update query per tracking request)
3 participants