|
Ran
|
Jobs
1
|
Files
66
|
Run time
1min
|
Badge
README BADGES
|
push
github
JetStream: fix quadratic redelivery queue copying under the consumer lock (#8635) ## Summary Advance the redelivery slice head instead of shifting every remaining entry on each dequeue. The current operation copies O(n) sequence numbers while holding the consumer mutex; draining a large retry population involves quadratic copying and delays delivery and ACK processing. At 12 million queued entries, an initial dequeue copies approximately 96 MB of sequence numbers. The change removes that copy without changing FIFO order, membership tracking, empty-queue cleanup, ACK semantics, or persistence behavior. Includes deterministic queue-operation tests and a dequeue/requeue benchmark. Sustained dequeue/requeue consumes slice capacity and occasionally reallocates; the churn benchmark measures that trade-off. This does not change consumer-store flushing or ACK scheduling. ## Reproduction A synthetic JetStream experiment seeds 12 million pending/redelivery entries, then uses real connections for pulls, progress ACKs, and server-confirmed final ACKs. With a target 20k progress commands/s and 100 final ACKs/s over approximately 20 seconds: | Two runs per variant | Baseline | Fix | | --- | ---: | ---: | | Final-ACK confirmation p95 | 12.06–12.12 s | 0.25–1.44 s | | Redeliveries | 2,298–2,369 | 120,700–416,000 | | Unprocessed ACK commands at stop | 223,714–226,528 | 2,614–26,533 | | Drain after stopping load | 11.93–12.26 s | 0.10–1.54 s | All final ACKs were confirmed after draining and expected retained-message counts were verified. The initial state is seeded internally, not accumulated by replaying an application workload. Offered rates vary under CPU pressure. These small-sample ranges are not production guarantees; the candidate still has residual backlog under this load. [Reproducible runner, raw logs, and source/environment provenance](https://github.com/as-clearview/nats-server/tree/4c0f6d21e/benchmarks/redelivery-qu... (continued)
69644 of 89413 relevant lines covered (77.89%)
356724.13 hits per line
| ID | Job ID | Ran | Files | Coverage | |
|---|---|---|---|---|---|
| 1 | 42447831269.1 | 66 |
77.89
|
GitHub Action Run |
| Coverage | ∆ | File | Lines | Relevant | Covered | Missed | Hits/Line |
|---|