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 0The 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 vmstat provides.
What is a ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access