-
Notifications
You must be signed in to change notification settings - Fork 38
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
better CPU metric support #18
Comments
@ngzhian Zhi An, could you please have an initial look at this issue and let me know your observations about it? |
@dpocock by percentage do you mean CPU time used by JVM over total CPU time? |
Actually, we need to work out the correct definition for this. Have you seen the CPU graphs in JConsole? I believe it takes the same raw values from JMX. You could try making some simple code that starts 2 threads, each using 100% of a CPU core and see how that looks in JConsole for a CPU with 4 or more cores. |
Going back to gmond monitor-core diff = user_jiffies - last_user_jiffies;
val.f = ((double)diff/(double)(total_jiffies - last_total_jiffies)) * 100.0; which translates to, portion of total CPU time spent on user activity over a particular time period. So a simple way is to use take I have taken a few pictures and also wrote a simple program that loops and uses CPU cycles so that I could examine jconsole to verify the numbers, and also took some screenshots of the values in jconsole. These will be updated on a blog post soon. Also I noted some points, such as:
|
Updated everything in this blog post. Object o = mbs.getAttribute(objectName, attributeName); This will make it difficult to make modifications to the raw value of the mbeans, as in this case of sending percentage values. |
Can you just clarify one other thing about multi-CPU: lets say that you have the following:
What would the actual calculations and results be in this case? E.g. Uptime = 60 seconds What does JConsole show in this case? You don't need to worry about the other things from mod_multicpu, e.g. the system or user jiffies. Just getting Ganglia to show something comparable to the JConsole CPU graph is sufficient. |
The way jconsole does it is: |
JMX provides the ProcessCpuTime metric. It is the number of nanoseconds of CPU time used by the JVM.
Graphing the raw value in Ganglia is unhelpful.
gmond itself sends cpu_* metrics (e.g. cpu_system) and these are percentages derived from the raw tick values of the host. jmxetric could derive percentages from the JVM values and send those instead. This would be more consistent with the Ganglia design and reduce network load when values are not changing.
We should also consider how this should work for multi-threaded Java apps on multi-CPU systems.
Other projects like jmxtrans have examples of working with these values.
The text was updated successfully, but these errors were encountered: