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

nats-io / nats-server / 42447831269
76%

Build:
DEFAULT BRANCH: main
Ran 08 Nov 2026 05:46AM 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.89% (+0.1%) from 77.773%
42447831269

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)

69644 of 89413 relevant lines covered (77.89%)

356724.13 hits per line

Coverage Regressions

Lines Coverage ∆ File
45
75.14
-0.81% src/github.com/nats-io/nats-server/server/raft.go
19
85.95
-0.13% src/github.com/nats-io/nats-server/server/stream.go
17
83.46
0.24% src/github.com/nats-io/nats-server/server/jetstream_cluster.go
13
88.03
0.21% src/github.com/nats-io/nats-server/server/consumer.go
13
82.33
0.23% src/github.com/nats-io/nats-server/server/memstore.go
12
73.38
0.08% src/github.com/nats-io/nats-server/server/jetstream_api.go
8
93.58
-0.39% src/github.com/nats-io/nats-server/server/gateway.go
7
88.57
-0.11% src/github.com/nats-io/nats-server/server/server.go
6
89.69
-0.14% src/github.com/nats-io/nats-server/server/client.go
6
79.56
0.52% src/github.com/nats-io/nats-server/server/filestore.go
5
84.72
-0.05% src/github.com/nats-io/nats-server/server/jetstream.go
5
89.4
-0.12% src/github.com/nats-io/nats-server/server/leafnode.go
3
83.83
-0.15% src/github.com/nats-io/nats-server/server/events.go
3
62.64
-0.02% src/github.com/nats-io/nats-server/server/opts.go
2
81.39
2.73% src/github.com/nats-io/nats-server/server/monitor.go
Jobs
ID Job ID Ran Files Coverage
1 42447831269.1 08 Nov 2026 05:46AM UTC 66
77.89
GitHub Action Run
Source Files on build 42447831269
  • Tree
  • List 66
  • Changed 15
  • Source Changed 0
  • Coverage Changed 15
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #42447831269
  • 59bf235a on github
  • Prev Build on main (#42339545444)
  • Next Build on main (#42757469028)
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