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

New polling-strategy for Postgres, select-for-update based #175

Merged
merged 27 commits into from Mar 8, 2021

Conversation

kagkarlsson
Copy link
Owner

@kagkarlsson kagkarlsson commented Feb 5, 2021

New SchedulerBuilder methods:

  • pollUsingFetchAndLockOnExecute(double lowerLimitFractionOfThreads, double executionsPerBatchFractionOfThreads). The old default, but more customizable.
  • pollUsingLockAndFetch(double lowerLimitFractionOfThreads, double upperLimitFractionOfThreads) a new method of polling based on SELECT FOR UPDATE .. SKIP LOCKED RETURNING .... Currently implemented for Postgres

Benchmarks results comparing the default mechanism fetch to the new lock-and-fetch:

Throughput fetch TPS fetch (from console) Throughput lock-and-fetch TPS lock-and-fetch (from console)
Postgres 4core 25gb ram, 4xVMs(2-core)
20 threads, lower 4.0, upper 20.0 2000 9000 10600 11500
100 threads, lower 2.0, upper 6.0 2560 11000 11200 11200
Postgres 8core 50gb ram, 4xVMs(4-core)
50 threads, lower: 0.5, upper: 4.0 4000 22000 11840 10300

Relevant reading material

private final Scheduler scheduler;
private final Execution pickedExecution;

public ExecutePicked(Scheduler scheduler, Execution pickedExecution) {
Copy link

Choose a reason for hiding this comment

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

While working on this code, I faced some challenges in testing/following the code and updating due to the mutual dependency of Scheduler on the Execution and vice versa.

Could we have a more tree-like structure in a way that ExecutePicked gets "trigger"/"handler" interface instead of the scheduler itself?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yeah, this a bit of technical debt I have not fixed yet. I do not like passing the full Scheduler here. It should be changed to not reference Scheduler.. haven't taken the time to figure out a good solution yet..

@kagkarlsson kagkarlsson merged commit f832353 into master Mar 8, 2021
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