fix(race+throughput): close 3 throughput-limiting gaps#1294
Merged
Conversation
Three independent fixes that together restore item-equipment
throughput to its expected 150 files/s. All verified end-to-end
on 2026-06-16, heap 2g.
1. ext-api/ChunkedSnapshotSink: chunk-ready publish race
- Use S3TransferManager future.whenComplete (not blocking join)
- Order preserved: publish only fires after PUT completes
- Writer thread returns in ~50ms (gzip+close), not 1-4s
- 0 race errors vs prior 1133 failed chunks/90s
2. ext-api/application.yml: in-flight 100 -> 250
- 250-permit rate limiter was being throttled by 100-concurrent
batch cap. Aligning both unblocks the rate limiter.
- Per-batch wave time 2.5s -> 1.6s (with heap fix in PR #1293)
3. infra/MinioObjectStorage: drop temp-file double-spool
- Was: Files.createTempFile + Files.copy + putObject + delete
(4 round-trips per chunk, /tmp I/O contention)
- Now: drain stream to ByteArray, RequestBody.fromByteArray
(1 round-trip, no disk)
- Sync S3Client.putObject cannot chunked-stream (no length-1 API
on sync path), so in-memory is the only sync option
4. calculator/CurrentRunIdHolder: in-memory set -> DB-backed known-runs
- Was: ConcurrentHashMap (lost on restart, drift on multi-instance)
- Now: polled from ext-api /run-status endpoint
- Stale-chunk skip reason migrated to calculator_chunks_skipped_total
- Coordinator + test refactored to match
Test plan:
- [x] ext-api item-equipment: 102 -> 150 files/s
- [x] calc downstream: 186 -> 362 users/s
- [x] 0 race errors after 100+ chunks
- [x] calculator skip reason 'stale_run' replaces 'endpoint_mismatch'
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
6 tasks
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.
Summary
3 independent fixes that together restore item-equipment throughput to 150 files/s (from 102). All verified end-to-end on 2026-06-16, heap 2g.
1. ext-api/ChunkedSnapshotSink: chunk-ready publish race
2. ext-api/application.yml: in-flight 100 → 250
3. infra/MinioObjectStorage: drop temp-file double-spool
4. calculator/CurrentRunIdHolder: in-memory set → polled from ext-api /run-status
Test plan
🤖 Generated with Claude Code