Advanced Topics in Databases Fahime Raja Niloofar Razavi Melody Siadaty Summer 2005 Technical Report II : Main memory Databases.

Slides:



Advertisements
Similar presentations
Crash Recovery John Ortiz. Lecture 22Crash Recovery2 Review: The ACID properties  Atomicity: All actions in the transaction happen, or none happens 
Advertisements

1 CSIS 7102 Spring 2004 Lecture 9: Recovery (approaches) Dr. King-Ip Lin.
IDA / ADIT Lecture 10: Database recovery Jose M. Peña
CS4432: Database Systems II Buffer Manager 1. 2 Covered in week 1.
2P13 Week 11. A+ Guide to Managing and Maintaining your PC, 6e2 RAID Controllers Redundant Array of Independent (or Inexpensive) Disks Level 0 -- Striped.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Recovery CPSC 356 Database Ellen Walker Hiram College (Includes figures from Database Systems by Connolly & Begg, © Addison Wesley 2002)
CSCI 3140 Module 8 – Database Recovery Theodore Chiasson Dalhousie University.
Chapter 11: File System Implementation
File System Implementation
1 Minggu 8, Pertemuan 16 Transaction Management (cont.) Matakuliah: T0206-Sistem Basisdata Tahun: 2005 Versi: 1.0/0.0.
Quick Review of May 1 material Concurrent Execution and Serializability –inconsistent concurrent schedules –transaction conflicts serializable == conflict.
Chapter 19 Database Recovery Techniques. Slide Chapter 19 Outline Databases Recovery 1. Purpose of Database Recovery 2. Types of Failure 3. Transaction.
METU Department of Computer Eng Ceng 302 Introduction to DBMS Disk Storage, Basic File Structures, and Hashing by Pinar Senkul resources: mostly froom.
Efficient Storage and Retrieval of Data
Chapter 12 File Management Systems
©Silberschatz, Korth and Sudarshan17.1Database System Concepts 3 rd Edition Chapter 17: Recovery System Failure Classification Storage Structure Recovery.
Free Powerpoint Templates Page 1 Free Powerpoint Templates DBMS Unit -1 Overview of physical Storage Media.
Academic Year 2014 Spring. MODULE CC3005NI: Advanced Database Systems “DATABASE RECOVERY” (PART – 1) Academic Year 2014 Spring.
Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture Distributed Database.
1.A file is organized logically as a sequence of records. 2. These records are mapped onto disk blocks. 3. Files are provided as a basic construct in operating.
Recovery in Main Memory Databases -Le Gruenwald, Jing Huang, Margaret H. Dunham el al - Engineering Intelligent Systems, Vol.4, No. 3, September 1996.
IT The Relational DBMS Section 06. Relational Database Theory Physical Database Design.
Chapter 10 Storage and File Structure Yonsei University 2 nd Semester, 2013 Sanghyun Park.
1 Chapter 12 File Management Systems. 2 Systems Architecture Chapter 12.
Lecture 9 of Advanced Databases Storage and File Structure (Part II) Instructor: Mr.Ahmed Al Astal.
Switch off your Mobiles Phones or Change Profile to Silent Mode.
Lecture 12 Recoverability and failure. 2 Optimistic Techniques Based on assumption that conflict is rare and more efficient to let transactions proceed.
1 CS 430 Database Theory Winter 2005 Lecture 16: Inside a DBMS.
CMPT 454, Simon Fraser University, Fall 2009, Martin Ester 294 Database Systems II Coping With System Failures.
Recovery System By Dr.S.Sridhar, Ph.D.(JNUD), RACI(Paris, NICE), RMR(USA), RZFM(Germany) DIRECTOR ARUNAI ENGINEERING COLLEGE TIRUVANNAMALAI.
Recovery system By Kotoua Selira. Failure classification Transaction failure : Logical errors: transaction cannot complete due to some internal error.
PMIT-6102 Advanced Database Systems By- Jesmin Akhter Assistant Professor, IIT, Jahangirnagar University.
Main memory DB PDT Ján GENČI. 2 Obsah Motivation DRDBMS MMDBMS DRDBMS versus MMDBMS Commit processing Support in commercial systems.
Chapter 16 Recovery Yonsei University 1 st Semester, 2015 Sanghyun Park.
INFORMATION MANAGEMENT Unit 2 SO 4 Explain the advantages of using a database approach compared to using traditional file processing; Advantages including.
Introduction to Database Systems1. 2 Basic Definitions Mini-world Some part of the real world about which data is stored in a database. Data Known facts.
Free Space Management.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 12: File System Implementation File System Structure File System Implementation.
File System Implementation
File Structures. 2 Chapter - Objectives Disk Storage Devices Files of Records Operations on Files Unordered Files Ordered Files Hashed Files Dynamic and.
Chapter 10 Recovery System. ACID Properties  Atomicity. Either all operations of the transaction are properly reflected in the database or none are.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition File System Implementation.
Physical Database Design Purpose- translate the logical description of data into the technical specifications for storing and retrieving data Goal - create.
Carnegie Mellon Carnegie Mellon Univ. Dept. of Computer Science Database Applications C. Faloutsos Recovery.
Introduction.  Administration  Simple DBMS  CMPT 454 Topics John Edgar2.
Database System Concepts ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 17: Recovery System.
11.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles 11.5 Free-Space Management Bit vector (n blocks) … 012n-1 bit[i] =  1  block[i]
Recovery technique. Recovery concept Recovery from transactions failure mean data restored to the most recent consistent state just before the time of.
CS 540 Database Management Systems
Chapter 5 Record Storage and Primary File Organizations
Database Applications (15-415) DBMS Internals- Part III Lecture 13, March 06, 2016 Mohammad Hammoud.
Jun-Ki Min. Slide Purpose of Database Recovery ◦ To bring the database into the last consistent stat e, which existed prior to the failure. ◦
File-System Management

Database Recovery Techniques
Database Recovery Techniques
Module 11: File Structure
CS522 Advanced database Systems
Record Storage, File Organization, and Indexes
File Processing : Recovery
Main Memory Database Systems
Database Applications (15-415) DBMS Internals- Part III Lecture 15, March 11, 2018 Mohammad Hammoud.
Disk Storage, Basic File Structures, and Buffer Management
Overview Continuation from Monday (File system implementation)
Overview: File system implementation (cont)
Outline Introduction Background Distributed DBMS Architecture
Recovery System.
Database Recovery 1 Purpose of Database Recovery
Database management systems
Presentation transcript:

Advanced Topics in Databases Fahime Raja Niloofar Razavi Melody Siadaty Summer 2005 Technical Report II : Main memory Databases

Outline: Introduction MMDB vs. DRDB  Storage Issues  Reliability Issues  Data Structures Concurrency Control Commit Processing Data Representation Access Methods  T-tree definition & structure Query Processing Recovery

Introduction: In a Main Memory DBMS (MMDBMS) there is no central role for I/O management. Still, an important question in a MMDBMS is how to do transactions and recovery in an efficient way:   Some of the proposed algorithms assume that a (small) stable subset of the main memory exists, a piece of memory whose content will not be lost in a power outage through a battery backup. These stable memories can be used to place, e.g., a redo log.   Others do not assume stable memories, and still use I/O to write transaction information to stable storage. These algorithms hence do not eliminate I/O, but minimize it, as the critical path in a MMDBMS transaction only needs to write the log; not data pages from the buffer manager.

Introduction: Motivations:  Requirement of short Access/Response time  Telecommunication applications  Applications handling high traffic of data, e.g. Router.  Real-Time applications End of popularity of MMDBMS techniques in the early 1990s MMDBMS were thereafter only considered of specific interest to real-time database applications, like above

Main Memory Databases Vs. Disk Resident Databases M : the primary copy of data live permanently in main memory  D: the primary copy of data is permanently disk resident M: there can be a backup copy,resident on disk  D: data can be temporarily cached in main memory for access speed up.

Main Memory Databases Vs. Disk Resident Databases Storage issues:  Access time of MM, orders of magnitude less than for disks (100 nsec vs. 10 msec)  MMDBMS footprints range between 200 KB and 2 MB  MM is normally volatile  stable memory still expensive!  Disks have high fixed dcost per access independent of the amount of the retrieved data (Block Oriented)  MM does not care of sequential access  MM data are more vulnerable to software errors, since they can be directly accessed by the processor.

Main Memory Databases Vs. Disk Resident Databases Reliability issues :   even if special hardware can enhance MM reliability, periodic backup is necessary  MM content is lost if system crashes  If a single memory board fails, the entire machine must be powered down  loosing all data!  Whatever power backup for main memory is, in turn, is less reliable than passive magnetic media.

Main Memory Databases Vs. Disk Resident Databases Data Structures:  MMDB are not DRDB with a very large cache!  DRDB: Cached data are accessed through indexes designed for disk access. Access is made through a buffer manager,which, given the disk address, checks if the relevant block is in the MM-Cache and then copies it to the MM application working area.  MMDB: data are accessed by directly referring to their memory address. The following pictures illustrate this fact. API for DRDB API for MMDB

MMDBMS Concurrency Control: Lock duration is short :   reduced contention  The advantage of small locking granules (fields or records) (when data are memory resident),is removed,   Very large lock granules (e.g., relations) are most appropriate (up to the entire database) for memory resident data. Serial transaction processing   almost eliminate the need of concurrency control   highly reduces cache flushes. CC is still necessary when,  Mixed length transactions coexist  A multiprocessor system shares the DB among different units.

MMDBMS Concurrency Control: Implementation :  Traditional: a hash table that contains entries for the objects currently locked. No lock information attached to data  MMDB: Stuff some small number of locking information to data. the first bit is set  the object is locked, If it is locked and the second bit is set,   there are one or more waiting transaction else it is free.

MMDBMS Commit Processing necessary to have a backup copy and to keep a log of transaction activity Before a transaction can commit, its activity records must be written to the log. Logging can impact response time, since each transaction must wait for at least one stable write before committing. Logging can also affect throughput if the log becomes a bottleneck In MMDBs, the logging represents the only disk operation each transaction will require.

MMDBMS Commit Processing Typical log length 400 bytes  40 bytes for Begin/End  360 bytes for Old/New values  stable the log tail (< 100 pages ) in a small amount of stable main memory  Reduces response time  Doesn’t affect bottlenecks Pre-committing:  releases transaction’s locks as soon as its log record is placed in the log, without waiting for the information to be propagated to the disk.  Doesn’t affect serialization Because the log is sequential

MMDBMS Commit Processing  Doesn’t reduce response time  Enhances concurrency Response time of others. Group committing:  accumulates enough commit records to fill up a log page and then flushes it to disk  Reduces the total # of disk accesses  can be used to relieve a log bottleneck.

MMDB Data Representation: Relational data are usually represented as flat files  Tuples are stored sequentially  Attribute values are embedded in the tuples.  Access is local Space consuming due to duplicate values Inefficient due to sequentially of computations Need of indexes :  Relational tuples can be represented as a set of pointers to data values.  use of pointers is space efficient when large values appear multiple times in the database, (the actual value needs to only be stored once.)  Pointers also simplify the handling of variable length fields since variable length data can be represented using pointers into a heap.

MMDB Access Methods: Hashing:  Fast lookup & updating  Not space efficient  Doesn’t support range queries Tree indexing:  With a single pointer get access both to an attribute value and the entire tuple  Pointers are of fixed short lengths  Suited for range queries

MMDB Access Methods: The T-Tree :  Is a data structure whose ancestors are B-Trees and AVL-trees  It is binary like AVL-trees  search is essentially binary  A T-node contains many elements like B-tree  storage & update are done efficiently  Insertions and deletions usually move data between a single node like in B-trees  Rebalancing is done by node rotation Like in AVL-trees, but much less frequent.

MMDB Access Methods: T-Tree

MMDB Query Processing: Query processing for DRDB focus on reducing disk access costs Query processing for MMDB must focus on reducing processing costs  Operation costs vary from system to system  No general optimization technique Implementation for relational operators should benefit of main memory data 7 index representation  Nested loop-join is preferred to sort-merge join:  Although the sorted relations could be represented easily in a main memory database using pointer lists, there is really no need for this since much of the motivation for sorting is already lost.

MMDBMS Backup and Recovery: Backups of memory resident databases must be maintained on disk or other stable storage to insure against loss of the volatile data. 1.the procedure used during normal database operation to keep the backup up-to-date (Checkpointing), 2.the procedure used to recover from a failure. (Failure Recovery)   loading blocks of the database “on demand” until all of the data has been loaded.  using disk striping or disk array there must be independent paths from the disks to memory

MMDBMS Backup and Recovery: 3 major steps in a recovery process: 1. Logging log information can be recorded at two different levels of abstraction,  physical logging:  records, for each update, the state of the modified database and the physical location (such as page id and offset) to which the update is applied.  logical logging: records the state transition of the database and the logical location affected by the update.  The Write Ahead Logging (WAL) is the most popular and accepted type of logging rules

MMDBMS Backup and Recovery: 2.Checkpointing MMDB checkpointing approaches fall into three categories:  non-fuzzy checkpoint the checkpointer first obtains locks on the data items to be checkpointed so that consistency of the database is preserved  fuzzy checkpoint the checkpointer does not secure any locks. To synchronize with normal transactions, the checkpointer writes a record to the log after a checkpoint is completed. In addition, the database is generally dumped in segments.  log-driven checkpoint the checkpointer applies the log to a previous dump to generate a new dump rather than dumping from the main-memory database.

MMDBMS Backup and Recovery: 3. Reloading is the last and the one of the most important parts of the recovery process. Reloading must ensure that the database is consistent after a crash. The database is loaded from the last checkpointed image and the undo and redo operations are applied to restore it to the most recent consistent state. The existing reloading schemes can be divided into two classes:  simple reloading the system does not resume its normal operation until the entire database is brought back into the main memory  concurrent reloading reload activities and transaction processing are performed in parallel.