-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fix: metrics still taking up too much memory when metrics.UseNilMetrics=true #1973
Conversation
Fix metrics taking up too much memory
@qiangmzsx whilst the suggested change is probably fine, I'm surprised that you're hitting a problem here. How many brokers are in the cluster you're connecting to? Are you showing allocs in your pprof or actual inuse? Can you share the full pprof file via https://share.polarsignals.com/ maybe? Essentially: a) all metrics registered by broker.Open will be unregistered during a broker.Close and become eligible for GC thereafter b) if you're already setting |
I am glad to receive such a quick reply from you. I'll put the heap file of the capture in the attachment. |
I'm very sorry for my mistake, I clicked close by mistake, actually I didn't close. But I don't know how to deal with it anymore. |
@dnwe
One can get.
What we need to see is that the memory usage in this monitoring scenario is not visible in a short period of time and requires two or three weeks or even a month of uninterrupted operation. |
To make it more obvious, I set the loop to call the BenchmarkBroker_No_Metrics_Open: BenchmarkBroker_No_Metrics_Open.out.zip |
@qiangmzsx are you able to sign the CLA? |
I have signed and completed the CLA。 |
@dnwe Do I need any more information from my side? |
@qiangmzsx did you see the failing gofmt check? broker_test.go:1076: File is not |
|
Thanks for your contribution! |
Fix metrics taking up too much memory
We call
broker.Open()
multiple times, and we have the problem of excessive memory usage.The crawl flame graph can be seen as follows.
The fix is to turn off the call to
registerMetrics
when settingmetrics.UseNilMetrics=true
.