[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 341
  • Last Modified:

More frequent load average readings

I'm trying to track down CPU spikes i'm seeing, and I'd like to have a more frequent load average reading. With "top" or "uptime", the smallest interval is 1 minute. Is there any way to see the load average over the past 10 seconds or past 5 seconds?

Thanks in advance
0
timdr
Asked:
timdr
  • 5
  • 4
  • 3
  • +1
1 Solution
 
PsiCopCommented:
Actually, top will do intervals as small as 1 second. Should be the "s" key to change the update delay.
0
 
ravenplCommented:
or run the top in batch mode every 1 second (or so)
top -b -d1 -n10 > logfile.txt # where -d1 means every second -n10 means only 10 runs(omit to run forever)
0
 
xDamoxCommented:
Hi,

You can do this:

watch -n 10 uptime

This will run uptime every 10 seconds also for top I think you can do:

top -d 10

Which will delay for 10 seconds
0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
timdrAuthor Commented:
The problem with all of these is that the load average values it shows at the top are still for the past 1 min / 5 min / 10 min. Unless i'm mistaken?
0
 
ravenplCommented:
Yes(1/5/15 min). And the system does not provide You another counters.
What loadavg would You like? You could try counting it by Yourself...
0
 
xDamoxCommented:
Hi,

the following:

watch -n 1 uptime

That will update ever second I am 100% sure.
0
 
timdrAuthor Commented:
How would I count it myself?

The reason I'm looking for something more frequent is because it's hard to tell what process is causing the problems if I have to wait a minute to see its affects. Is there may another way to find what process sucks up the most resources?
0
 
xDamoxCommented:
Hi,

Run the command:

top -d 1

This will show you every second what is happening
0
 
ravenplCommented:
> if I have to wait a minute to see its affects.
You don't have to wait one minute. loadavg shows You average load during last minute, but it's updated every second (or even more frequently).
0
 
timdrAuthor Commented:
right, but what if a process starts going cpu heavy. It wont' show up instantly on the load average, since its an average of the past minute.
0
 
ravenplCommented:
Then use top with -b -d1 options as I and xDamox suggested

> How would I count it myself?
Well, You would have to write proggram/script which would monitor current CPU by process usage and current loadavg. Propably with 'top -b' anyway.
0
 
timdrAuthor Commented:
ok, good to know. Thank you for the help here.
0
 
ravenplCommented:
In the second comment You also have top -d and even more !!!
0

Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

  • 5
  • 4
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now