120 likes | 381 Views
Disks and Files. DBMS stores information on (“hard”) disks. This has major implications for DBMS design! READ: transfer data from disk to main memory (RAM). WRITE: transfer data from RAM to disk. Both are high-cost operations, relative to in-memory operations, so must be planned carefully!.
E N D
Disks and Files • DBMS stores information on (“hard”) disks. • This has major implications for DBMS design! • READ: transfer data from disk to main memory (RAM). • WRITE: transfer data from RAM to disk. • Both are high-cost operations, relative to in-memory operations, so must be planned carefully!
Why Not Store Everything in Main Memory? • Costs too much. $100 will buy you either 512MB of RAM or 50GB of disk today --- that is disk storage 100 times cheaper(but it is approx. 10000 times slower). • Main memory is volatile. We want data to be saved between runs. (Obviously!) • Typical storage hierarchy: • Main memory (RAM) for currently used data. • Disk for the main database (secondary storage). • Tapes for archiving older versions of the data (tertiary storage).
Tracks Arm movement Arm assembly Components of a Disk Spindle Disk head • The platters spin (say, 90rps). • The arm assembly is moved in or out to position a head on a desired track. Tracks under heads make a cylinder(imaginary!). Sector Platters • Only one head reads/writes at any one time. • Block size is a multiple of sector size (which is fixed).
Accessing a Disk Page • Time to access (read/write) a disk block: • seek time (moving arms to position disk head on track) • rotational delay (waiting for block to rotate under head) • transfer time (actually moving data to/from disk surface) • Seek time and rotational delay dominate. • Seek time varies from about 1 to 20msec • Rotational delay varies from 0 to 10msec • Transfer rate is about 1msec per 32KB page
Latency = Queuing Time + Controller time + Seek Time + Rotation Time + Size / Bandwidth { per access + per byte State of the Art: Barracuda 180 • 181.6 GB, 3.5 inch disk • 12 platters, 24 surfaces • 24,247 cylinders • 7,200 RPM; (4.2 ms avg. latency) • 7.4/8.2 ms avg. seek (r/w) • 64 to 35 MB/s (internal) • 0.1 ms controller time • 10.3 watts (idle) Track Sector Cylinder Track Buffer Arm Platter Head source: www.seagate.com
Disk Performance • Calculate time to read 64 KB (128 sectors) for Barracuda 180 X using advertised performance; sector is on outer track Disk latency = average seek time + average rotational delay + transfer time + controller overhead = 7.4 ms + 0.5 * 1/(7200 RPM) + 64 KB / (65 MB/s) + 0.1 ms = 7.4 ms + 0.5 /(7200 RPM/(60000ms/M)) + 64 KB / (65 KB/ms) + 0.1 ms = 7.4 + 4.2 + 1.0 + 0.1 ms = 12.7 ms
1 inch disk drive! • 2000 IBM MicroDrive: • 1.7” x 1.4” x 0.2” • 1 GB, 3600 RPM, 5 MB/s, 15 ms seek • Digital camera, PalmPC? • 2006 MicroDrive? • 9 GB, 50 MB/s! • Assuming it finds a niche in a successful product • Assuming past trends continue
Disk Characteristics in 2000 $828 $447 $435
RAID Technology • Disk Array: Arrangement of several disks that gives abstraction of a single, large disk. • Goals: Increase performance and reliability. • Two main techniques: • Data striping: Data is partitioned; size of a partition is called the striping unit. Partitions are distributed over several disks. • Redundancy: More disks more failures. Redundant information allows reconstruction of data if a disk fails.