I am currently using Python os.getloadavg()to get an idea of the current server load(Centos 6.3)
According to python documentation os.getloadavg()"Returns the number of processes in the system execution queue averaged over the last 1, 5 and 15 minutes":
http://docs.python.org/2/library/os.html#os.getloadavg
os.getloadavg ()
Return the number of processes in the system run queue averaged over the last 1, 5, and 15 minutes or raises OSError if the load average was unobtainable.
Question:
- Is it possible to get the number of processes in the system execution queue? at the moment?
- If not, is it possible to get the average for a shorter period of time, like the last 5 or 10 seconds?
The reason I ask is because I get the average load value, and then if it is too large, I kill some processes. This can happen many times per minute, so I think that too many processes will be killed before the 1 minute average overtakes.
Thank!
source
share