-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Leak memory when creating a consumer name with jetstream. #4289
Comments
As a system user what does |
How many JetStream assets do you have running? |
I build a cluster of 3 jetstream nodes to serve to create a lot of ephemeral consumers to receive messages. The number of consumers is more than 10000. And I have a memory leak. The problem is that sync.Map stores the names of the consumers and doesn't release. I use the Go programming language and the nats.go library to do this. Don't know what I did wrong? |
So you create 10k consumers, then go back to 0 and want the memory to be returned to the kernel? Or do you think we are not cleaning up an internal client when we create consumers? |
Thanks will take a look, this is helpful. Much appreciated. |
If we created lots of hashes, beyond server names, like for consumer or stream NRG group names etc, these maps would grow and not release memory. Performance hit is ~300ns per call, and we can use string intern trick if need be at a future date since it is GC friendly. Signed-off-by: Derek Collison <derek@nats.io> Resolves #4289
Should be resolved and will be in next release, 2.9.21 probably next week. |
Thank you very much!! |
I have problem leaking mem in sync.(*Map).Store in function github.com/nats-io/nats-server/v2/server.getHashSize.
I debug using go tool pprof. Help me please!
The text was updated successfully, but these errors were encountered: