Persistence: hard disk drive

Slides:



Advertisements
Similar presentations
Disk Storage SystemsCSCE430/830 Disk Storage Systems CSCE430/830 Computer Architecture Lecturer: Prof. Hong Jiang Courtesy of Yifeng Zhu (U. Maine) Fall,
Advertisements

CSE506: Operating Systems Disk Scheduling. CSE506: Operating Systems Key to Disk Performance Don’t access the disk – Whenever possible Cache contents.
Lecture 14 I/O Devices & Hard Disk Drives. vgetmem only from private heap.
CS4432: Database Systems II Data Storage - Lecture 2 (Sections 13.1 – 13.3) Elke A. Rundensteiner.
CS4432: Database Systems II Lecture 2 Timothy Sutherland.
Disks.
1 CS222: Principles of Database Management Fall 2010 Professor Chen Li Department of Computer Science University of California, Irvine Notes 01.
Introduction to Database Systems 1 The Storage Hierarchy and Magnetic Disks Storage Technology: Topic 1.
Disk and I/O Management
CS4432: Database Systems II Data Storage (Better Block Organization) 1.
Device Management. So far… We have covered CPU and memory management Computing is not interesting without I/Os Device management: the OS component that.
Lecture 11: DMBS Internals
Disks and Storage Systems
I/O and Disk Scheduling CS Spring Overview Review of I/O Techniques I/O Buffering Disk Geometry Disk Scheduling Algorithms RAID.
15-410, S’ Disks Mar. 24, 2004 Dave Eckhardt & Bruce Maggs Brian Railing & Steve Muckle Contributions from Eno Thereska “How Stuff Works”
CS4432: Database Systems II Data Storage 1. Storage in DBMSs DBMSs manage large amounts of data How does a DBMS store and manage large amounts of data?
UNIVERSITY of WISCONSIN-MADISON Computer Sciences Department
DMBS Internals I. What Should a DBMS Do? Store large amounts of data Process queries efficiently Allow multiple users to access the database concurrently.
Device Management Mark Stanovich Operating Systems COP 4610.
Disk Average Seek Time. Multi-platter Disk platter Disk read/write arm read/write head.
CPSC 231 Secondary storage (D.H.)1 Learning Objectives Understanding disk organization. Sectors, clusters and extents. Fragmentation. Disk access time.
COSC 6340: Disks 1 Disks and Files DBMS stores information on (“hard”) disks. This has major implications for DBMS design! » READ: transfer data from disk.
Device Management Andy Wang Operating Systems COP 4610 / CGS 5765.
1 Lecture 16: Data Storage Wednesday, November 6, 2006.
Lecture 17 Raid. Device Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O.
Data Storage and Querying in Various Storage Devices.
CSE 451: Operating Systems Spring 2010 Module 12.5 Secondary Storage John Zahorjan Allen Center 534.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems DISK I/0.
Chapter 10: Mass-Storage Systems
I/O Devices.
Sarah Diesburg Operating Systems CS 3430
Lecture 16: Data Storage Wednesday, November 6, 2006.
Disks and RAID.
Database Management Systems (CS 564)
Operating Systems Disk Scheduling A. Frank - P. Weisberg.
OPERATING SYSTEMS CS 3502 Fall 2017
Secondary Storage Secondary storage typically: Characteristics:
CPSC-608 Database Systems
Disk Scheduling Algorithms
DISK SCHEDULING FCFS SSTF SCAN/ELEVATOR C-SCAN C-LOOK.
IT 344: Operating Systems Winter 2008 Module 13 Secondary Storage
Lecture 45 Syed Mansoor Sarwar
Disks and Files DBMS stores information on (“hard”) disks.
Lecture 11: DMBS Internals
CSE 153 Design of Operating Systems Winter 2018
Lecture 13 I/O.
Lecture 9: Data Storage and IO Models
CSE 451: Operating Systems Winter 2006 Module 13 Secondary Storage
CSE 451: Operating Systems Autumn 2003 Lecture 12 Secondary Storage
CSE 451: Operating Systems Winter 2007 Module 13 Secondary Storage
CSE 451: Operating Systems Spring 2006 Module 13 Secondary Storage
Disks and scheduling algorithms
Secondary Storage Management Brian Bershad
Mass-Storage Systems.
CSE 451: Operating Systems Secondary Storage
Persistence: I/O devices
Chapter 11 I/O Management and Disk Scheduling
CSE 451: Operating Systems Winter 2003 Lecture 12 Secondary Storage
Disks and Storage Systems
CSE 451: Operating Systems Spring 2005 Module 13 Secondary Storage
Disks and Disk Scheduling
Secondary Storage Management Hank Levy
CSE451 File System Introduction and Disk Drivers Autumn 2002
CSE 451: Operating Systems Autumn 2004 Secondary Storage
CSE 451: Operating Systems Winter 2004 Module 13 Secondary Storage
Lecture 10: Magnetic Disks
Operating Systems 2019 Spring by Euiseong Seo
CPS216: Advanced Database Systems Notes 04: Data Access from Disks
CSE 451: Operating Systems Spring 2007 Module 11 Secondary Storage
Andy Wang Operating Systems COP 4610 / CGS 5765
Presentation transcript:

