Skip to content

Improve Entity History Cleanup Performance - #352

Merged
JonoPrest merged 4 commits into
mainfrom
jp/improve-prune-performance
Nov 21, 2024
Merged

JonoPrest merged 4 commits into
mainfrom
jp/improve-prune-performance

Conversation

@JonoPrest

Copy link
Copy Markdown
Collaborator
  • Adds a "shouldDeepClean" flag to have a lighter version of the cleanup function
  • Moves the cleanup function into it's own task that happens async with a throttler. On every 20th cycle it will try deep clean (configurable)

@JonoPrest
JonoPrest requested a review from DZakh November 20, 2024 17:25
}
}
}
state.writeThrottlers.pruneStaleEntityHistory->Throttler.schedule(runPrune)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Am I right that it'll simply log if the transaction fails? For example, if we terminate it on our side.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yeah exactly it just logs

@JonoPrest
JonoPrest force-pushed the jp/improve-prune-performance branch from 85e7e86 to e6b9340 Compare November 21, 2024 07:53
Comment on lines +143 to +145
let shouldPruneHistory = (config, ~isInReorgThreshold) =>
switch config.historyConfig {
| {historyFlag: MinHistory} => true
| {rollbackFlag: RollbackOnReorg, historyFlag: MinHistory} if isInReorgThreshold => true

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@DZakh note I made one more change here. I noticed on the monitoring that even the non-rollback indexers were firing this off. (Obviously a very light query with no history but still should only apply to rollback indexers)

And I baked in the isInReorgThreshold check here just like the shouldSaveHistory function above

@JonoPrest
JonoPrest enabled auto-merge (squash) November 21, 2024 07:56
@JonoPrest
JonoPrest merged commit 339b662 into main Nov 21, 2024
@JonoPrest
JonoPrest deleted the jp/improve-prune-performance branch November 21, 2024 08:02
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.

2 participants