2

I am trying to find the bottleneck of a server running a fairly busy php/mysql site. My first culprit was io but iostat shows that on average iowait consumes only %3.60 of cpu time. here is the complete result of issuing iostat:

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
          65.78    0.00    8.52    3.60    0.00   22.10

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda              42.36       138.28      1754.70  408630278 5185216128

So I am wondering if the iowait is within acceptable range, and if not, whether switching from SATA to SSD would dramatically reduce it?

alfish
  • 3,027
  • 15
  • 45
  • 68
  • could you list what hardware does this server have? like how many disks, type & CPU, RAM? – JMS77 Aug 05 '11 at 02:26
  • Did you take a look at `atop` or `htop` to see if you have any processes is eating RAM or CPU? You can also sort by `IO_RBYTES`, `IO_WBYTES` in `htop`. – quanta Aug 05 '11 at 03:06
  • @John/ZFS: The server has Xeon 3330 2.66GHz with 2x2TB WD hard disks and 8GB RAM – alfish Aug 05 '11 at 15:03
  • @quanta: The two main consumers of RAM and CPU are mysql and php5-fpm – alfish Aug 05 '11 at 15:11

2 Answers2

6

iowait, as a measure of system load, is only a problem inasmuch as it's consuming CPU time that could be reasonably used by other processes. If you've still got idle CPU time, then high iowait (in and of itself) is not a problem.

On the other hand, a high iowait can be a symptom of a problem; however, you really should be profiling your application to see if time spent in disk I/O is a significant percentage of the total time taken to complete a useful task. You cannot do this by looking at CPU stats, top, htop, iotop, or any other system-level tool that people will try to recommend. You need to look at your application, and the way it works, to determine if changing disk I/O subsystem would be of any benefit in your application.

womble
  • 95,029
  • 29
  • 173
  • 228
3

Disk utilisation is more important, you can measure that with:

iostat -xm 5

it will probably say close to 100%

quanta
  • 50,327
  • 19
  • 152
  • 213
Joshua D'Alton
  • 428
  • 2
  • 13
  • A bit of a necro-comment, but this answer does not seem to be very relevant with modern architectures any more. [Here](https://www.percona.com/blog/2014/06/25/why-util-number-from-iostat-is-meaningless-for-mysql-capacity-planning/) is a post that goes into some more detail, in case anyone else is also trying to wrap their head around these concepts. – user991710 Mar 17 '21 at 08:37