Lock Tuning. Overview Data definition language (DDL) statements are considered harmful DDL is the language used to access and manipulate catalog or metadata.

Slides:



Advertisements
Similar presentations
2 - Tuning the Guts © Dennis Shasha, Philippe Bonnet Tuning the Guts Concurrency Control –How to minimize lock contention? Recovery –How to manage.
Advertisements

Module 13: Performance Tuning. Overview Performance tuning methodologies Instance level Database level Application level Overview of tools and techniques.
Index Dennis Shasha and Philippe Bonnet, 2013.
Accessing data Transactions. Agenda Questions from last class? Transactions concurrency Locking rollback.
Tuning Dennis Shasha and Philippe Bonnet, 2013.
Manipulating Data Schedule: Timing Topic 60 minutes Lecture
Lock Tuning. AOBD 2007/08 H. Galhardas Concurrency Control Goals Performance goals  Reduce blocking One transaction waits for another to release its.
Lock Tuning. overview © Dennis Shasha, Philippe Bonnet 2001 Sacrificing Isolation for Performance A transaction that holds locks during a screen interaction.
1 Magnetic Disks 1956: IBM (RAMAC) first disk drive 5 Mb – Mb/in $/year 9 Kb/sec 1980: SEAGATE first 5.25’’ disk drive 5 Mb – 1.96 Mb/in2 625.
Log Tuning. AOBD 2007/08 H. Galhardas Atomicity and Durability Every transaction either commits or aborts. It cannot change its mind Even in the face.
Transaction Processing. Objectives After completing this lesson, you should be able to do the following: –Define transactions effectively for an application.
Transaction Management Overview. Transactions Concurrent execution of user programs is essential for good DBMS performance. –Because disk accesses are.
Allowing Multi-user Access Grant – GRANT ON TO |WITH GRANT OPTION | –GRANT TO | WITH ADMIN OPTION| – can be PUBLIC or a role – can be ALL Revoke – REVOKE.
Boost Write Performance for DBMS on Solid State Drive Yu LI.
Transaction Management and Concurrency Control
Fundamentals, Design, and Implementation, 9/e Chapter 11 Managing Databases with SQL Server 2000.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Transaction Management and Concurrency Control.
1 Database Systems (Part I) Introduction to Databases I Overview  Objectives of this lecture.  History and Evolution of Databases.  Basic Terms in Database.
Introduction to Databases
DBMS Functions Data, Storage, Retrieval, and Update
1 Lecture 31 Introduction to Databases I Overview  Objectives of this lecture  History and Evolution of Databases  Basic Terms in Database and definitions.
H.Lu/HKUST L07: Lock Tuning. L07-Lock Tuning - 2 H.Lu/HKUST Lock Tuning  The key is to combine the theory of concurrency control with practical DBMS.
Physical Storage Organization. Advanced DatabasesPhysical Storage Organization2 Outline Where and How data are stored? –physical level –logical level.
9 Copyright © 2009, Oracle. All rights reserved. Managing Data Concurrency.
Chapter 9 Overview  Reasons to monitor SQL Server  Performance Monitoring and Tuning  Tools for Monitoring SQL Server  Common Monitoring and Tuning.
IST Databases and DBMSs Todd S. Bacastow January 2005.
1 Storage Refinement. Outline Disk failures To attack Intermittent failures To attack Media Decay and Write failure –Checksum To attack Disk crash –RAID.
Managing Multi-User Databases AIMS 3710 R. Nakatsu.
Index tuning Performance Tuning.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
Allowing Multi-user Access Grant – GRANT ON TO – |WITH GRANT OPTION / WITH ADMIN OPTION| – can be PUBLIC or a role – can be all Revoke – REVOKE ON FROM.
CODD’s 12 RULES OF RELATIONAL DATABASE
© Dennis Shasha, Philippe Bonnet – 2013 Communicating with the Outside.
1 Recovery Tuning Main techniques Put the log on a dedicated disk Delay writing updates to the database disks as long as possible Setting proper intervals.
1099 Why Use InterBase? Bill Todd The Database Group, Inc.
© Dennis Shasha, Alberto Lerner, Philippe Bonnet 2004 DBMS Performance Monitoring.
Overview – Chapter 11 SQL 710 Overview of Replication
9 Copyright © 2007, Oracle. All rights reserved. Managing Data and Concurrency.
1 Performance Tuning Next, we focus on lock-based concurrency control, and look at optimising lock contention. The key is to combine the theory of concurrency.
DB2. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/DB01/003 Version No:2.0a Session Plan Introduction to Concurrency Control Different types.
CS Hardware Tuning Xiaofang Zhou School of Computing, NUS Office: S URL:
© Dennis Shasha, Philippe Bonnet 2001 Log Tuning.
CS Operating System & Database Performance Tuning Xiaofang Zhou School of Computing, NUS Office: S URL:
Physical Storage Organization. Advanced DatabasesPhysical Storage Organization2 Outline Where and How data are stored? –physical level –logical level.
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.
8 Copyright © 2005, Oracle. All rights reserved. Managing Data.
Transactions and Locks A Quick Reference and Summary BIT 275.
Module 6: Data Protection. Overview What does Data Protection include? Protecting data from unauthorized users and authorized users who are trying to.
Physical Database Design Purpose- translate the logical description of data into the technical specifications for storing and retrieving data Goal - create.
Transaction Management Overview. Transactions Concurrent execution of user programs is essential for good DBMS performance. – Because disk accesses are.
Module 11: Managing Transactions and Locks
©Bob Godfrey, 2002, 2005 Lecture 17: Transaction Integrity and Concurrency BSA206 Database Management Systems.
3 Database Systems: Design, Implementation, and Management CHAPTER 9 Transaction Management and Concurrency Control.
Module 14: Managing Transactions and Locks. Overview Introducing Transactions and Locks Managing Transactions Understanding SQL Server Locking Architecture.
Oracle 10g Database Administrator: Implementation and Administration Chapter 10 Basic Data Management.
Troubleshooting Dennis Shasha and Philippe Bonnet, 2013.
Chapter 13 Managing Transactions and Concurrency Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition.
© Dennis Shasha, Philippe Bonnet 2001 Lock Tuning.
Oracle Database Architectural Components
Indexing strategies and good physical designs for performance tuning Kenneth Ureña /SpanishPASSVC.
1 Chapter 2. Universal Tuning Considerations Spring 2002 Prof. Sang Ho Lee School of Computing, Soongsil University
Managing Multi-User Databases
Transaction Management and Concurrency Control
LAB: Web-scale Data Management on a Cloud
Introduction of Week 6 Assignment Discussion
Selected Topics: External Sorting, Join Algorithms, …
Introduction of Week 13 Return assignment 11-1 and 3-1-5
Index Tuning Additional knowledge.
Chapter 11 Managing Databases with SQL Server 2000
Transation Management
Presentation transcript:

Lock Tuning

Overview

Data definition language (DDL) statements are considered harmful DDL is the language used to access and manipulate catalog or metadata The catalog can easily become a hot spot and therefore a bottleneck The lesson is: avoid updates to the system catalog during heavy system activity, especially if you are using dynamic SQL © Dennis Shasha, Philippe Bonnet 2001

Think about partitioning Problem: insert a collection records into history file or security file, or log file –Time dependent insertion –Last page of the file may become a concurrency bottleneck Solution: partition insertions to the file across different pages and possibly different disks –Set up many insertion points and insert into them randomly –Set up a clustering index based on some attribute that is not correlated with the time of insertion. –Hash the time of insertion and use that as the clustering key. © Dennis Shasha, Philippe Bonnet 2001

Multiple insertion points and page locking “sequential” a clustered index defined on an attribute whose value increases (or even decreases) with time “Nonsequential” denotes that independent of time © Dennis Shasha, Philippe Bonnet 2001

Multiple insertion points and row locking Row locking avoids contention between successive insertions © Dennis Shasha, Philippe Bonnet 2001

Circumventing hot spots A hot spot is a piece of data that is accessed by many transactions and is updated by some. Hot spots cause bottlenecks because each updating transaction must complete before any other transaction can obtain a lock on the hot data item. Solution –Use partitioning to eliminate it –Access the hot spot as late as possible in the transaction –Use special database management facilities © Dennis Shasha, Philippe Bonnet 2001

2 - Tuning the Guts © Dennis Shasha, Philippe Bonnet Logical Bottleneck: Sequential Key generation Consider an application in which one needs a sequential number to act as a key in a table, e.g. invoice numbers for bills. Ad hoc approach: a separate table holding the last invoice number. Fetch and update that number on each insert transaction. –The last invoice number becomes a bottleneck due to two-phase locking Counter approach: use facility such as Sequence (Oracle)/Identity(SQL Server).

© Dennis Shasha, Philippe Bonnet 2001 Latches and Locks Locks are used for concurrency control –Is held until commit the transaction –Requests for locks are queued Priority queue –Lock data structure Locking mode, lock granularity, transaction id. Lock table Latches are used for mutual exclusion –A latch is released immediately after access –Requests for latch succeeds or fails Active wait (spinning) on latches on multiple CPU. –Single location in memory Test and set for latch manipulation

© Dennis Shasha, Philippe Bonnet 2001 Counter Facility -- data Settings: –default isolation level: READ COMMITTED; Empty tables –Dual Xeon (550MHz,512Kb), 1Gb RAM, Internal RAID controller from Adaptec (80Mb), 4x18Gb drives (10000RPM), Windows accounts( number, branchnum, balance); create clustered index c on accounts(number); counter ( nextkey ); insert into counter values (1);

© Dennis Shasha, Philippe Bonnet 2001 Counter Facility -- transactions No Concurrent Transactions: –System [ inserts, N threads] SQL Server 7 (uses Identity column) insert into accounts values (94496,2789); Oracle 8i insert into accounts values (seq.nextval,94496,2789); –Ad-hoc [ inserts, N threads] begin transaction NextKey:=select nextkey from counter; update counter set nextkey = NextKey+1; commit transaction begin transaction insert into accounts values(NextKey,?,?); commit transaction

© Dennis Shasha, Philippe Bonnet 2001 Avoid Bottlenecks: Counters System generated counter (system) much better than a counter managed as an attribute value within a table (ad hoc). Counters may miss ids, however which is tolerable in many real apps

summary