Hi all,
When you monitor the CPU and memory usage, how often do you do it ? Do it too often or too rarely will both cause the problem. So does anyone have hand-on experience ?
And for my case, the requirement says that when CPU usage is above
X% or memory usage is above
Y%, I should reject the further request but no further words for how long when the system is overloaded that I should reject the further request. But the requirment does mention that for each accepted request I should send ack back in
Z seconds.
So my initial thought is that I should monitor CPU and memory usage when my app begins to run (and till it exits), and if the CPU/memory usage keeps running above the threhold
for Z seconds I should let then let request processing part know it and reject the further request.
It seems to an easiest answer. But any other thought ?
And how oftern should I monitor the CPU/Memory usage within this Z seconds ?
Besides, my app is a Java app but for the monitroing part I just want to write a script to call commands like sar/top/vmstat. So how these 2 parts communicate ? socket or keep checking the log file ?
Thanks in advance!
---------- Post updated at 07:58 PM ---------- Previous update was at 02:47 AM ----------
I google the topic for a while and only find this article discussing about the sampling rate
InformIT: Windows 2000 Performance Tools: Leverage Native Tools for Performance Monitoring and Tuning > Performance Monitor
But it only discusses things like the more often you sample, the more disk space performance log files require. Still no words about how sampling rate affects system performance itself.
Besides, how do I calculate the cpu/memory usage? Should I average the sample data or count times (in a row) that CPU/memory usage are above the threshold and set another threshold for that count number ?
Any idea ? Thanks!