New tricks to explore the mysteries of the Linux system Swap zone (2)
Source: Internet
Author: User
New users look at the tricks to uncover the mystery of the Linux system Swap zone (2)-Linux general technology-Linux technology and application information, the following is a detailed reading. The distribution of system performance monitoring 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 the Vmstat command (which is available on most Unix platforms), which allows you to view most performance metrics.
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 0 0 10 2 19372 10 0 0 99
0 0 0 0 93880 3304 0 0 0 19372 8 0 0 109
0 0 0 0 93880 3304 0 0 0 19372 6 0 0 112
............
Command description:
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. Swap-related performance indicators include the following:
W under procs
It indicates the number of processes that need to be released and swapped out in the current (within three seconds.
The swpd in memory indicates the size of the Swap space used.
Si, so under Swap
Si indicates the total number of Swap memories exchanged per second (within three seconds), measured in kbytes. so indicates the total number of Swap memories exchanged per second (within three seconds, the Unit is 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. For 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.
System commands for Swap operations
To increase the Swap space, take the following steps:
1) become a Super User
$ Su-root
2) create a Swap file
# Dd if =/dev/zero of = swapfile bs = 1024 count = 65536
Create a swap file with continuous space.
3) activate the Swap file
#/Usr/sbin/swapon swapfile
Swapfile refers to the swap file created in the previous step. 4) now the newly added Swap file has taken effect, but after the system restarts, it does not remember the previous steps. Therefore, you must record the file name and Swap type in the/etc/fstab file, for example:
/Path/swapfile none Swap sw, pri = 3 0 0
5) check whether the Swap file is added
/Usr/sbin/swapon-s
Delete unnecessary Swap space.
1) become a Super User
2) use the Swapoff command to reclaim Swap space.
#/Usr/sbin/swapoff swapfile
3) edit the/etc/fstab file and remove the entity of the Swap file.
4) reclaim the file from the file system.
# Rm swapfile
5) Of course, if the Swap space is not a file but a partition, you need to create a new file system and then mount it to the original file system.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service