LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Performance (https://www.linuxquestions.org/questions/linux-general-1/performance-924777/)

mikevanhoff 01-20-2012 06:56 AM

Performance
 
I am running RedHat Linux 6.1 64bit in a virtual environment. 2 CPUs 4GB RAM.
I have been seeing 12 to 14 hour spikes in CPU utilization, but have not been able to pinpoint WHAT process(s) is using the CPU.
Can sar give me this information> If so, can someone give me an example command, and how to interpret the output?
If sar cannot give me this information, is there another tool that can?

Thanks in Advance

Janus_Hyperion 01-20-2012 07:10 AM

You could try using the command top to see which processes are eating up the CPU. I do not know what the command sar is but top is what I use.

mikevanhoff 01-20-2012 07:44 AM

Top would only be good if I happen to be there.
I need to find out what process was causing the spike at the time of the incident.
Any ideas would be good

salasi 01-20-2012 09:07 AM

Quote:

Originally Posted by mikevanhoff (Post 4579745)
Top would only be good if I happen to be there.
I need to find out what process was causing the spike at the time of the incident.
Any ideas would be good

Any ideas? Well, use, eg top from a script that captures a lot of sequential top outputs, and look at the top outputs when the load spike happened.

Quote:

seeing 12 to 14 hour spikes in CPU utilization
It makes a bit of a difference if you mean a short spike every 12 - 14 hours, or a spike that lasts 12 - 14 hours. Which?

Janus_Hyperion 01-20-2012 09:26 AM

Quote:

Originally Posted by salasi (Post 4579815)
Any ideas? Well, use, eg top from a script that captures a lot of sequential top outputs, and look at the top outputs when the load spike happened.

Exactly. This is what I meant. Sorry for not being clear.

sundialsvcs 01-20-2012 09:35 AM

Does the load spike occur in the middle of the night, say, when a cron job might be running?

mikevanhoff 01-20-2012 09:39 AM

Quote:

Originally Posted by salasi (Post 4579815)
Any ideas? Well, use, eg top from a script that captures a lot of sequential top outputs, and look at the top outputs when the load spike happened.



It makes a bit of a difference if you mean a short spike every 12 - 14 hours, or a spike that lasts 12 - 14 hours. Which?

the last spike lasted 12 hours. I am not worried about short spikes - that would be normal work.

I will give the top script idea a go, and hopefully the incident will repeat itself.

Thanks all.

salasi 01-20-2012 04:00 PM

OK, sorry, my last reply was a bit curt, but I was in a bit of a hurry; here are a few more fragments;
  • if you look at the top man page, there is a non-interactive option, and that writes an ordinary top page, but only a single page, and it sounds as if that is what you want, and you probably want to append that to your capture file
  • you also probably want to write something that tells you what things looked like, from a system point of view, at the time; one possibility is to write an accompanying 'uptime' to the file; while it doesn't sound as if you are interested in the uptime, per se, uptime also contains the clock time and the load average numbers, and those you are interested in
  • so, my impression is that you might want to append an 'uptime' and a 'top' from a script, and maybe run the script that does this again and again from a cron job, say every fifteen minutes (or faster or slower, depending on how much resolution you need and how big a file that you feel like building...with time periods like this, it probably isn't a big problem, if you are looking for, say, sub 100 mS pulses, everything changes, both because of the amount of data, if you leave it for a couple of days, and because you probably wouldn't want to use the cron job option, in that case)
  • an alternative would just be send the script to sleep, rather than a cron job


All times are GMT -5. The time now is 07:31 PM.