Open huanggx-sea opened 3 years ago
Hi, thanks a lot for your analysis. I will certainly look into it as soon as time allows. Meanwhile, if you have a proposal how to reduce the number of strings, please post it here for discussion or create a PR.
Hi, thanks for your reply! To be honest, we don't have much experience in in Java programming.
I'm not sure whether we can use the same memory space for the String matchName
in the inner loop
for(Rule rule:config.rules){
...
String matchName=beanName+(rule.attrNameSnakeCase?attrNameSnakeCase:attrName)+": "+matchBeanValue;
...
}
This would at least make the number of String not proportional to the number of rules.
This logic was changed slightly in 0.19.0 so that the attribute snake case name is only created if required by the rule.
@huanggx-sea can you retest using 0.19.0?
Hi,
We're using strimzi kafka which uses
jmx_exporter
as a javaagent to export the metrics to/metrics
.And we find out that
Receiver.recordBean
underJmxCollector
injmx_exporter
keeps creating a large amount of String objectsArthas shows that
recordBean
is called about 10k per minute andconfig.rules
in our case is 21 long, which ends up about 210k String per minute.And we can see Young GC moving the memory from 6GB to 500MB happens about 12 minutes a time.
In the heap dump, there are lots of:
which seems to be the content of
matchName
here.Any idea how to fix this problem? Many Thanks.