SIGMOD’ ’07 07 SIGMOD SIGMOD’07 Design of Flash- -Based DBMS: Based DBMS: Design of Flash Design of Flash-Based DBMS: An In- -Page Logging Approach Page Logging Approach An In-Page Logging Approach An In ����' '(���)�� (���)�� ������ ���� ���� ���� ������ ������������������������������ ������������������������������ ��*��+����,����-����� ���� .��� .��� ��*��+����,����-� ���������/������������� ���������/������������� ��������������������� ��������������������� ������������� !"���#�#�# ������������� !"���#�#�# ��/����0�����112 ��0�����112' ' 13 13 ��/�� $�����%��#�������#�&� $�����%��#�������#�&� /��+��%���#����#��#�� /��+��%���#����#��#�� COMPUTER SCIENCE DEPARTMENT ACM SIGMOD 2007, Beijing, China -1-
Introduction Introduction Introduction • In recent years, NAND flash memory wins over hard disk in mobile In recent years, NAND flash memory wins over hard disk in mobile • storage market storage market � � PDA, MP3, mobile phone, digital camera, ... PDA, MP3, mobile phone, digital camera, ... � � Advantages: size, weight, shock resistance, power consumption, noise oise … … Advantages: size, weight, shock resistance, power consumption, n • • Now, compete with hard disk in personal computer market Now, compete with hard disk in personal computer market � � 32GB Flash SSD: M- 32GB Flash SSD: M -Tron Tron, Samsung, , Samsung, SanDisk SanDisk � � Vendors launched new lines of personal computers only with NAND flash Vendors launched new lines of personal computers only with NAND flash memory instead of hard disk memory instead of hard disk • In near future, full database servers can run on computing platforms orms • In near future, full database servers can run on computing platf with TB- -scale Flash SSD second storage scale Flash SSD second storage with TB � � C.G. Hwang predicted twofold increase of NAND flash density each year year C.G. Hwang predicted twofold increase of NAND flash density each until 2012 [ProcIEEE until 2012 [ ProcIEEE 2003] 2003] � � Database workload different from multimedia applications Database workload different from multimedia applications COMPUTER SCIENCE DEPARTMENT ACM SIGMOD 2007, Beijing, China -2-
Characteristics of NAND Flash Characteristics of NAND Flash Characteristics of NAND Flash • No in- -place update place update • No in � No data item or sector can be updated in place before erasing it � No data item or sector can be updated in place before erasing it first. first. � An erase unit (16KB or 128 KB) is much larger than a sector. � An erase unit (16KB or 128 KB) is much larger than a sector. • No mechanical latency • No mechanical latency � Flash memory is an electronic device without moving parts � Flash memory is an electronic device without moving parts � � Provides uniform random access speed without seek/rotational Provides uniform random access speed without seek/rotational latency latency • Asymmetric read & write speed • Asymmetric read & write speed � Read speed is typically at least twice faster than write speed � Read speed is typically at least twice faster than write speed � Write (and erase) optimization is critical � Write (and erase) optimization is critical COMPUTER SCIENCE DEPARTMENT ACM SIGMOD 2007, Beijing, China -3-
Magnetic Disk vs vs NAND Flash NAND Flash Magnetic Disk Magnetic Disk vs NAND Flash Read time Write time Erase time Read time Write time Erase time Magnetic Disk 12.7 msec msec 13.7 msec msec N/A Magnetic Disk 12.7 13.7 N/A µ µ µ µ sec µ µ sec µ µ 80 µ µ µ µ 200 µ µ µ µ NAND Flash sec sec 1.5 msec msec NAND Flash 80 200 1.5 � � Magnetic Disk : Seagate Barracuda 7200.7 ST380011A Magnetic Disk : Seagate Barracuda 7200.7 ST380011A � NAND Flash : Samsung K9WAG08U1A 16 � NAND Flash : Samsung K9WAG08U1A 16 Gbits Gbits SLC NAND SLC NAND � Unit of read/write: 2KB, Unit of erase: 128KB � Unit of read/write: 2KB, Unit of erase: 128KB COMPUTER SCIENCE DEPARTMENT ACM SIGMOD 2007, Beijing, China -4-
Disk- -Based DBMS on Flash Memory Based DBMS on Flash Memory Disk Disk-Based DBMS on Flash Memory • What happens if disk What happens if disk- -based DBMS runs on NAND Flash? based DBMS runs on NAND Flash? • � � Due to No In- -place Update, an update causes a write into another clean page place Update, an update causes a write into another clean page Due to No In � � Consume free sectors quickly causing frequent garbage collection and erase and erase Consume free sectors quickly causing frequent garbage collection SQL: Update / Insert / Delete Update Buffer Mgr. Page : 4KB Erase Unit: 128KB Dirty Block Write Flash Memory Data Block Area COMPUTER SCIENCE DEPARTMENT ACM SIGMOD 2007, Beijing, China -5-
Disk- -Based DBMS Performance Based DBMS Performance Disk Disk-Based DBMS Performance • Run SQL queries on a • Run SQL queries on a commercial DBMS commercial DBMS � Sequential scan or update of a � Sequential scan or update of a table table � Non � Non- -sequential read or update of sequential read or update of a table (via B- -tree index) tree index) a table (via B • Experimental settings • Experimental settings � Storage: Magnetic disk � Storage: Magnetic disk vs vs M M- - Tron SSD (Samsung flash) SSD (Samsung flash) Tron � � Data page of 8KB Data page of 8KB � 10 � 10 tuples tuples per page, 640,000 per page, 640,000 tuples tuples in a table (64,000 pages, 512MB) in a table (64,000 pages, 512MB) COMPUTER SCIENCE DEPARTMENT ACM SIGMOD 2007, Beijing, China -6-
Disk- -Based DBMS Performance Based DBMS Performance Disk Disk-Based DBMS Performance The result is not surprising at all Read performance : The result is not surprising at all • • Read performance : Disk Flash Disk Flash Sequential 14.0 sec 11.0 sec Sequential 14.0 sec 11.0 sec Non- -sequential sequential 61.1 ~ 172.0 sec 12.1 ~ 13.1 sec Non 61.1 ~ 172.0 sec 12.1 ~ 13.1 sec � Hard disk Read performance is poor for non-sequential accesses, mainly because of seek − and rotational latency Flash memory � Read performance is insensitive to access patterns − COMPUTER SCIENCE DEPARTMENT ACM SIGMOD 2007, Beijing, China -7-
Disk- -Based DBMS Performance Based DBMS Performance Disk Disk-Based DBMS Performance Write performance • • Write performance Disk Flash Disk Flash Sequential 34.0 sec 26.0 sec Sequential 34.0 sec 26.0 sec Non- -sequential sequential 151.9 ~ 340.7 sec 61.8 ~ 369.9 sec Non 151.9 ~ 340.7 sec 61.8 ~ 369.9 sec � Hard disk Write performance is poor for non-sequential accesses, mainly because of seek − and rotational latency Flash memory � Write performance is poor (worse than disk) for non-sequential accesses due to − out-of-place update and erase operations Demonstrate the need of write optimization for DBMS running on Flash − COMPUTER SCIENCE DEPARTMENT ACM SIGMOD 2007, Beijing, China -8-
In- -Page Logging (IPL) Approach Page Logging (IPL) Approach In In-Page Logging (IPL) Approach • Design Principles Design Principles • � � Take advantage of the characteristics of flash memory Take advantage of the characteristics of flash memory • Uniform random access speed Uniform random access speed • • Fast read speed • Fast read speed � � Overcome the “ “erase erase- -before before- -write write” ” limitation of flash memory limitation of flash memory Overcome the � � Minimize the changes made to the overall DBMS architecture Minimize the changes made to the overall DBMS architecture • Limited to buffer manager and storage manager • Limited to buffer manager and storage manager • Key Ideas • Key Ideas � � Changes written to log log instead of updating them in place instead of updating them in place Changes written to • Avoid frequent write and erase operations • Avoid frequent write and erase operations � � Log records are co co- -located located with data pages with data pages Log records are • No need to write them sequentially to a separate log region • No need to write them sequentially to a separate log region • Read current data more efficiently than sequential logging • Read current data more efficiently than sequential logging COMPUTER SCIENCE DEPARTMENT ACM SIGMOD 2007, Beijing, China -9-
Recommend
More recommend