• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nats-io / nats-server / 42339545444
76%

Build:
DEFAULT BRANCH: main
Ran 07 Nov 2026 05:47AM UTC
Jobs 1
Files 66
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

06 Nov 2026 01:04PM UTC coverage: 77.773% (+2.5%) from 75.243%
42339545444

push

github

web-flow
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)

69539 of 89413 relevant lines covered (77.77%)

335704.58 hits per line

Coverage Regressions

Lines Coverage ∆ File
856
62.66
1.6% src/github.com/nats-io/nats-server/server/opts.go
386
59.45
6.75% src/github.com/nats-io/nats-server/server/reload.go
50
83.22
-0.22% src/github.com/nats-io/nats-server/server/jetstream_cluster.go
39
75.95
0.38% src/github.com/nats-io/nats-server/server/raft.go
15
76.56
0.0% src/github.com/nats-io/nats-server/server/errors.go
15
79.04
-0.1% src/github.com/nats-io/nats-server/server/filestore.go
15
73.3
2.39% src/github.com/nats-io/nats-server/server/jetstream_api.go
10
87.82
0.09% src/github.com/nats-io/nats-server/server/consumer.go
9
85.78
8.52% src/github.com/nats-io/nats-server/server/accounts.go
5
78.66
9.72% src/github.com/nats-io/nats-server/server/monitor.go
5
86.07
1.16% src/github.com/nats-io/nats-server/server/stream.go
4
83.99
0.36% src/github.com/nats-io/nats-server/server/events.go
4
88.67
3.12% src/github.com/nats-io/nats-server/server/server.go
2
84.77
1.06% src/github.com/nats-io/nats-server/server/jetstream.go
1
89.83
1.98% src/github.com/nats-io/nats-server/server/client.go
Jobs
ID Job ID Ran Files Coverage
1 42339545444.1 07 Nov 2026 05:47AM UTC 66
77.77
GitHub Action Run
Source Files on build 42339545444
  • Tree
  • List 66
  • Changed 34
  • Source Changed 4
  • Coverage Changed 34
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #42339545444
  • 59bf235a on github
  • Prev Build on main (#42164001702)
  • Next Build on main (#42447831269)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc