Disk IO Hard Disks

- 306 -

14.1.1 Disk IO

Do not underestimate the impact of disk writes on the system as a whole. For example, all database vendors strongly recommend that the system swap files [1] be placed on a separate disk from their databases. The impact of not doing so can decrease database throughput and system activity by an order of magnitude. This performance decrease comes from not splitting the IO of two disk- intensive applications in this case, OS paging and database IO. [1] The disk files for the virtual memory of the operating system; see Section 14.3 . Identifying that there is an IO problem is usually fairly easy. The most basic symptom is that things take longer than expected, while at the same time the CPU is not at all heavily worked. The disk- monitoring utilities will also tell you that there is a lot of work being done to the disks. At the system level, you should determine the average and peak requirements on the disks. Your disks will have some statistics that are supplied by the vendor, including: • The average and peak transfer rates , normally in megabytes MB per second, e.g., 5MBsec. From this, you can calculate how long an 8K page takes to be transferred from disk; for example, 5MBsec is about 5Kms, so an 8K page takes just under 2 ms to transfer. • Average seek time, normally in milliseconds ms, e.g., 10 ms. This is the time required for the disk head to move radially to the correct location on the disk. • Rotational speed, normally in revolutions per minute rpm, e.g., 7200 rpm. From this, you can calculate the average rotational delay in moving the disk under the disk-head reader, i.e., the time taken for half a revolution. For example, for 7200 rpm, one revolution takes 60,000 ms 60 seconds divided by 7200 rpm, which is about 8.3 ms. So half a revolution takes just over 4 ms, which is consequently the average rotational delay. This list allows you to calculate the actual time it takes to load a random 8K page from the disk, this being seek time + rotational delay + transfer time. Using the examples given in the list, you have 10 + 4 + 2 = 16ms to load a random 8K page almost an order of magnitude slower than the raw disk throughput. This calculation gives you a worst-case scenario for the disk-transfer rates for your application, allowing you to determine if the system is up to the required performance. Note that if you are reading data stored sequentially on disk as when reading a large file, the seek time and rotational delay are incurred less than once per 8K page loaded. Basically, these two times are incurred only at the beginning of opening the file and whenever the file is fragmented. But this calculation is confounded by other processes also executing IO to the disk at the same time. These overheads are some of the reasons why swap and other intensive IO files should not be put on the same disk. One mechanism for speeding up disk IO is to stripe disks. Disk striping allows data from a particular file to be spread over several disks. Striping allows reads and writes to be performed in parallel across the disks without requiring any application changes. This can speed up disk IO quite effectively. However, be aware that the seek and rotational overheads previously listed still apply, and if you are making many small random reads, there may be no performance gain from striping disks. Finally, note again that using remote disks affects IO performance very badly. You should not be using remote disks mounted from the network with any IO-intensive operations if you need good performance. - 307 -

14.1.2 Clustering Files