apache / distributedlog

Apache DistributedLog
Apache License 2.0
185 stars 74 forks source link

jmx emote Monitoring #188

Closed Li-Haihui closed 7 years ago

Li-Haihui commented 7 years ago

Is this a question, feature request, or bug report?

QUESTION

now, I want to realize the remote monitoring for distributedlog-0.5.0; I do this for looking the CPU utilization and thread call state. Then I can optimization program, How can I do?

sijie commented 7 years ago

both bookkeeper and distributedlog use the StatsProvider interfaces for exposing and collecting stats. There are different stats providers available in http://bookkeeper.apache.org/docs/latest/admin/metrics/. You can also have a stats provider implementation that use your own monitoring systems.

If you don't have any monitoring systems, and if you are running in k8s, you are recommended to use the Prometheus stats provider, which prometheus has been integrated with k8s heavily.

Or you can just use the default codahale stats provider.

http://bookkeeper.apache.org/distributedlog/docs/latest/admin_guide/monitoring.html has the instructions on how to configure and use the stats provider.

for codahale stats provider, you can configure a jmx reporter to report all the stats via JMX - by specifying the jmx endpoint in the configuration codahaleStatsJmxEndpoint: https://github.com/apache/bookkeeper/blob/master/bookkeeper-stats-providers/codahale-metrics-provider/src/main/java/org/apache/bookkeeper/stats/CodahaleMetricsProvider.java#L73

Hope this help.

Li-Haihui commented 7 years ago

oh, thanks. but I want to see the progrom's CPU utilization. then find which function take the CPU resource , like jmx + jconsole or jmx + jvisualvm.

sijie commented 7 years ago

@Li-Haihui : hmm I am not sure I understand your question. it is a java process, if you run a jmx reporter (for example codahale stats provider), you should be able to jconsole to it, right?

Li-Haihui commented 7 years ago

in there,i don't care about lantency. i just want to know CPU utilization and thread switches. like jvisualvm to performance monitor.

sijie commented 7 years ago

@Li-Haihui : understand that. what I mean here is the codehale stats provider will run the jmx, which then you can use console and jvisualvm to connect to jmx.

because basically what you need is running jmx, right?

Li-Haihui commented 7 years ago

@sijie :yes. how to do that.

sijie commented 7 years ago

@Li-Haihui :

what I suggested above is about running jmx :-)

currently bk and dl doesn't run jmx directly. codahale stats provider is able to run jmx. if you use codahale stats provider and configure the jmx endpoint, it will run jmx for you.

Li-Haihui commented 7 years ago

but how to configure the jmx endpoint, same to codahale stats provider? so how do you to care about the CPU?

sijie commented 7 years ago
Li-Haihui commented 7 years ago

sorry, i don't find this configure . where is it?

Li-Haihui commented 7 years ago

@sijie Thanks! for the benchmark,i have solved this problem.

sijie commented 7 years ago

awesome! @Li-Haihui