Persistence: hard disk drive Questions answered in last lecture: What are the components of a hard disk drive? Questions answered in this lecture: How can you calculate sequential and random throughput of a disk? What algorithms are used to schedule I/O requests?

Basic Interface Disk has a sector-addressable address space Appears as an array of sectors Sectors are typically 512 bytes or 4096 bytes. Main operations: reads + writes to sectors Mechanical (slow) nature makes management “interesting”

Heads on a moving arm can read from each surface. 23 16 15 8 22 17 7 14 9 6 1 5 2 13 10 4 3 21 18 12 11 20 19 Heads on a moving arm can read from each surface.

Spindle/platters rapidly spin. 23 16 15 8 22 17 7 14 9 6 1 5 2 13 10 4 3 21 18 12 11 20 19 Spindle/platters rapidly spin.

Time to Read/write Three components: Time = seek + rotation + transfer time

Seek, Rotate, Transfer Seek cost: Function of cylinder distance Not purely linear cost Must accelerate, coast, decelerate, settle Settling alone can take 0.5 - 2 ms Entire seeks often takes several milliseconds 4 - 10 ms Approximate average seek distance = 1/3 max seek distance (why?)

Seek, Rotate, Transfer Depends on rotations per minute (RPM) 7200 RPM is common, 15000 RPM is high end. With 7200 RPM, how long to rotate around? 1 / 7200 RPM = 1 minute / 7200 rotations = 1 second / 120 rotations = 8.3 ms / rotation Average rotation? 8.3 ms / 2 = 4.15 ms

Seek, Rotate, Transfer Pretty fast — depends on RPM and sector density. 100+ MB/s is typical for maximum transfer rate How long to transfer 512-bytes? 512 bytes * (1s / 100 MB) = 5 us

Workload Performance So… - seeks are slow - rotations are slow - transfers are fast What kind of workload is fastest for disks? Sequential: access sectors in order (transfer dominated) Random: access sectors arbitrarily (seek+rotation dominated)

Basic Performance Concepts Response Time or Latency: Time to perform an operation (s) Bandwidth or Throughput: Rate at which operations are performed (op/s) Files: mB/s, Networks: mb/s Start up or “Overhead”: time to initiate an operation Most I/O operations are roughly linear Latency (n) = Ovhd + n/Bandwidth

Sequential workload: what is throughput for each? Disk Spec Cheetah Barracuda Capacity 300 GB 1 TB RPM 15,000 7,200 Avg Seek 4 ms 9 ms Max Transfer 125 MB/s 105 MB/s Platters 4 Cache 16 MB 32 MB Sequential workload: what is throughput for each? Cheeta: 125 MB/s. Barracuda: 105 MB/s.

Disk Spec Random workload: what is throughput for each? Cheetah Barracuda Capacity 300 GB 1 TB RPM 15,000 7,200 Avg Seek 4 ms 9 ms Max Transfer 125 MB/s 105 MB/s Platters 4 Cache 16 MB 32 MB Random workload: what is throughput for each? (what else do you need to know?) What is size of each random read? Assume 16-KB reads

How long does an average random 16-KB read take w/ Cheetah? Barracuda RPM 15,000 7,200 Avg Seek 4 ms 9 ms Max Transfer 125 MB/s 105 MB/s How long does an average random 16-KB read take w/ Cheetah? Seek + rotation + transfer Seek = 4 ms

How long does an average random 16-KB read take w/ Cheetah? Barracuda RPM 15,000 7,200 Avg Seek 4 ms 9 ms Max Transfer 125 MB/s 105 MB/s How long does an average random 16-KB read take w/ Cheetah? Average rotation in ms? 1 1 min 60 sec 1000 ms avg rotation = = 2 ms 2 15000 1 min 1 sec

How long does an average random 16-KB read take w/ Cheetah? Barracuda RPM 15,000 7,200 Avg Seek 4 ms 9 ms Max Transfer 125 MB/s 105 MB/s How long does an average random 16-KB read take w/ Cheetah? Transfer of 16 KB? transfer = 1 sec 125 MB 16 KB 1,000,000 us = 125 us

How long does an average random 16-KB read take w/ Cheetah? Barracuda RPM 15,000 7,200 Avg Seek 4 ms 9 ms Max Transfer 125 MB/s 105 MB/s How long does an average random 16-KB read take w/ Cheetah? Cheetah time = 4ms + 2ms + 125us = 6.1ms Throughput?

How long does an average random 16-KB read take w/ Cheetah? Barracuda RPM 15,000 7,200 Avg Seek 4 ms 9 ms Max Transfer 125 MB/s 105 MB/s How long does an average random 16-KB read take w/ Cheetah? Cheetah time = 4ms + 2ms + 125us = 6.1ms 16 KB 1 MB 100 ms throughput = = 2.5 MB/s 6.1ms 1024 KB 1 sec

Time = seek + rotation + transfer Cheetah Barracuda RPM 15,000 7,200 Avg Seek 4 ms 9 ms Max Transfer 125 MB/s 105 MB/s How long does an average random 16-KB read take w/ Barracuda? Time = seek + rotation + transfer Seek = 9ms

