You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A stream with compression s2 turned on stops receiving new messages after its nominal size (before compression) reaches Max Storage value reported in NATS logs during server startup, even though stream size on disk is 141 MB.
During server startup, we can see that Max Storage is 679.64 MB:
[1] 2024/12/13 20:21:59.844541 [ERR] JetStream resource limits exceeded for server
[1] 2024/12/13 20:22:09.844573 [ERR] JetStream resource limits exceeded for server
Stream size on disk:
❯ sudo du -sh /mnt/nats_data/jetstream/\$G/streams/benchstream
141M /mnt/nats_data/jetstream/$G/streams/benchstream
Stream info:
❯ nats -s localhost:4222 stream info
? Select a Stream benchstream
Information for Stream benchstream created 2024-12-13 21:14:49
Subjects: test.>
Replicas: 1
Storage: File
Compression: S2 Compression
Options:
Retention: Limits
Acknowledgments: true
Discard Policy: Old
Duplicate Window: 2m0s
Direct Get: true
Allows Msg Delete: true
Allows Purge: true
Allows Rollups: false
Limits:
Maximum Messages: unlimited
Maximum Per Subject: unlimited
Maximum Bytes: unlimited
Maximum Age: unlimited
Maximum Message Size: unlimited
Maximum Consumers: unlimited
State:
Messages: 4,597,794
Bytes: 680 MiB
First Sequence: 1 @ 2024-12-13 21:14:54
Last Sequence: 4,597,794 @ 2024-12-13 21:21:59
Active Consumers: 0
Number of Subjects: 1
Expected behavior
The stream continues to receive messages and error JetStream resource limits exceeded for server appears after stream size on disk (not size reported by stream ls) exceeds Max Storage.
nats -s localhost:4222 pub test.msg --count 100000000 "Some message test with some random content {{ ID }} and additional content so a message has some length"
After some time we can see in NATS logs:
[1] 2024/12/13 20:21:59.844541 [ERR] JetStream resource limits exceeded for server
[1] 2024/12/13 20:22:09.844573 [ERR] JetStream resource limits exceeded for server
[1] 2024/12/13 20:22:19.844624 [ERR] JetStream resource limits exceeded for server
[1] 2024/12/13 20:22:29.844651 [ERR] JetStream resource limits exceeded for server
The text was updated successfully, but these errors were encountered:
At the moment this is indeed the way how it's implemented. All limits use the total bytes as reported through nats stream info/ls/report, and not the underlying size on disk.
I'm guessing that that hasn't been implemented yet, as when using compression there's a variable rate of how efficient it will be, and deleting/erasing a message could actually increase size after compression. So those are some things that would need to be accounted for when fixing this. Although not sure yet when this would get fixed as there's more priority on making other fixes at the moment.
Observed behavior
A stream with compression s2 turned on stops receiving new messages after its nominal size (before compression) reaches Max Storage value reported in NATS logs during server startup, even though stream size on disk is 141 MB.
During server startup, we can see that
Max Storage
is 679.64 MB:After sending some messages to a stream with compression turned on, no new messages appear on it. Stream size reported by
nats stream ls
is 680 MiB:And in server logs we can see following messages:
Stream size on disk:
Stream info:
Expected behavior
The stream continues to receive messages and error
JetStream resource limits exceeded for server
appears after stream size on disk (not size reported bystream ls
) exceedsMax Storage
.Server and client version
Server version:
Note: upgrading to NATS 2.10.23 (latest) doesn't fix this.
Client version:
Host environment
Docker on Ubuntu 24.04, Kubernetes 2.28
Steps to reproduce
On Ubuntu:
After some time we can see in NATS logs:
The text was updated successfully, but these errors were encountered: