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 throughput of other commands using ProcessPartitioned by allowing transaction and connection sharing #292

Merged
merged 4 commits into from
Nov 1, 2024

Conversation

peppy
Copy link
Member

@peppy peppy commented Oct 31, 2024

Some more optimisations I made in order to make updating user totals as a batch more efficient.

More details in some commit messages.

peppy added 3 commits November 1, 2024 02:18
The partition commands can sometimes partition across millions of items.
We can't have each thread's partition lasting for the full span of those
items. Easiest solution is to commit every so often.
await transaction.CommitAsync(cancellationToken);
}
Interlocked.Add(ref totalScores, (ulong)await ScoreProcessor.ProcessUserScoresAsync(userId, RulesetId, conn, transaction, cancellationToken));
await transaction.CommitAsync(cancellationToken);
Copy link
Contributor

@smoogipoo smoogipoo Nov 1, 2024

Choose a reason for hiding this comment

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

Is this intentional? It sounds like this would break things because the transaction would still be in use for the next iteration.

If what you wanted is the transaction length to be 1, then it should probably be a parameter to ProcessPartitioned rather than a const = 50.

Copy link
Member Author

Choose a reason for hiding this comment

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

looks like a merge resolution fail

@peppy peppy merged commit 1ada77e into ppy:master Nov 1, 2024
3 checks passed
@peppy peppy deleted the optimise-other-commands branch November 22, 2024 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants