How to find CPU load (as a percentage of CPU usage) in a node slave

Hi, I am developing a load balancing algorithm in java. On my system there will be one node node and a list of subordinate nodes, where the master node will propagate the incoming request to one of its slave nodes. I want to find the CPU load (as a percentage of the CPU used) in each of the subordinate nodes. So that the node wizard can efficiently distribute the request to one of its least loaded node slaves. Can anyone suggest me how we can find him.

The getSystemLoadAverage() method in JMX 

can be used to find the processor load of the current system. Is it possible to use the same method to find the load in the subordinate too .. If possible, suggest me how we can find it. If this is not possible, offer me another way to do the same. I will be more grateful if someone provides you with the correct answer.

0
source share
2 answers

If you have mbean on slaves, you can control the memory used, CPU, etc. I suggest you add some external monitoring application that you control through mbean, and collect data through mbean and send it to the master.

You should not assume that if the processor is used at 10%, it can take more jobs. What if memory is 90%, there may be other things.

EDIT 1:
Links for mbeans:
http://docs.oracle.com/javase/tutorial/jmx/mbeans/standard.html
Scroll down: http://java.sun.com/developer/technicalArticles/J2SE/jmx.html

0
source

Check out Sigar: http://www.hyperic.com/products/sigar

It has language and platform bindings for just about anything. I have used a cigar many times. It just works reliably and fairly. And you get a lot more statistics on the platform than just loading the processor, which may be convenient depending on what additional information you may need.

0
source

Source: https://habr.com/ru/post/908062/


All Articles