| United States-English |
|
|
|
![]() |
HP Servers and Workstations: Managing Systems and Workgroups > Chapter 6 Administering a System: Managing
Disks and FilesManaging Swap and Dump |
|
This section explains how to manage your system’s swap space, including determining how much and what type of swap space the system needs, and how to add or remove swap space as the system’s needs change. It also explains how to configure your dump area. For additional information, see also:
There are three types of swap space: device swap, file system swap, and pseudo-swap space. Each is used differently by the system and has its own advantages and disadvantages. Swap space is initially allocated when you configure your disks. Device swap space occupies a logical volume or partition, which is typically reserved expressly for swapping purposes. This space may also be configured as a dump area; see “Configuring Dump ”. Device swap can only be used locally; device swap cannot be accessed remotely by clients using NFS. Device swap space is quickly accessed because the operating system can get to the logical volume or partition directly to perform large I/Os. You can additionally use available space in a file system for swap space. Setting up such file system swap space allows for extra swap if there is occasional need for more than the allocated device swap space. It is used only when device swap space is insufficient. When your system needs extra swap space, file system swap allows you to use existing file system space rather than reserving an entire dedicated logical volume or partition. However, because file system swap requires the system to perform a greater amount of processing and is usually slower than device swap, it should not be used as a permanent replacement for a sufficient amount of device swap space. The file system used for swap can be either a local or a remote file system. Cluster clients can use remote file system swap for their swap needs. Swapping to a remote file system is slower than swapping to a local file system and is not encouraged if local device swap or local file system swap is available. Pseudo-swap space allows for the use of system memory as a third type of swap space. That is, HP-UX swap space can also consist of up to seven-eighths (87.5%) of system memory capacity. For example, a computer with one GB of system memory and one GB of device and file system swap, can run up to 1.87GB of processes. If any process attempts to grow or be created beyond this extended threshold, the process will fail. When using pseudo-swap, since more processes can be created, the system load increases, causing more paging and deactivation activity. By default, pseudo-swap space is configured to be available. If you do not wish to make use of it, you will need to reset the tunable system parameter, swapmem_on, to 0 (“off”). Your system must have at least one device swap area available when it boots. This area is known as the primary swap area. (Primary swap is not mandatory if pseudo-swap is enabled, however, it is strongly recommended.) Primary swap, by default, is located on the same disk as the root file system. By default, the system’s kernel configuration file /stand/system contains the configuration information for primary swap. Other swap may be used in addition to primary swap. Such swap is referred to as secondary swap. If you are using device swap as secondary swap, allocate such secondary swap to reside on a disk other than the root disk for better performance. File system swap is always secondary swap. When designing your swap space allocation:
Available swap on a system consists of all swap space enabled as device and file system swap. To find how much swap space is presently available on your system and how much is being used, use SAM or run the command swapinfo. The output of swapinfo tells you the type of swap by location, how much of it is available, how much is used, how much is free, and how much is reserved but not allocated. For more information, refer to swapinfo(1M). Your swap space must be large enough to hold all the processes that could be running at your system’s peak usage times. As a result of the larger physical memory limits of the 64-bit hardware platforms introduced at 11.0, you will need to significantly increase the amount of swap space for certain applications on these systems. If your system performance is good, and, in particular, if you are not getting swap errors such as Out of Memory or those to the effect that a process was killed due to no swap space, then your system has adequate swap space. Typically, unless the amount of physical memory on your system is extremely large, the minimum amount of swap space should equal the amount of physical memory on the system. In general, make swap space to be roughly two to four times your physical memory. Swap space usage increases with system load. If you are adding (or removing) a large number of additional users or applications, you will need to re-evaluate your swap space needs.
Once you know or suspect that you will have to increase (or decrease) your swap space, you should estimate your swap space requirements. The following section describes one method. You can estimate the amount of swap space you need by adding the space required by the applications you expect to run on your system to the amount of physical memory you have. If you do not know the amount of physical memory on your system, you can get this information by running sam. From SAM’s main screen, select “Performance Monitors” and then “System Properties”. Finally, click on the Memory button. You will find an entry listing Physical Memory.
Divide any value of physical memory which is in KB by 1024 to obtain its value in MB. Or, if your system currently has sufficient swap space, then you can increase swap space levels to accommodate new applications. Use the following worksheet to estimate the size needed for your swap space. Remember, 1KB = 1024 bytes. For standalone (a server or otherwise) and client systems that will swap to local swap space either to a device or a file system, you can estimate your swap space needs as follows: 1. Enter the amount of the physical memory currently on the local machine. At a minimum, swap space should equal that amount. Enter the amount in KB. — — — — 2. Determine the swap space required by your largest application (look in the manual supplied with your application or check with the manufacturer; 1MB = 1,024KB = 10,248 bytes). If you will be running several applications concurrently, you should add their swap space requirements together. — — — — TOTAL local swap space needed (in KB): sum of 1 and 2 — — — — For a system that has local swap and also serves other systems with swap space, make a second estimation in addition to the one above. 1. Include the local swap space requirements for the server machine, based on the estimation from above. — — — — 2. Add up the total swap space you estimate each client requires. At a minimum, this number should equal the sum of physical memory for each client. — — — — TOTAL server swap space (in KB): sum of 1 and 2 — — — — The default maximum amount of swap space you can configure, for both device swap and file system swap combined, is approximately 512MB. The tunable system parameter maxswapchunks controls this maximum. The parameter maxswapchunks (default value of 256) limits the number of swap space chunks. The default size of each chunk of swap space is 2 MB. For example, when the value of the parameter maxswapchunks is 256, the maximum configurable device swap space (maxswapchunks x swchunk x DEV_BSIZE) is: 256 x 2 MB = 512 MB If you need to increase the limit of configurable swap space beyond the default, increase the value of the maxswapchunks operating system parameter either by using SAM (which has more information on tunable parameters) or reconfigure the kernel using HP-UX commands. The parameter swchunk is also tunable.
When you need more swap space and you have no devices available for additional device swap, or if you need to swap to a remote system, you can dynamically add file system swap to your system. Use the following guidelines:
When you add swap areas, you can assign a priority to each. Priorities range from 0 (the highest) to 10 (the lowest). The system uses the swap areas with higher priority first. The system gives device swap priority over file system swap when each has the same priority. Here are the guidelines you should use:
The primary swap area has priority 1. Device and file system swap areas set dynamically default to a priority of 1 if no priority is specified. At times when the designated device swap is insufficient, you can configure to allow a process to use an existing file system for swapping. When you enable a file system for swap, the operating system can swap to unused portions of the file system as needed. Unless you pre-allocate the swap space using the min option of the swapon command, file system swap which has not been recently used will be freed back to the file system when it needs the space. Several file systems can be used for file system swap. The tunable system parameter nswapfs determines the maximum number of file systems you can enable for swap. You can dynamically create file system swap using either SAM or the swapon command. As with device swap, you cannot modify or remove file system swap without rebooting, although you can change options within /etc/fstab file without rebooting as long as they don’t conflict with previous requests. If you use swapon to add file system swap, follow these steps:
Once file system swap has been enabled, you can remove it either by using SAM or by following these steps:
To modify a file system swap, you first remove it and then re-add the changed swap using the five steps shown above.
You can configure primary swap through the kernel configuration file, using either HP-UX commands or SAM. You can also do the following to manage your primary swap space:
File system swap is always secondary swap. Use SAM to configure file system swap and thereby set up the optional secondary swap.
A dump area is disk space used to write an image of the core memory after a system crash. The analysis of a core dump may be useful in troubleshooting and restoring the system to working order. By default, the primary swap device also serves as a dump area when no other dump area is specifically designated. Although you are not required to retain primary swap as your dump area, doing so will conserve disk space. You can configure a different or multiple dump devices on your system. To do this, you will need to create a logical volume (or disk section) as a dump device. This device can also be used, if you wish, for swap. With the 11.0 release, dump configuration allows for not only selecting which devices are to be used to store a crash dump, as in prior releases, but also, how much if any of the dump you wish to retain. Dumps no longer need to contain the entire contents of physical memory. With expanded physical memory limits, you may wish to dump only those classes of physical memory which you will use in a crash dump analysis. Further, you now have an additional way to configure dump devices: In addition to reconfiguring the kernel, at 11.0, you can also do dump configuration at runtime using the crashconf(1M) command without the need to reboot the system. You can use either of two ways to configure which classes of memory should be included in a dump. crashconf options can be used, or this information can be configured using the tunable parameters alwaysdump or dontdump when you reconfigure the kernel. You can use SAM to add, remove, or modify dump devices, and to configure how much of the dump you wish to retain. For more information, see SAM’s online help. The amount of disk space made available for core dumps should accommodate your system’s physical (core) memory. As a result of the larger physical memory limits of the 64-bit hardware platforms introduced at 11.0, you may need to significantly increase the amount of disk space for dump on these systems. (If you need to determine the amount of physical memory on your system, see “Estimating Your Swap Space Needs ”.) Because the physical memory on your system may exceed the space available in the primary swap area, you may wish to configure additional disk space for the full core memory image. Otherwise, only a partial core image will be saved which may not be sufficient for analyzing problems. If you do not use SAM to configure your dump areas, you should follow the guidelines below: Although dump areas can be configured within disk sections, it is preferable to use logical volumes. A dump logical volume can exist only within the root volume group, that is, the volume group that contains the root logical volume. To create a dump logical volume, you first use the lvcreate command. You must set a contiguous allocation policy using the -C y option and specify no bad block relocation using -r n. See lvcreate(1M) for more information. When configuring a logical volume as a dump device, you must next use lvlnboot(1M) with the -d option to update the BDRA (Boot Data Reserved Area). The BDRA maintains the information that the kernel requires about each bootable disk within the root volume group. Suppose, for example, you have created a logical volume /dev/vg00/lvol2 for use as a dump area. To update the boot information, enter:
It is possible to use any secondary swap logical volume as a dump area as well, provided the swap area is in the root volume group. To discontinue the use of a currently configured logical volume as a dump device, you use lvrmboot(1M) also with the -d option.
Before the above changes to the BDRA take effect, you must either add (in the case of lvlnboot) or remove (in the case of lvrmboot) the following line within the system configuration file (/stand/system by default) and then reconfigure the kernel:
For more information on the system configuration file, see config(1M). After reconfiguring the kernel, you must reboot the system. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||