390 likes | 688 Views
Introducing Real-Time Databases. By Phani Gowthami Tammineni. Overview. This presentation is about the issues in real-time database systems and presents an overview of the state of the art. Database and real-time systems. What are Real-Time Databases.
E N D
Introducing Real-Time Databases By Phani Gowthami Tammineni
Overview This presentation is about the issues in real-time database systems and presents an overview of the state of the art.
What are Real-Time Databases • Real-Time database is a database system by definition which has queries, schemas, transactions, concurrency control support, commit protocols and storage management. • In a real-time database system timing constraints are associated with transactions and data are valid for specific time intervals. • The transaction timing constraints can be completion deadlines, start times, periodic invocations and so on…
Databases Versus Real-Time Databases TRADITIONAL DATABASES • Traditional databases referred as simple databases deal with persistent data • Transactions access this data while maintaining consistency • Serializability is the correctness criterion associated with the transactions • The goal of transaction and query processing approaches adopted in database system is to achieve good throughput or response time
Databases Versus Real-Time Databases REAL-TIME DATABASES • Real-time databases deal with temporal data i.e. data becomes outdated after certain time. • Due to temporal nature of the data tasks in real-time system posses time constraints such as deadlines or periods • The goal of real-time system is to meet the time constraints of the activities.
Characteristics of RTDBS • Data Types • Transaction Behaviors • Performance Issues
Characteristics of RTDBS DATA CHARACTERSTICS • Depending on the applications, real-time system may have to handle multimedia information like audio, graphics and images. • Since systems are constantly recording the information data must have their temporal attributes recorded. • Some input devices may be to subject to noise degradation and need to record the quality of the attributes along with the data. • Systems must store execution history for maintenance or error recovery purpose
Characteristics of RTDBS TRANSACTION CHARACTERSTICS • Transactions in real-time database system can be categorized as hard and soft transactions • Hard real-time transactions are those transactions whose timing constraints are guaranteed. Missing the deadlines of these transactions result in catastrophic consequences • Soft real-time transactions have timing constraints but there may be still some justification in completing the transaction after its deadline.
Characteristics of RTDBS TRANSACTION CHARACTERSTICS • Transactions in real-time database system are used to record device readings or to handle system events. They are either periodic or event driven. • For periodic transactions most will perform updates in every period • Transactions triggered by events must take timely decisions
Characteristics of RTDBS PERFORMANCE ISSUES • The most important performance criterion is the control of concurrent transactions in order to ensure that the effect of concurrent executions is equivalent to the effect of those transactions would have had, if they had been run in some serial order • The most important requirement for real-time application is to provide a feasible schedule so that transactions can meet their hard deadlines.
Characteristics of RTDBS PERFORMANCE ISSUES • Systems should degrade gracefully since their applications are often safety-critical. • To make fast and correct decisions, data availability is critical to system performance
Transaction Scheduling • Much of the work done on real-time job scheduling focuses mainly on CPU scheduling. • Transaction Scheduling however involves not only the CPU but also other resources such as data, I/O and memory. Algorithms for scheduling these resources will be discussed in the following sections of concurrency control, I/o Scheduling and Memory Management.
Transaction Scheduling • In a RTDBS transactions should be scheduled according to their criticalness and the tightness of their deadlines, even if this means sacrificing fairness and system throughput. • A popular method is to assign a numeric priority to each transaction which reflects its relative urgency. • A transaction has many attributes that may affect its priority.
Attributes that affect transaction priority • Criticalness • Deadline • Amount of unfinished work • Amount of computation already invested • Age • Slackness
Concurrency Control • Concurrency control refers to the control of the interaction among concurrent transactions in such a way that database consistency is preserved. • Serializability is the most popular criterion in concurrency control. • Any inconsistency introduced by concurrent transactions does not spread too much over the database because data are often short-lived
Concurrency Control • The prevalent approaches to concurrency control are lock based protocols and optimistic concurrency control protocols. • 2PL is the most common locking protocol in conventional database system. But these conventional locking protocols are unsatisfactory for RTDBS because of a) Priority Inversion Higher priority transaction waiting for lower priority one. b) Deadlock
Concurrency Control • The problem is that we still let a low priority transaction block a higher priority transaction Solution:
Concurrency Control • The problem is cyclic restart Solution:
Concurrency Control Snapshot 2008-04-20 15-38-39.tiff Solution:
I/O Scheduling • Disk I/O occupies a major portion of transaction execution time. • Disk scheduling algorithms taking timing constraints into account can significantly improve the real-time performance. • The order in which I/O requests are serviced has an immense impact on the response time and throughput of the I/O subsystem.
Disk Scheduling Algorithms • Four requests in the I/O Queue: A, B, C, D • pr(A)>pr(B)>pr(C)>pr(D) For example
Disk Scheduling Algorithms Highest Priority First (HPF): • Highest priority is served first HPF: A, B, C, D • The problem here is that it is not a very smart scheduling algorithm if throughput or response time is concern.
Disk Scheduling Algorithms Elevator: • It moves the head from one end of the disk to the other and then back, servicing whatever requests are on its way and changing the direction whenever there are no more requests ahead in its direction. Elevator: D, B, C, A • Elevator principle says that “ do pick them up because the disk is already there”. • The problem here is that the priority of requests is not considered.
Disk Scheduling Algorithms FD-SCAN: • FD-SCAN stands for feasible deadline scan • It targets the disk head towards the track with the highest priority request but also services the requests which are on its way. FD-SCAN: C, A, D, B • FD-Scan performs best among the algorithms tested in terms of the ability to meet deadlines.
Memory Management • This section is divided into two parts -- The dividing issue is whether memory space is tight or plentiful. If a real time system has limited amount of memory buffer management concerns the allocation of memory space. --Another one is, if memory is plentiful much of the data can reside in main store known as memory resident database systems
Buffer Management • The goal here is that highest priority transaction is not hindered by the lack of memory. • The availability of memory affects transaction response time in two ways • First before a transaction starts its execution buffers have to be allocated to the transaction. These buffers are used to store execution code, copies of file and data paged in from disk.
Buffer Management • Depending on the transaction, a certain number of buffers have to be allocated in order to prevent the transaction from thrashing. When memory is low transaction is blocked from execution. • Secondly some application such as image processing have high demands of memory. Their executions will be significantly slowed down if memory is tight and frequent memory swapping is done. • Thus the job of buffer manager is to allocate memory buffers to transactions intelligently such that higher priority transactions enjoy shorter response times.
Memory Resident Database Systems • As the price of the memory continues to drop one possible remedy is to put data directly into memory, thus eliminating I/O accesses. • Main memory access time is much faster (1000-10000) and is more predictable (no disk access). • These features are very desirable in RTDB’s and may even be necessary if transactions have extremely tight time constraints.
Memory Resident Database Systems DISADVANTAGES: • MRDBS is more costly than disk based systems. • There is still a limit on how much data can be memory resident. • Data stored in main memory usually do not survive through a power failure nor a CPU failure.
Conclusion • Discussed various issues concerning the design and implementation of real time databases and transaction processing. • Distinguished RTDBS from traditional database systems • CPU, data, I/O and memory scheduling were also discussed. • Thus the performance of real-time database systems is measured by how well the time constraints associated with transactions are met.