When the system's physical memory is insufficient, a portion of the physical memory needs to be released for use by the currently running program. The allocation of Swap space is important, but the performance monitoring during system operation is more valuable. Through performance monitoring tools, you can check the performance indicators of the system and find the bottleneck of the system performance. This article only describes some Swap-related commands and usage in Solaris.
The most common command is that the Vmstat command has such commands on most Unix platforms. This command can be used to view most performance indicators.
For example:
- # vmstat 3 procs -------memory-------- -swap- --io-- -system- ---cpu--- r b w
- swpd free buff cache si so bi bo in cs us sy id 0 0 0 0 93880 3304
- 19372 0 0 10 2 131 10 0 0 99 0 0 0 0 93880 3304 19372 0 0 0 0
- 109 8 0 0 100 0 0 0 0 93880 3304 19372 0 0 0 0 112 6 0 0 100
- …………
Swap space commands:
Parameters after vmstat specify the time interval for performance indicator capture. 3 indicates capture every three seconds. The first line of data does not need to be viewed and has no value. It only reflects the average performance since the startup. Starting from the second line, the system performance indicators within three seconds are reflected. The following items are related to the Swap space in these performance indicators:
W under procs
It indicates the number of processes that need to be released and swapped out within three seconds.
Swap under memory
It indicates the size of the Swap space used.
Si, so in Swap space
Si indicates the total number of Swap in memory exchanged per second within the current three seconds. Unit: kbytes; so indicates the total number of Swap out memory exchanged per second within the current three seconds. Unit: kbytes.
The larger the number of indicators, the more busy the system. The system busy level of these indicators depends on the specific configuration of the system. During normal system operation, the system administrator should write down the values of these indicators and compare them when a system problem occurs. Then, the system administrator will soon find the problem, standard indicators for normal operation of the system are formulated for performance monitoring.
In addition, you can use Swapon-s to easily view the current usage of Swap resources.
Example: # swapon-s Filename Type Size Used Priority/dev/hda9 partition 361420 0 3
It is easy to see the size of Swap space used and unused resources. Swap load should be kept below 30% to ensure good system performance.