|< Day Day Up >|| |
Here are two performance tips for Linux swapping:
Use the diagnose driver for swap, as discussed in "Make virtual disk space available to the z/VM system" on page 121.
Use multiple prioritized virtual disks. If the overall requirement is estimated at 1 GB of swap space, then having 10 disks of 100 MB each will reduce the load on each individual disk. However, keep in mind the caveats listed in "Trade-offs to consider" on page 283. CPU is used during swapping, whether to one disk or to multiple disks.
Keep in mind that virtual disks are not allocated prior to use. Linux sees the virtual disk as a full disk ready for use. But until Linux writes something to this disk, z/VM will not allocate resources. Thus, the cost of many large disks is really very small until the disk is utilized.
Each of these swap devices should have a different priority. Linux allocates space on the highest priority disk in a moving cursor algorithm, which causes writes to be written serially across a disk until that disk is full. At that point, Linux will re-use available space across that disk until it is again full. Then Linux will use the next priority disk.
Linux will prioritize all of the virtual disks allocated to swapping, and completely use one before using the next. If there were just one big disk, that disk would be completely utilized. Using prioritized smaller disks reduces the load on your storage and paging subsystem because the Linux footprint is kept much smaller.
In Figure 11-6 on page 279, note that LinuxC has 10 virtual disks, but the total cost to the systems is 9 MB. This is pageable when there is a need for VM to page out idle pages. In the LinuxA virtual disks, the cost of 7 of the disks is only 75 pages, with the rest already paged out to disk.
Figure 11-16: ESAVDSK virtual disk report showing swap disk requirements
To reduce the footprint of Linux storage, we recommend that you give Linux some swap space in the VM virtual disk and reduce the virtual machine size by the same amount. Although the virtual machine primary address space and virtual disk come out of the same z/VM resource set (main storage and page space), the benefit is that Linux's usage of the two is different. Swapping to virtual disk is pretty fast, so the penalty for some occasional swapping is not too high. The effect is that the footprint of the Linux machine (the sum of resident primary address space and virtual disk) is reduced, which is desirable.
There is a "myth" that swap space should be twice the virtual machine size. But you can have too much of a good thing, and so to build virtual machines of 512 MB with 1 GB virtual disk can be a wrong decision. Initially you can get away with it, since Linux has not touched the virtual disk so it does not take any real storage yet. We find that even an oversized Linux virtual machine will do some swapping now and then. Since we recommend that you lower the virtual machine size to the point where you occasionally swap a little bit, most systems do a bit more than that.
Because of the way pages are allocated on the swap disk, over time Linux will have touched most pages in the virtual disk. These pages contain no active data anymore (swapping is normally read back only once) but we currently have no way to tell z/VM about that. So z/VM needs to back those virtual disk pages with pages from your paging subsystem. This results in a footprint of 1.5 GB for your virtual machine. When you have touched all virtual disk pages, things get worse because the reference pattern is such that each swap-out by Linux requires a page-in by z/VM.
See 11.9 and 12.5 for additional discussion and recommendations on swapping.
|< Day Day Up >|| |