perf: improve seckill consumption and timeout dispatch - #166
Merged
Merged
Conversation
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.
Commerce could admit requests faster than the single-hotspot order consumer completed them, and long runs exposed a second backlog in timeout dispatch. This change permits four bounded order consumers, narrows inventory locking, and makes timeout dispatch proportional to the ready batch instead of the accumulated queue.
At the same local 200/s five-minute load, baseline and final code each completed 60,001 orders with no dropped iterations; SQL reservation-to-order p99 changed from 9.26s to 1.70s. The repeat completed all 59,963 admitted orders but had 37 unissued startup iterations. The 400/s run still accumulated orders and had one negative receiving-time sample, so it is an overload/recovery case, not a certified sustained capacity. All final SQL inventory/ledger invariants passed. The ready-query average changed from 15,004 examined rows / 47.85ms to 4.61 rows / 0.191ms in the approximately 320-second native sampling intervals.
Environment: local M4, Docker 8 CPU / 14GB, Commerce 4 CPU, MySQL buffer pool 1GiB, durable commit settings unchanged. No positive warmup. Historical fixtures and shared Broker timers are disclosed. Final measured code is 9bb08c6; the report commit is not substituted for that SHA.
Validation:
make java-ci python-ci web-ci repo-cipassed;make test-catalog-integrationpassed 207 tests, including 17 seckill transaction tests. Independent read-only code and evidence reviews found no blocking issues. Repository checks and secret scan passed after the final reports. The final code's remote 26-check gate passed. The merged main commit e6bed53 also passed all 26 checks in https://github.com/ChanTso/citybuddy/actions/runs/34203315877. Original signing metadata and MySQL cache size were restored and Docker stopped; isolated fixtures remain explicitly UNPAID/SENT, not falsely recorded as cancelled.Results: final comparison, transaction overview.