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

small archiving invalidation loop optimization #17045

Closed
wants to merge 3 commits into from

Conversation

diosmosis
Copy link
Member

Description:

Select less invalidations when we know were archiving segments for a specific period + add total iterations counter to output.

When we're archiving an "All Visits" archive, we know we won't be adding segments to it, so every segment archive we query will be skipped. So it's pointless to query for them all. This PR avoids selecting them so we don't have to go through the loop for them. May provide a visible performance boost in cases where there are many segments for a site.

FYI @tsteur

Review

  • Functional review done
  • 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

…specific period + add total iterations counter to output.
core/DataAccess/Model.php Outdated Show resolved Hide resolved
core/CronArchive/QueueConsumer.php Outdated Show resolved Hide resolved
core/DataAccess/Model.php Outdated Show resolved Hide resolved
@diosmosis
Copy link
Member Author

@sgiehl applied review comments

if ($onlySelectSegmentArchives) {
// we select only segment archiving by looking for archive done flags that have a length > 32. this works since the done flag
// for a segment archive will contain its hash
$sql .= " AND CHAR_LENGTH(name) > 32 AND date1 = ? AND date2 = ? AND period = ?";
Copy link
Member

Choose a reason for hiding this comment

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

Regarding the 32 chars. Wouldn't that also select invalidations for plugins with long names. e.g. SearchEngineKeywordsPerformance actually already has 32 chars 🙈
I'm not deep enough into the code here to be sure if that cause any issues or not.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah this could be an issue then. I guess we also have to do a split or something...

@diosmosis diosmosis closed this Mar 25, 2021
@diosmosis diosmosis deleted the archiving-optimizations branch March 25, 2021 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants