Storage and Disks

Download Report

Transcript Storage and Disks

Database System Concepts
11.1
Now Something Different
1st part of the course: Application Oriented
2nd part of the course: Systems Oriented
What is “Systems”?
A: Not Programming
Not programming big things..
Systems = Efficient and safe use of limited resources (e.g., disks)
Efficient: resources should be shared, utilized as much as possible
Safe:
Database System Concepts
sharing should not corrupt work of individual jobs
11.2
General Overview
 Relational model - SQL
 Formal & commercial query languages
 Functional Dependencies
 Normalization
 Physical Design
 Indexing
 Query evaluation
Application
Oriented
 Query optimization
 ….
Database System Concepts
Systems Oriented
11.3
The systems side of Databases
What will we talk about?
1. Data Organization: physical storage strategies to support
efficient updates, retrieval
2. Data retrieval: auxiliary data structures to enable efficient
retrieval. Techniques for processing queries to ensure efficient
retrieval
3. Data Integrity: techniques for implementing Xactions, to ensure
safe concurrent access to data. Ensuring data is safe in the
presence of system crashes.
Database System Concepts
11.4
Data Organization
Key points
1. Storage Media
 “Memory hierarchy”
 Efficient/reliable transfer of data between disks and main
memory
 Hardware techniques (RAID disks)
 Software techniques (Buffer mgmt)
2. Storage strategies for relations-file organization
 Representation of tuples on disks
 Storage of tuples in pages, clustering.
Database System Concepts
11.5
CPU
...
M
Typical
Computer
C
...
Secondary
Storage
Database System Concepts
11.6
Storage Media: Players
 Cache – fastest and most costly form of storage; volatile;
managed by the computer system hardware.
 Main memory:
 fast access (10s to 100s of nanoseconds; 1 nanosecond =
10–9 seconds)
 generally too small (or too expensive) to store the entire
database
 Volatile — contents of main memory are usually lost if a
power failure or system crash occurs.
 But… CPU operates only on data in main memory
Database System Concepts
11.7
Storage Media: Players
 Disk
 Primary medium for the long-term storage of data; typically
stores entire database.
 random-access – possible to read data on disk in any order,
unlike magnetic tape
 Non-volatile: data survive a power failure or a system crash,
disk failure less likely than them
 New technology: Solid State Disks and Flash disks
Database System Concepts
11.8
Storage Media: Players
 Optical storage
 non-volatile, data is read optically from a spinning disk using a laser
 CD-ROM (640 MB) and DVD (4.7 to 17 GB) most popular forms
 Write-one, read-many (WORM) optical disks used for archival
storage (CD-R and DVD-R)
 Multiple write versions also available (CD-RW, DVD-RW, and DVDRAM)
 Reads and writes are slower than with magnetic disk
 Tapes
 Sequential access (very slow)
 Cheap, high capacity
Database System Concepts
11.9
Memory Hierarchy
cache
Main memory
V
NV
disk
Optical storage
Tapes
Traveling the hierarchy:
1. speed ( higher=faster)
2. cost (lower=cheaper)
3. volatility (between MM and Disk)
4. Data transfer (Main memory the “hub”)
5. Storage classes (P=primary, S=secondary,
T=tertiary)
Database System Concepts
11.10
Main memory  Disk Data Xfers
Concerns:
1. Efficiency (speed)
can be improved by...
a. improving raw data transfer speed
b. avoiding untimely data transfer
c. avoiding unnecessary data transfer
2. Safety (reliability, availability)
can be improved by...
a. storing data redundantly
Database System Concepts
11.11
Hard Disk Mechanism
Database System Concepts
11.12

Read-write head
 Positioned very close to the platter
surface (almost touching it)


Surface of platter divided into circular
tracks
Each track is divided into sectors.
 A sector is the smallest unit of data that
can be read or written.

To read/write a sector
 disk arm swings to position head on
right track
 platter spins continually; data is
read/written as sector passes under
head


Block: a sequence of sectors
Cylinder i consists of ith track of all the
platters
Database System Concepts
11.13
“Typical” Values
Diameter:
1 inch  15 inches
Cylinders:
100  2000
Surfaces:
1 or 2
(Tracks/cyl)
2 (floppies)  30
Sector Size: 512B  50K
Capacity:
360 KB (old floppy)
 1.5 TB
Database System Concepts
11.14
Performance Measures of Disks
Measuring Disk Speed
 Access time – consists of:
 Seek time – time it takes to reposition the arm over the correct track.
 (Rotational) latency time – time it takes for the sector to be accessed
to appear under the head.
 Data-transfer rate – the rate at which data can be retrieved from or
stored to the disk.
Analogy to taking a bus:
1. Seek time: time to get to bus stop
2. Latency time; time spent waiting at bus stop
3. Data transfer time: time spent riding the bus
Database System Concepts
11.15