3

On a heavily loaded database server, I am getting vastly different output from top and iostat for cpu usage. Why might the value be different?


top:

%Cpu(s): 84.7 us, 11.8 sy,  0.3 ni,  2.4 id,  0.6 wa,  0.0 hi,  0.2 si,  0.1 st 

iostat

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
          19.78    0.17    2.51    1.10    0.03   76.42

Note that iostat is reporting significant idle percentage and top is not.

Thomas
  • 4,155
  • 5
  • 21
  • 28
AgDude
  • 181
  • 7
  • I/O and CPU usage are not the same thing. Whatever it's doing is CPU-intensive but not very I/O intensive. – ceejayoz Oct 31 '17 at 18:27
  • 1
    That is a true statement. iostat reports on both I/O and CPU utilization, this question is about the CPU utilization portion of the report. If I misunderstand the manpage for iostat, please clarify. – AgDude Oct 31 '17 at 18:30
  • @ceejayoz please reconsider your downvote. As it appears you had a misunderstanding about the capabilities of iostat. – AgDude Oct 31 '17 at 19:16

1 Answers1

4

The reason for this is that on a single run of iostat the statistics reported are since system boot. iostat -c 2 2 will report once since boot, then 2 seconds later with a second report since the previous.

In this case it matched closely with top.

AgDude
  • 181
  • 7