If your system has insufficient main memory for all the information it needs to work with, it will move pages of information to your swap area or swap entire processes to your swap area. Pages that were most recently used are kept in main memory, and those not recently used will be the first moved out of main memory.
System administrators spend a lot of time determining the right amount of swap space for their systems. Insufficient swap may prevent a system from starting additional processes, hang applications, or not permit additional users to get access to the system. Having sufficient swap prevents these problems from occurring. System administrators usually go about determining the right amount of swap by considering many important factors, including the following:
How much swap is recommended by the application(s) you run? Use the swap size recommended by your applications. Application vendors tend to be realistic when recommending swap space. There is sometimes competition among application vendors to claim the lowest memory and CPU requirements in order to keep the overall cost of solutions as low as possible, but swap space recommendations are usually realistic.
How many applications will you run simultaneously? If you are running several applications, sum the swap space recommended for each application you plan to run simultaneously. If you have a database application that recommends 200 MBytes of swap and a development tool that recommends 100 MBytes of swap, then configure your system with 300 MBytes of swap, minimum.
Will you be using substantial system resources on peripheral functionality such as NFS? The nature of NFS is to provide access to file systems, some of which may be very large, so this use may have an impact on your swap space requirements.
Swap is listed and manipulated on different UNIX variants with different commands. The following example shows listing the swap area on a Solaris system with swap -l:
These values are all in 512 KByte blocks. In this case, the free blocks are 209504, which is a significant amount of the overall swap allocated on the system.
You can view the amount of swap being consumed on your HP-UX system with swapinfo. The following is an example output of swapinfo:
# swapinfo
Kb Kb Kb PCT START/ Kb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 49152 10532 38620 21% 0 - 1 /dev/vg00/lvol2
dev 868352 10888 759160 1% 0 - 1 /dev/vg00/lvol8
reserve - 532360 -532360
memory 816360 469784 346576 58%
Following is a brief overview of what swapinfo gives you.
In the previous example, the “TYPE” field indicated whether the swap was “dev” for device, “reserve” for paging space on reserve, or “memory.” Memory is a way to allow programs to reserve more virtual memory than you have hard disk paging space setup for on your system.
“Kb AVAIL” is the total swap space available in 1024-byte blocks. This includes both used and unused swap.
“Kb USED” is the current number of 1024-byte blocks in use.
“Kb FREE” is the difference between “Kb AVAIL” and “Kb USED.”
“PCT USED” is “Kb USED” divided by “Kb AVAIL.”
“START/LIMIT” is the block address of the start of the swap area.
“Kb RESERVE” is “-” for device swap or the number of 1024-byte blocks for file system swap.
“PRI” is the priority given to this swap area.
“NAME” is the device name of the swap device.
You can also issue the swapinfo command with a series of options. Here are some of the options you can include:
-m | to display output of swapinfo in MBytes rather than in 1024-byte blocks. |
-d | prints information related to device swap areas only. |
-f | prints information about file system swap areas only. |
3.133.138.134