Repository navigation
fix: honor a Worker Group claim batch above 32 - #49
Merged
Merged
Conversation
The claim-strategy dial states the group's MaxClaimBatch, but the pool size and the store's claim bound can both cut the batch that runs. The seven-way report said "up to 128" while each claim returned at most 32. A new claim-batch-ran dial records the largest claimed count off the BackWave claim span during the last run. The recorder samples only the claim span, so the job spans stay off.
A Worker Group with MaxClaimBatch 128 and PoolSize 128 claims at most 32 jobs per call, because every store clamps the claim to StoreBounds.MaxClaimBatch, which defaults to 32. The hosting test reads the claimed count off the claim span. The conformance clause asks a store with the default bounds for 128 jobs. Both fail with 32.
Every store clamped each claim to StoreBounds.MaxClaimBatch, which defaulted to 32. A group set to MaxClaimBatch 128 claimed at most 32 jobs per call, and nothing reported it. StoreBounds.MaxClaimBatch is now a safety ceiling with a default of 256. It keeps one claim statement bounded and does not set throughput. The group default stays 32, so a group that does not set MaxClaimBatch claims as before. A group whose full claim (the smaller of MaxClaimBatch and PoolSize) is above the store ceiling logs warning 2006 when it starts. It names both values and the setting to change. The Oracle page reads took their fetch window from the claim bound. They now use a fixed window of 32 rows, the value they had by default, so a raised ceiling does not grow the buffer of a monitor page. An Oracle claim sizes its window to the rows it can return, so a claim reads in one fetch trip up to the 8 MB window ceiling.
…SQL Server A raised StoreBounds.MaxClaimBatch could pass two database limits. The Oracle claim leases its jobs with one IN list, and Oracle accepts at most 1,000 expressions in a list (ORA-01795). SQL Server accepts at most 2,100 parameters in one command (error 8003). Its claim reads the tags of its jobs in one command, after the claim commits, and an outcome batch of the same size looks up parents in one command. The Oracle store now rejects a MaxClaimBatch above 1,000 when it is created, as it does for a tag bound wider than its column. The SQL Server store sends those id lists in slices of 2,000.
Contributor
Author
|
Review gate: two rounds. These findings were accepted without a code change:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A Worker Group with
MaxClaimBatchabove 32 claimed at most 32 jobs per call. The store clamped each claim toStoreBounds.MaxClaimBatch, and that bound also defaulted to 32. The group's setting was ignored with no message. This is issue 0306.Reproduction on
main(bf635f8):MaxClaimBatch128 andPoolSize128 on the in-memory store:Expected: 128, Actual: 32.Expected: 128, Actual: 32.--pool-size 128(group batch 128): the new dial readsclaim-batch-ran = largest claim 32 jobs.What changed
StoreBounds.MaxClaimBatchis now a safety ceiling with a default of 256. It keeps one claim statement bounded. It does not set throughput.WorkerGroupOptions.MaxClaimBatchkeeps its default of 32.min(MaxClaimBatch, PoolSize), is above the store ceiling logs a warning when it starts (event 2006). The warning names both values and the fix. It does not throw, so every app that starts today still starts.StoreBounds.MaxClaimBatch, so raising the ceiling would have grown every monitor page buffer. The claim usesmax(take, 32)rows, so a claim of 32 or fewer reads as before.MaxClaimBatchabove 1,000 when it is created. The claim leases its rows with one IN list, and Oracle accepts at most 1,000 expressions in a list (ORA-01795).claim-batch-randial reports the largest claim the pump ran, so a result shows the claim size that ran, not only the configured one.CONTEXT.mdadds the Claim Batch term.Scope
Not breaking for defaults. A group with
MaxClaimBatch32 or less claims exactly what it claimed before. Only a group set above 32 now gets what it configured.Two startup changes to note in the release notes:
Bounds.MaxClaimBatchabove 1,000 now throws when it is created. Before, it started and failed on the first full claim above 1,000.IJobStore.Boundsnow reports a ceiling of 256. If it clamps claims lower inside, the new Conformance clause fails for it.Blast radius
lease-fencing-modelskill for that reason: the model checks statement order and row locks, not batch size. The Oracle change sets only the client fetch size. The SQL Server change splits read-only lists into more commands.MaxOutcomeBatchdefaults to the group'sMaxClaimBatch. The SQL Server test covers a 2,200-job claim and outcome batch.Verification
All figures below are from local mode on an M1 Max, and are indicative only.
Category!=Soak, net10.0): all projects pass. Postgres 323, SQL Server 304, Oracle 359, SQLite 348, Hosting 128, BackWave.Tests 1032, and the rest. One SQLite pool stress test (Concurrent_opens_on_the_store_pool_never_share_a_native_connection) timed out once under machine load and passed alone. It does not touch this change.SqlServerConcurrentMaintenanceTests): 11 passed.ClaimBatchTests(Hosting): 128 honored; default still 32 with no warning; a ceiling of 64 gives one warning and 64-job claims; no warning whenPoolSizekeeps the claim under the ceiling.SqlServerLargeClaimTests: a claim and an outcome batch of 2,200 jobs. Before the slicing:The incoming request has too many parameters. The server supports a maximum of 2100 parameters.OracleTagBoundTests: 1,001 rejected, 1,000 accepted.OracleLobPrefetchTests: a raised ceiling does not grow a page read's window.OracleRoundTripBudgetTestsstill pins the default page window at 4,495,008 bytes and a 32-job claim.claim-batch-ran = largest claim 128 jobs(was 32 onmain).UnwrittenOutcomeSlots40,Max Auto Prepare=64in the DSN, group batch 128:claim-batch-ran = largest claim 40 jobs. The throughput of this run is not usable (median 1,310, range 1,201 to 7,906 jobs/s), because other work held the machine at a load average above 500.bench/pg-claim-bound(ac38d82) raised the Postgres store bound in the harness. The fix makes it unnecessary, so I deleted it.Follow-ups
backwave-site:authoring-a-storage-adapter.mdxstill listsMaxClaimBatch | 32.throughput-model.mdxandnode-driver.mdxdescribe the group option only and are still correct.processspan path for each job during the measured run. The cost is likely small for no-op jobs, but it is not zero.