130 likes | 586 Views
The Storage Hierarchy and Magnetic Disks. Storage Technology: Topic 1. The Storage Hierarchy. cache. main memory. price. speed. reliable memory. magnetic disk. optical disk. magnetic tape. What is the “speed” of storage?. Total response time is what counts
E N D
The Storage HierarchyandMagnetic Disks Storage Technology: Topic 1
The Storage Hierarchy cache main memory price speed reliable memory magnetic disk optical disk magnetic tape
What is the “speed” of storage? • Total response time is what counts • Response time = Latency + Transfer time • Latency = Time till data starts getting transferred • Transfer time depends on bandwidth • Average vs worst-case response time (depends on access patterns) • Speed of memory channel also matters • Contention for memory also matters
Main Memory and Cache • 32 MB L2 cache = = $500 • 32 MB memory = = $175 • Uniform access times for random accesses • Not quite true with virtual memory • Latency involved in VM translations
Why Not Store Everything in Main Memory? • Costs too much. $1000 will buy you either 128MB of RAM or 9 GB of disk. • Main memory is volatile. We want data to be persistent. • Typical storage hierarchy: • Main memory for subset of data in use. • Disk for the main database (secondary) • Tapes for archiving older versions of the data (tertiary)
Magnetic Disks • Secondary storage device of choice • Main advantage over tapes: random access, vs.sequential access. • Data is stored and retrieved in units called disk blocks or pages. Why? • Unlike RAM, time to retrieve a disk page varies depending upon location. • Implication?
Spindle Tracks Disk head • The platters spin (7200rpm) Sector • The arm assembly is moved in or out to position a head on a desired track. Tracks under heads make a cylinder(imaginary!). Platters Arm movement • Only one head reads/writes at any one time. Arm assembly • Block size is a multiple of sector size (which is fixed). Components of a Disk
Disk Interfaces • Disk controller : special processor at disk • Disk drive interface : links controller to host along computer bus • EIDE : used in PCs -- cheaper, lower performance • SCSI : used in Macs, workstations • Disk is viewed as an array of sectors (logical) • Request scheduling: elevator algorithm (location of smarts varies for SCSI and EIDE)
Servicing a Disk Request • 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 : 1 to 20msec (components?) • Rotational delay : 0 to 10msec • Transfer rate : 1msec per 4KB block (based on rpm) • Key to lower I/O cost: reduce seek/rotation delays! Hardware vs. software solutions?
Hardware Solutions • Disk buffer : 512K to 1024 K (volatile?) • Read-ahead in disk buffer • Zoned bit recording • Track skewing • Embedded servo positioning • Higher spin speeds (but more power and vibr) • Higher recording density
Software Solutions • `Next’ block concept: • blocks on same track, followed by • blocks on same cylinder, followed by • blocks on adjacent cylinder • Blocks in a file should be arranged sequentially on disk (by `next’), to minimize seek and rotational delay. Why? --- locality! • For a sequential scan, pre-fetching several pages at a time is a big win!
Disk Space Management • Lowest layer of DBMS software manages space on disk. • Higher levels call upon this layer to: • allocate/de-allocate a page • read/write a page • Request for a sequence of pages should be sequential on disk!
Summary: • Today’s key idea: Principle of Locality • Most important principle of database systems