How to Know When It’s Time to Scale Up

If you’re reading this section, chances are that you’ve come across a bottleneck on your system and you need to find the cause. A good way to diagnose the problem is to check the usage levels of each of the following resources:

  • CPU usage

  • Physical memory usage

  • I/O usage

  • Networking

This section shows how to use standard Unix tools to characterize your system’s performance.

CPU Usage

To check your system’s CPU usage, use the vmstat command. An example vmstat command and its output are shown in Example 16-4 . The argument 3 tells vmstat to report on system usage every 3 seconds.

Example 16-4. vmstat

#vmstat 3
 procs     memory            page            disk          faults      cpu
 r b w   swap  free  re  mf pi po fr de sr f0 s0 s1 s6   in   sy   cs us sy id
 0 0 0 328912 40008   0   0  0  0  0  0  0  0  0  0  0  142 40479  47 77 23  0
 0 0 0 328912 40008   0   0  0  0  0  0  0  0  0  0  0  147 40425  44 83 17  0
 0 0 0 329160 40224   0 256  0  5  5  0  0  0  3  0  0  160 38942  84 79 21  0
 0 0 0 331000 40792   0   2  0  0  0  0  0  0  1  0  0  143 40485  49 83 17  0
 0 0 0 331000 40792   0   0  0  0  0  0  0  0  0  0  0  142 40463  47 87 13  0

The last three columns, under the heading “cpu,” report the average percentage CPU usage over all processors. The “us” column reports the percentage of processor time used by user processes, the “sy” column reports the percentage CPU used by system processes, and the “id” column reports the percentage idle time. If you have the top program installed on your system, you can use it to get much the same information as ...

Get Managing IMAP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.