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

nats-io / nats-server / 44239074582
76%

Build:
DEFAULT BRANCH: main
Ran 18 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

17 Nov 2026 03:24PM UTC coverage: 76.895% (-0.06%) from 76.952%
44239074582

push

github

web-flow
updated accConnsUpdate to use a read lock instead of a write lock. (#8905)

**Background and Rationale:**
accConnsUpdate took an exclusive server lock on every client add or
remove for named accounts. With this PR, it now takes a read lock, so
concurrent connects no longer need to serialize on it.
This change is safe because accConnsUpdate reads only s.sys and s.gacc
within the server lock and everything it writes has its own guard
anyway. Lock order is unchanged: Server -> eventIdsMu and Server ->
client -> Account.

**Prior Art:**
PR #8533 is in the same direction: An eventIdsMu mutex and skipping $G.

**Tested Hardware and Configuration:**
MBP M4 MAX
single in-process server, plain ws://, with the callout responder in the
same process.

**Evidence:**
Run this before and after the patch, comparing average of each produced
range and it will show about 10% improvement, the actual gain depends on
platform:
go test -run '^$' -bench '^BenchmarkAuthCalloutWebSocketBurst$'
-benchtime=30x -count=5 ./server

**Other Changes:**
Benchmark helpers now take testing.TB so the benchmarks can call them.

**Other Tests:**
Idle, 200, 800, and 1600 user connection storm on my auth-callout podman
composition repeatedly showed a much larger improvement, but Im not able
to explain why, so it may have been an effect of my env.

**Resolves**: https://github.com/nats-io/nats-server/issues/8904

**Future Improvement Suggestions:**
This change plus the inbox subject instead of the current unique mailbox
yields another 5-8% improvement by my measure.

Signed-off-by: Charlie Federspiel

69072 of 89826 relevant lines covered (76.9%)

306810.11 hits per line

Coverage Regressions

Lines Coverage ∆ File
60
84.02
-0.2% src/github.com/nats-io/nats-server/server/events.go
30
84.19
-1.19% src/github.com/nats-io/nats-server/server/leafnode.go
28
83.67
0.14% src/github.com/nats-io/nats-server/server/jetstream_cluster.go
22
69.01
-0.8% src/github.com/nats-io/nats-server/server/monitor.go
16
73.39
-0.08% src/github.com/nats-io/nats-server/server/jetstream_api.go
11
54.7
-0.64% src/github.com/nats-io/nats-server/server/reload.go
10
75.27
0.61% src/github.com/nats-io/nats-server/server/raft.go
9
85.99
-0.28% src/github.com/nats-io/nats-server/server/accounts.go
8
62.38
-0.14% src/github.com/nats-io/nats-server/server/opts.go
7
81.34
-0.32% src/github.com/nats-io/nats-server/server/route.go
5
79.81
-0.03% src/github.com/nats-io/nats-server/server/filestore.go
5
86.14
0.06% src/github.com/nats-io/nats-server/server/stream.go
4
87.9
-0.02% src/github.com/nats-io/nats-server/server/consumer.go
3
88.82
-0.27% src/github.com/nats-io/nats-server/server/sublist.go
2
89.67
-0.05% src/github.com/nats-io/nats-server/server/client.go
2
86.7
-0.07% src/github.com/nats-io/nats-server/server/server.go
Jobs
ID Job ID Ran Files Coverage
1 44239074582.1 18 Nov 2026 05:47AM UTC 66
76.9
GitHub Action Run
Source Files on build 44239074582
  • Tree
  • List 66
  • Changed 19
  • Source Changed 1
  • Coverage Changed 19
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #44239074582
  • 582fb8e9 on github
  • Prev Build on main (#44018925648)
  • Next Build on main (#44460059497)
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