How long does an average random 16-KB read take w/ Barracuda? Cheetah Barracuda RPM 15,000 7,200 Avg Seek 4 ms 9 ms Max Transfer 125 MB/s 105 MB/s How long does an average random 16-KB read take w/ Barracuda? 1 1 min 60 sec 1000 ms avg rotation = = 4.1 ms 2 7200 1 min 1 sec

How long does an average random 16-KB read take w/ Barracuda? Cheetah Barracuda RPM 15,000 7,200 Avg Seek 4 ms 9 ms Max Transfer 125 MB/s 105 MB/s How long does an average random 16-KB read take w/ Barracuda? 1 sec 1,000,000 us transfer = 16 KB = 149 us 105 MB 1 sec

How long does an average random 16-KB read take w/ Barracuda? Cheetah Barracuda RPM 15,000 7,200 Avg Seek 4 ms 9 ms Max Transfer 125 MB/s 105 MB/s How long does an average random 16-KB read take w/ Barracuda? Barracuda time = 9ms + 4.1ms + 149us = 13.2ms

How long does an average random 16-KB read take w/ Barracuda? Cheetah Barracuda RPM 15,000 7,200 Avg Seek 4 ms 9 ms Max Transfer 125 MB/s 105 MB/s How long does an average random 16-KB read take w/ Barracuda? Barracuda time = 9ms + 4.1ms + 149us = 13.2ms 16 KB 1 MB 1000 ms throughput = = 1.2 MB/s 13.2ms 1024 KB 1 sec

Cheetah Barracuda Capacity 300 GB 1 TB RPM 15,000 7,200 Avg Seek 4 ms 9 ms Max Transfer 125 MB/s 105 MB/s Platters 4 Cache 16 MB 32 MB Cheetah Barracuda Sequential 125 MB/s 105 MB/s Random 2.5 MB/s 1.2 MB/s

Other Improvements Track Skew Zones Cache

Imagine sequential reading, how should sectors numbers be laid out on disk? 23 16 15 8 22 17 14 9 13 10 21 18 12 11 20 19

When reading 16 after 15, the head won’t settle quick enough, so we need to do a rotation. 23 16 15 8 22 17 14 9 13 10 21 18 12 11 20 19

21 23 15 8 20 23 14 9 13 10 19 16 12 11 18 17

enough time to settle now 21 23 15 8 20 23 14 9 13 10 19 16 12 11 18 17

Other Improvements Track Skew Zones Cache

ZBR (Zoned bit recording): More sectors on outer tracks

Other Improvements Track Skew Zones Cache

Drive Cache Drives may cache both reads and writes. OS caches data too What advantage does caching in drive have for reads? What advantage does caching in drive have for writes? 23 16 15 8 22 17 14 9 13 10 21 18 12 11 20 19

Buffering Disks contain internal memory (2MB-16MB) used as cache Read-ahead: “Track buffer” Read contents of entire track into memory during rotational delay Write caching with volatile memory Immediate reporting: Claim written to disk when not Data could be lost on power failure Tagged command queueing Have multiple outstanding requests to the disk Disk can reorder (schedule) requests for better performance

I/O Schedulers

I/O Schedulers Given a stream of I/O requests, in what order should they be served? Much different than CPU scheduling Position of disk head relative to request position matters more than length of job

FCFS (First-Come-First-Serve) Assume seek+rotate = 10 ms for random request How long (roughly) does the below workload take? Requests are given in sector numbers 300001, 700001, 300002, 700002, 300003, 700003 ~60ms

FCFS (First-Come-First-Serve) Assume seek+rotate = 10 ms for random request How long (roughly) does the below workload take? Requests are given in sector numbers 300001, 700001, 300002, 700002, 300003, 700003 300001, 300002, 300003, 700001, 700002, 700003 ~60ms ~20ms

Schedulers OS Scheduler Where should the scheduler go? Scheduler Disk

SPTF (Shortest Positioning Time First) Strategy: always choose request that requires least positioning time (time for seeking and rotating) Greedy algorithm (just looks for best NEXT decision) How to implement in disk? How to implement in OS? Use Shortest Seek Time First (SSTF) instead Disadvantages? Easy for far away requests to starve

SCAN Elevator Algorithm: Sweep back and forth, from one end of disk other, serving requests as pass that cylinder Sorts by cylinder number; ignores rotation delays Pros/Cons? Better: C-SCAN (circular scan) Only sweep in one direction

Work Conservation Work conserving schedulers always try to do work if there’s work to be done Sometimes, it’s better to wait instead if system anticipates another request will arrive Such non-work-conserving schedulers are called anticipatory schedulers

CFQ (Linux Default) Completely Fair Queueing Queue for each process Weighted round-robin between queues, with slice time proportional to priority Yield slice only if idle for a given time (anticipation) Optimize order within queue

I/O Device Summary Overlap I/O and CPU whenever possible! - use interrupts, DMA Storage devices provide common block interface On a disk: Never do random I/O unless you must! - e.g., Quicksort is a terrible algorithm on disk Spend time to schedule on slow, stateful devices