-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
The memory usage of jetstream pod is large [v2.10.20] #5870
Comments
if the system is running in k8s, need to make sure that you are setting GOMEMLIMIT so that that GC does not work based on the host memory instead. |
Can you please provide memory profiles so we can see what's going on? Either |
@neilalexander |
It's a configuration option on the NATS Server config file, if you are doing it under Kubernetes you may need to do something like this:
|
Also note that you don't need |
mem.prof.zip |
Thanks @AllenZMC! @neilalexander will take a look. |
Thanks for the profile, was this taken when the memory usage was inflated? It is only showing 30MB heap allocations. Are you using |
It is indeed obtained when the memory is very large. I also feel confused. And what is |
How are you measuring memory? |
container_memory_working_set_bytes{pod='a', namespace='b', container='c'} |
Is that RSS or VSS? |
|
That means its RSS, Resident Set Size. Do you set GOMEMLIMIT as an ENV for the pod running the server? This is required for Go applications when the host has more memory then is being allocated to the pod running the nats-server. |
No set. |
What are you restricting the pod's memory to? What does the underlying host memory look like? |
I configured resource limits in the container, for example
|
That is a big spread. You could try GOMEMLIMIT=6Gi |
In addition, I want to point out that I am using a memory stream. When the stream data is automatically cleared, the memory still does not decrease much. In theory, if there is no data in the stream, NATS server should occupy very little memory. |
What is the maximum size for the memory stream that you expect to have? What does stream info report for that stream when you see the general memory usage issue? |
The maximum memory flow is 4G, no problem is seen, and when there is no message in the mem stream, the NATS pod service still occupies a large amount of memory. 😮💨 |
Can you please run |
Observed behavior
The memory usage of jetstream pod is large and remains at 2Gi. At this time, the jetstream stream does not have any memory data. Why is this?
In addition, when the pod is restarted, the memory usage will be very small, about tens of MB.
What is the reason for this?
Expected behavior
When the jetstream stream does not have any memory data, it will theoretically reduce memory usage.
Server and client version
nats-server: v2.10.20
Host environment
No response
Steps to reproduce
No response
The text was updated successfully, but these errors were encountered: