Optimization of Disk-Block Access Block-a contiguous sequence of sectors from a single track data is transferred between disk and main memory in blocks sizes range from 512 bytes to several kilobytes Smaller blocks:more transfers from disk Larger blocks:more space wasted due to partially filled blocks Typical block sizes today range from 4 to 16 kilobytes Disk-arm-scheduling algorithms order pending accesses to tracks so that disk arm movement is minimized elevator algorithm:move disk arm in one direction(from outer to inner tracks or vice versa),processing next request in that direction,till no more requests in that direction,then reverse direction and repeat Database System Concepts-5th Edition,Oct 23,2005. 11.17 @Silberschatz,Korth and Sudarshan
Database System Concepts - 5 11.17 ©Silberschatz, Korth and Sudarshan th Edition, Oct 23, 2005. Optimization of Disk-Block Access Block – a contiguous sequence of sectors from a single track data is transferred between disk and main memory in blocks sizes range from 512 bytes to several kilobytes Smaller blocks: more transfers from disk Larger blocks: more space wasted due to partially filled blocks Typical block sizes today range from 4 to 16 kilobytes Disk-arm-scheduling algorithms order pending accesses to tracks so that disk arm movement is minimized elevator algorithm : move disk arm in one direction (from outer to inner tracks or vice versa), processing next request in that direction, till no more requests in that direction, then reverse direction and repeat
Optimization of Disk Block Access (Cont.) File organization-optimize block access time by organizing the blocks to correspond to how data will be accessed E.g.Store related information on the same or nearby cylinders. Files may get fragmented over time E.g.if data is inserted to/deleted from the file Or free blocks on disk are scattered,and newly created file has its blocks scattered over the disk Sequential access to a fragmented file results in increased disk arm movement Some systems have utilities to defragment the file system,in order to speed up file access Database System Concepts-5th Edition,Oct 23,2005. 11.18 @Silberschatz,Korth and Sudarshan
Database System Concepts - 5 11.18 ©Silberschatz, Korth and Sudarshan th Edition, Oct 23, 2005. Optimization of Disk Block Access (Cont.) File organization – optimize block access time by organizing the blocks to correspond to how data will be accessed E.g. Store related information on the same or nearby cylinders. Files may get fragmented over time E.g. if data is inserted to/deleted from the file Or free blocks on disk are scattered, and newly created file has its blocks scattered over the disk Sequential access to a fragmented file results in increased disk arm movement Some systems have utilities to defragment the file system, in order to speed up file access
Optimization of Disk Block Access (Cont.) Nonvolatile write buffers speed up disk writes by writing blocks to a non-volatile RAM buffer immediately Non-volatile RAM:battery backed up RAM or flash memory Even if power fails,the data is safe and will be written to disk when power returns Controller then writes to disk whenever the disk has no other requests or request has been pending for some time Database operations that require data to be safely stored before continuing can continue without waiting for data to be written to disk Writes can be reordered to minimize disk arm movement Log disk-a disk devoted to writing a sequential log of block updates Used exactly like nonvolatile RAM Write to log disk is very fast since no seeks are required No need for special hardware(NV-RAM) File systems typically reorder writes to disk to improve performance Journaling file systems write data in safe order to NV-RAM or log disk Reordering without journaling:risk of corruption of file system data Database System Concepts-5th Edition,Oct 23,2005. 11.19 @Silberschatz,Korth and Sudarshan
Database System Concepts - 5 11.19 ©Silberschatz, Korth and Sudarshan th Edition, Oct 23, 2005. Nonvolatile write buffers speed up disk writes by writing blocks to a non-volatile RAM buffer immediately Non-volatile RAM: battery backed up RAM or flash memory Even if power fails, the data is safe and will be written to disk when power returns Controller then writes to disk whenever the disk has no other requests or request has been pending for some time Database operations that require data to be safely stored before continuing can continue without waiting for data to be written to disk Writes can be reordered to minimize disk arm movement Log disk – a disk devoted to writing a sequential log of block updates Used exactly like nonvolatile RAM Write to log disk is very fast since no seeks are required No need for special hardware (NV-RAM) File systems typically reorder writes to disk to improve performance Journaling file systems write data in safe order to NV-RAM or log disk Reordering without journaling: risk of corruption of file system data Optimization of Disk Block Access (Cont.)
RAID RAID:Redundant Arrays of Independent Disks disk organization techniques that manage a large numbers of disks, providing a view of a single disk of high capacity and high speed by using multiple disks in parallel, and high reliability by storing data redundantly,so that data can be recovered even if a disk fails The chance that some disk out of a set of N disks will fail is much higher than the chance that a specific single disk will fail. E.g.,a system with 100 disks,each with MTTF of 100,000 hours (approx.11 years),will have a system MTTF of 1000 hours (approx. 41 days) Techniques for using redundancy to avoid data loss are critical with large numbers of disks Originally a cost-effective alternative to large,expensive disks I in RAID originally stood forinexpensive" Today RAIDs are used for their higher reliability and bandwidth. The "I"is interpreted as independent Database System Concepts-5th Edition,Oct 23,2005. 11.20 ©Silberschat乜,Korth and Sudarshan
Database System Concepts - 5 11.20 ©Silberschatz, Korth and Sudarshan th Edition, Oct 23, 2005. RAID RAID: Redundant Arrays of Independent Disks disk organization techniques that manage a large numbers of disks, providing a view of a single disk of high capacity and high speed by using multiple disks in parallel, and high reliability by storing data redundantly, so that data can be recovered even if a disk fails The chance that some disk out of a set of N disks will fail is much higher than the chance that a specific single disk will fail. E.g., a system with 100 disks, each with MTTF of 100,000 hours (approx. 11 years), will have a system MTTF of 1000 hours (approx. 41 days) Techniques for using redundancy to avoid data loss are critical with large numbers of disks Originally a cost-effective alternative to large, expensive disks I in RAID originally stood for ``inexpensive’’ Today RAIDs are used for their higher reliability and bandwidth. The “I” is interpreted as independent
Improvement of Reliability via Redundancy Redundancy -store extra information that can be used to rebuild information lost in a disk failure E.g.,Mirroring (or shadowing) Duplicate every disk.Logical disk consists of two physical disks Every write is carried out on both disks Reads can take place from either disk If one disk in a pair fails,data still available in the other Data loss would occur only if a disk fails,and its mirror disk also fails before the system is repaired Probability of combined event is very small Except for dependent failure modes such as fire or building collapse or electrical power surges Mean time to data loss depends on mean time to failure, and mean time to repair E.g.MTTF of 100,000 hours,mean time to repair of 10 hours gives mean time to data loss of 500*106 hours (or 57,000 years)for a mirrored pair of disks(ignoring dependent failure modes) Database System Concepts-5th Edition,Oct 23,2005. 11.21 ©Silberschat乜,Korth and Sudarshan
Database System Concepts - 5 11.21 ©Silberschatz, Korth and Sudarshan th Edition, Oct 23, 2005. Improvement of Reliability via Redundancy Redundancy – store extra information that can be used to rebuild information lost in a disk failure E.g., Mirroring (or shadowing) Duplicate every disk. Logical disk consists of two physical disks. Every write is carried out on both disks Reads can take place from either disk If one disk in a pair fails, data still available in the other Data loss would occur only if a disk fails, and its mirror disk also fails before the system is repaired – Probability of combined event is very small » Except for dependent failure modes such as fire or building collapse or electrical power surges Mean time to data loss depends on mean time to failure, and mean time to repair E.g. MTTF of 100,000 hours, mean time to repair of 10 hours gives mean time to data loss of 500*106 hours (or 57,000 years) for a mirrored pair of disks (ignoring dependent failure modes)