aboutsummaryrefslogtreecommitdiff
path: root/setup/jetstream
diff options
context:
space:
mode:
authorNeil <neil@nats.io>2024-09-10 19:54:38 +0100
committerGitHub <noreply@github.com>2024-09-10 20:54:38 +0200
commit117ed6603705d10681cd1d05ada1889d07ea738b (patch)
treece1fd24892504c6fe185b9e1c745bef1d42e72a4 /setup/jetstream
parent3a2eadcc3690204fba3c858c43977b50068e77bb (diff)
Update NATS to 2.10.20, use `SyncAlways` (#3418)
The internal NATS instance is definitely convenient but it does have one problem: its lifecycle is tied to the Dendrite process. That means if Dendrite panics or OOMs, it takes out NATS with it. I suspect this is sometimes contributing to what people see with stuck streams, as some operations or state might not be written to disk fully before it gets interrupted. Using `SyncAlways` means that NATS will effectively use `O_SYNC` and block writes on flushes, which should improve resiliency against this kind of failure considerably. It might affect performance a little but shouldn't be significant. Also updates NATS to 2.10.20 as there have been all sorts of fixes since 2.10.7, including better `SyncAlways` handling. Signed-off-by: Neil Alexander <git@neilalexander.dev> --------- Signed-off-by: Neil Alexander <git@neilalexander.dev> Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
Diffstat (limited to 'setup/jetstream')
-rw-r--r--setup/jetstream/nats.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/setup/jetstream/nats.go b/setup/jetstream/nats.go
index 8630a141..c6b88e00 100644
--- a/setup/jetstream/nats.go
+++ b/setup/jetstream/nats.go
@@ -56,6 +56,7 @@ func (s *NATSInstance) Prepare(process *process.ProcessContext, cfg *config.JetS
MaxPayload: 16 * 1024 * 1024,
NoSigs: true,
NoLog: cfg.NoLog,
+ SyncAlways: true,
}
s.Server, err = natsserver.NewServer(opts)
if err != nil {