OPS-28: A New Spin on Some Old Latches Richard Banville Fellow.

Slides:



Advertisements
Similar presentations
Introduction to Database Systems1 Buffer Management Storage Technology: Topic 2.
Advertisements

More on File Management
DB-03: A Tour of the OpenEdge™ RDBMS Storage Architecture Richard Banville Technical Fellow.
CS4432: Database Systems II Buffer Manager 1. 2 Covered in week 1.
Some More Database Performance Knobs North American PUG Challenge
Ch. 7 Process Synchronization (1/2) I Background F Producer - Consumer process :  Compiler, Assembler, Loader, · · · · · · F Bounded buffer.
Chapter 6: Process Synchronization
5.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 5: CPU Scheduling.
1 PUG Challenge Americas 2013 Click to edit Master title style PUG Challenge Americas 2013 – Westford, MA The Deepest Depths of promon Presented by: Gus.
Buffer Cache Waits. #.2 Copyright 2006 Kyle Hailey Buffer Cache Waits Waits Disk I/O Buffer Busy Library Cache Enqueue SQL*Net Free Buffer Hot Blocks.
Oracle Architecture. Instances and Databases (1/2)
Recovery CPSC 356 Database Ellen Walker Hiram College (Includes figures from Database Systems by Connolly & Begg, © Addison Wesley 2002)
1 - Oracle Server Architecture Overview
Computer Organization and Architecture
Crash recovery All-or-nothing atomicity & logging.
Instructor: Umar KalimNUST Institute of Information Technology Operating Systems Process Synchronization.
Synchronization CSCI 444/544 Operating Systems Fall 2008.
Chapter 9 Overview  Reasons to monitor SQL Server  Performance Monitoring and Tuning  Tools for Monitoring SQL Server  Common Monitoring and Tuning.
Database I/O Mechanisms
1 Copyright © 2005, Oracle. All rights reserved. Introduction.
Operating Systems CSE 411 CPU Management Oct Lecture 13 Instructor: Bhuvan Urgaonkar.
Backup & Recovery 1.
Birth, Death, Infinity Gus Björklund. Progress. Dan Foreman. BravePoint. PUG Challenge Americas, 9-12 June 2013.
File Management Chapter 12. File Management File management system is considered part of the operating system Input to applications is by means of a file.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
Sofia, Bulgaria | 9-10 October SQL Server 2005 High Availability for developers Vladimir Tchalkov Crossroad Ltd. Vladimir Tchalkov Crossroad Ltd.
Top 10 Performance Hints Adam Backman White Star Software
Strength. Strategy. Stability.. Progress Performance Monitoring and Tuning Dan Foreman Progress Expert BravePoint BravePoint
7202ICT – Database Administration
Oracle Tuning Ashok Kapur Hawkeye Technology, Inc.
DONE-08 Sizing and Performance Tuning N-Tier Applications Mike Furgal Performance Manager Progress Software
Progress Database Admin 1 Jeffrey A. Brown - Technical Support Consultant
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.
Table Partitioning For Maintenance and Performance Richard Banville OpenEdge Development Progress Software.
DB-15: Inside The Recovery Subsystem Plan to commit; Be prepared to rollback. Richard Banville Fellow, Technology and Product Architecture Progress OpenEdge.
Ingres Configuration and Performance Or How to get Ingres to perform as well as the English Team by Rob Acraman Dept Natural Resources 30 th May 2007.
Process Architecture Process Architecture - A portion of a program that can run independently of and concurrently with other portions of the program. Some.
DB-08: A Day in the Life of a Type II Record Richard Banville Progress Fellow.
Table Partitioning For Maintenance and Performance Jarmo Nieminen, System Engineer, Principal Gus Bjorklund, Wizard.
OPS-12: A New Spin on Some Old Latches Richard Banville Fellow.
Using Progress® Analytical Tools Adam Backman White Star Software DONE-05:
Recovery technique. Recovery concept Recovery from transactions failure mean data restored to the most recent consistent state just before the time of.
Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.
Transactional Recovery and Checkpoints. Difference How is this different from schedule recovery? It is the details to implementing schedule recovery –It.
3 Copyright © 2004, Oracle. All rights reserved. Database Architecture Comparison.
What Should a DBMS Do? Store large amounts of data Process queries efficiently Allow multiple users to access the database concurrently and safely. Provide.
No more waiting. Sponsors About me  Database Technology Specialist  MVP  Blogger  Author 3
Oracle Database Architectural Components
Chapter 21 SGA Architecture and Wait Event Summarized & Presented by Yeon JongHeum IDS Lab., Seoul National University.

CS 540 Database Management Systems
Chapter 2: Computer-System Structures
Behind The Scenes: Updating A Record
Lecture 21 Synchronization
Ivy Eva Wu.
Chapter Overview Understanding the Database Architecture
Walking Through A Database Health Check
The Deepest Depths of promon
Promon for Dummies & Savants
Module 2: Computer-System Structures
Troubleshooting Techniques(*)
CSE 153 Design of Operating Systems Winter 19
Chapter 2: Computer-System Structures
Chapter 2: Computer-System Structures
Module 2: Computer-System Structures
CSE 451 Section 1/27/2000.
CSE 542: Operating Systems
CS222/CS122C: Principles of Data Management UCI, Fall 2018 Notes #03 Row/Column Stores, Heap Files, Buffer Manager, Catalogs Instructor: Chen Li.
CSE 542: Operating Systems
Presentation transcript:

OPS-28: A New Spin on Some Old Latches Richard Banville Fellow

© 2008 Progress Software Corporation2 OPS-28: A New Spin on Some Old Latches Agenda  Monitoring  Latch usage  Performance

© 2008 Progress Software Corporation3 OPS-28: A New Spin on Some Old Latches Some Definitions First  What is a “latch” Synchronization mechanism Latches vs “locks”  What is a critical section Code access to shared resource Types of resources  How is a latch obtained test, test-and-set, spin loop –Performed on “shared” value Single threading access

© 2008 Progress Software Corporation4 OPS-28: A New Spin on Some Old Latches Interactions  Cache coherency  Multi CPU issues  False sharing  Avoiding cache line ping pong Size Alignment Increase # of latches Reduced latch usage – need & time Playing nicely with the hardware

© 2008 Progress Software Corporation5 OPS-28: A New Spin on Some Old Latches Latch Info VST access to latch information _Latch-Type Latch type _Latch-Name Name _Latch-Lock # times locked _Latch-Wait Nap count _Latch-HoldUser # of last holder _Latch-QholdUser # of last holder of queue latch for each _latch:

© 2008 Progress Software Corporation6 OPS-28: A New Spin on Some Old Latches _Latch-Type: MT_LT_QUEUE Queue Latch governor LatchSemaphore Multi level latch Wakeup order guaranteed -spin 0 forces all latches Test, test-and-set spin loop

© 2008 Progress Software Corporation7 OPS-28: A New Spin on Some Old Latches _Latch-Type: MT_LT_SPIN Queue Latch governor LatchSemaphore Multi level latch Wakeup order guaranteed -spin 0 forces all latches Spin Latch Latch Short Nap Single level latch Most performant “backoff” Test, test-and-set spin loop -nap to -napmax

© 2008 Progress Software Corporation8 OPS-28: A New Spin on Some Old Latches Latch Implementations Spin or queue latch acts as governor of “mux” latch table governor Resources protected Mux latch table (128) Multi level latch with one governor Associates critical section w/resource Underlying one to many relationship Turns 1 latch into 128 latches “Mux” latch request

© 2008 Progress Software Corporation9 OPS-28: A New Spin on Some Old Latches Latch Implementations Spin or queue latch acts as governor of object latch Resources protected Multi level latch with one governor Associates critical section w/resource Underlying one to one relationship Turns 1 latch into many latches governor Enhanced mux latch Object latch - type 1 request

© 2008 Progress Software Corporation10 OPS-28: A New Spin on Some Old Latches Latch Implementations Spin or queue latch maintained within the resource itself Resources protected Single level latch. No governor Associates critical section w/resource One to one relationship Greatly improves concurrency No single access funneling Statistics maintained as if 1 latch exists Object latch - type 2 request

© 2008 Progress Software Corporation11 OPS-28: A New Spin on Some Old Latches Latch Implementations Table of spin or queue latchs Resources protected Latch table Single level latch with no governor Associates critical section w/resource Underlying one to many relationship Latch families request Statistics typically make this look like one latch Modified “mux” latch mechanism

© 2008 Progress Software Corporation12 OPS-28: A New Spin on Some Old Latches Latch Holder  _Latch-QHolder Last owner of queue type latch Not last queued user  _Latch-Holder Last owner of spin latch Not honored for “true” object latches –Type 2 Who am I waiting on?

© 2008 Progress Software Corporation13 OPS-28: A New Spin on Some Old Latches Latch Counts  _Latch-Lock # times latch locked/acquired High numbers are OK  _Latch-Wait # times user had to wait (after spin) High numbers may not be good –…but is not wrong –Performance issue potential Balance with –spin value (see tuning) Activity statistics (or lack there of)

© 2008 Progress Software Corporation14 OPS-28: A New Spin on Some Old Latches Latch Names _Latch-Name  LKP  LKF  LHT  LHT2  LHT3  LHT4  SEQ  PWQ  AIW  BIW  BFP  BHT  BF1  BF2  BF3  BF4  BF5  BF6  BF7  CPQ  LRU  LR2  LR3  LR4  L27  L28  L30  L31  MTX  USR  OM  AIB  BIB  SCC  GST  TXT  TXQ

© 2008 Progress Software Corporation15 OPS-28: A New Spin on Some Old Latches Agenda  Monitoring  Latch usage  Performance

© 2008 Progress Software Corporation16 OPS-28: A New Spin on Some Old Latches Miscellaneous Latches  USR* Protects login (user) control structures  SCC* Protects schema locking operation  GST Protects shared memory allocation *Indicates queue latch

© 2008 Progress Software Corporation17 OPS-28: A New Spin on Some Old Latches Obsolete Latches  Removed AIW, LR2, LR3, LR4  Not in use BIW  Renamed & reserved for future use BF5 L27 BF6 L28 BF7 L29 BF8 L30 Latches removed or reserved

© 2008 Progress Software Corporation18 OPS-28: A New Spin on Some Old Latches Latches Protecting Database Update Actions

© 2008 Progress Software Corporation19 OPS-28: A New Spin on Some Old Latches Update Latches - MTX DB Update Action Record BI note Record AI note Perform Action DB Update Action Record BI note Record AI note Perform Action DB Update Action Record BI note Record AI note Perform Action Top of the food chain – busiest/longest update latch Protects txn allocation & bi/ai note order Quiet point maintenance Online backup startup Latches protecting recovery logging procedure High activity High nap rate MT X Not allowed User 1 User 2 User 3

© 2008 Progress Software Corporation20 OPS-28: A New Spin on Some Old Latches Rollback Processing BI Buffer Pool – Recording a change -bibufs 10 NF - a NF - b NF - c NF - d NF - e Modified Queue Free List 15 Current Input Buffer 9 Backout Buffer 12 Backout Buffer BI Current Output Buffer New Notes (Actions) Forward Processing

© 2008 Progress Software Corporation21 OPS-28: A New Spin on Some Old Latches BIB and AIB latch usage -bibufs 10 Free(a) Free(b) Free(c) Free(d) Free(e) Modified Queue Free List BI Current Output Buffer New Notes (Actions) Forward Processing Bi (ai) buffer life cycle B I W Very little contention until BIW active OLTP latch order: MTX, BIB, AIB Page writer latch order: BIB or AIB BI B User

© 2008 Progress Software Corporation22 OPS-28: A New Spin on Some Old Latches Latches – LRU & PWQ B least recently used (LRU) chain maintenance LRU MRU High activity High nap rate LRU

© 2008 Progress Software Corporation23 OPS-28: A New Spin on Some Old Latches Latches – LRU & PWQ B least recently used (LRU) chain maintenance LRU MRU Page writer queue (PWQ) myDB Page Writer Page Writer Dirty buffer Very little contention unless too many APWs LRU PWQ LRU User

© 2008 Progress Software Corporation24 OPS-28: A New Spin on Some Old Latches Latches – LRU & CPQ B least recently used (LRU) chain maintenance LRU MRU Page writer queue (PWQ) myDB Page Writer Page Writer Check point queue (CPQ) Check- point Check- point Very little contention CPQ

© 2008 Progress Software Corporation25 OPS-28: A New Spin on Some Old Latches Online backup queue - BFP Online “point in time” backup User 1 BI Area 6 Area 7Area 8 … Online Backup.bak Backup queue Modify request Very little contention Only used w/online backup Back it up and mark it BFP TXE MTX BFP

© 2008 Progress Software Corporation26 OPS-28: A New Spin on Some Old Latches Update Latches  TXT Protects transaction table modifications  TXQ Protects acquire/release of transaction end lock (TXE)  SEQ Protects sequence control structures  Moderate activity  Little contention Latches for write operation structures

© 2008 Progress Software Corporation27 OPS-28: A New Spin on Some Old Latches Latches Protecting Data Access Actions and Housekeeping

© 2008 Progress Software Corporation28 OPS-28: A New Spin on Some Old Latches Disk Storage Files Storage Areas Data Area Extent Table A Table BCust TblTable D Index A-1 Index B-1Name Idx Cust# IdxSRep IdxIndex D-1Index D-2 Logical Physical

© 2008 Progress Software Corporation29 OPS-28: A New Spin on Some Old Latches Disk Storage Files Storage Areas Schema AreaArea 7Area 8 Extent Table A Table BCust TblTable D Index A-1 Index B-1Name Idx Cust# IdxSRep IdxIndex D-1Index D-2 Logical Physical Languages Storage Engine

© 2008 Progress Software Corporation30 OPS-28: A New Spin on Some Old Latches Disk Storage Files Storage Areas and Object Mapping Schema AreaArea 7Area 8 Extent Table A Table B Cust Tbl Table D Index A-1 Index B-1 Name IdxCust# IdxSRep IdxIndex D-1Index D-2 Logical Physical Mapping Languages Storage Engine

© 2008 Progress Software Corporation31 OPS-28: A New Spin on Some Old Latches Object Cache – OM Latch Table A Table B Cust Tbl Table D Index A-1 Index B-1 Name IdxCust# IdxSRep IdxIndex D-1Index D-2 Logical Mapping Languages -omsize OM cache loaded on demand Very high activity High nap rate OM latch needed for paging maintenance Get _StorageObject record Schema OMOM

© 2008 Progress Software Corporation32 OPS-28: A New Spin on Some Old Latches Object Cache - OM Latch Table A Table B Cust Tbl Table D Index A-1 Index B-1 Name IdxCust# IdxSRep IdxIndex D-1Index D-2 Logical Mapping Languages OM cache loaded at startup No latching, no paging Zero contention! Primary Cache Little contention 2 nd cache for over flow & OM latch needed for paging maintenance Get _StorageObject record Schema Secondary Cache new objects OMOM Schema -omsize

© 2008 Progress Software Corporation33 OPS-28: A New Spin on Some Old Latches Buffer Pool Hash Table - BHT Hash Table (-hash) Shared memory block lookup List of (–B) buffer pool entries (unordered) Buffer pool location lookup single threaded User 1 User 2 User 3 User 4 Block ID BH T High activity, few naps Ptr to buffer

© 2008 Progress Software Corporation34 OPS-28: A New Spin on Some Old Latches Buffer Pool Hash Table - BHT Hash Table (-hash) BHT now latch family of 256 List of (–B) buffer pool entries (unordered) Buffer pool location lookup multi-threaded Block ID User 1 User 2 User 3 User 4 Block ID High activity, few naps Ptr to buffer BHT... BHT

© 2008 Progress Software Corporation35 OPS-28: A New Spin on Some Old Latches -B buffer pool entry info – BF[1-4] Database access latches List of (–B) buffer pool entries (unordered) Ptr to buffer Hash Table (-hash) BHT... BHT

© 2008 Progress Software Corporation36 OPS-28: A New Spin on Some Old Latches -B buffer pool entry info – BF[1-4] List of (–B) buffer pool entries (unordered) Buffer pool info structure supports Hash Table (-hash) Database access latches max of 4 concurrent threads. BF 1 BF 2 BF 3 BF 4 Latch family of 4 Ptr to buffer BHT... BHT

© 2008 Progress Software Corporation37 OPS-28: A New Spin on Some Old Latches -B buffer pool entry info – BF[1-4] List of (–B) buffer pool entries (unordered) Block ID User 1 User 2 User 3 User 4 Block ID BF latch family of 4 Object latch type 2 Ptr to buffer Hash Table (-hash) BHT... BHT

© 2008 Progress Software Corporation38 OPS-28: A New Spin on Some Old Latches -B buffer pool entry info – BF[1-4] Hash Table (-hash) List of (–B) buffer pool entries (unordered) Block ID User 1 User 2 User 3 User 4 Block ID -B info structure supports –B threads 4 latch slots used for statistics only Ptr to buffer BF latch family of 4 Object latch type 2 BHT... BHT

© 2008 Progress Software Corporation39 OPS-28: A New Spin on Some Old Latches Lock Table Latches (LKF, LKP & LHT) Free Chain (-L entries) Hash Chain Anchor Table -lkhash entries Acquire a lock LK F Plain latch Single threaded access High activity Low nap rate

© 2008 Progress Software Corporation40 OPS-28: A New Spin on Some Old Latches Lock Table Latches (LKF, LKP & LHT) Free Chain (-L entries) Hash Chain Anchor Table -lkhash entries Protected by LHT (LKT) Record locks Record “get” locks Table locks Purged record locks and LKP latches Type 1 object latch Single threaded latch access Multi threaded chain access LHT LKP LH T LK P High activity/waits Low activity/waits

© 2008 Progress Software Corporation41 OPS-28: A New Spin on Some Old Latches LHT1 LHT2 LHT3 LHT4 Lock Table Latches (LKF, LKP & LHT) Free Chain (-L entries) Hash Chain Anchor Table -lkhash entries Protected by LHT[1-4] Record locks Record “get” locks Type 1 object latch family Multi threaded latch access Multi threaded chain access - Added 4 governors Enhanced concurrency Low contention/waits LK P High activity, few waits

© 2008 Progress Software Corporation42 OPS-28: A New Spin on Some Old Latches Agenda  Monitoring  Latch usage  Performance

© 2008 Progress Software Corporation43 OPS-28: A New Spin on Some Old Latches Tuning parameters  -spin # retries before nap –0 or 1 or 10,000 or 6,000 * # cpus or … Can be changed online  -mux Use multiplexing/governor (1)  -nap Initial amount to nap (10 ms)  -napmax* Max amount to nap (5 sec)  -napinc and -napstep Both obsolete and ignored Nothing new here

© 2008 Progress Software Corporation44 OPS-28: A New Spin on Some Old Latches Foresight and insight  CPU usage -spin ~6,000 * # CPUs CPU thrashes, decrease –spin > 16 CPUs, avoid cache line ping pong Activity matters  Activity # latches acquired # latch waits Application throughput What to monitor

© 2008 Progress Software Corporation45 OPS-28: A New Spin on Some Old Latches Performance – 10.1C vs 10.1B House KeepingData Access

© 2008 Progress Software Corporation46 OPS-28: A New Spin on Some Old Latches Performance – 10.1C vs 10.1B HousekeepingData Access Latches/sec LRU 31%Buf 43%

© 2008 Progress Software Corporation47 OPS-28: A New Spin on Some Old Latches Performance – wait for it 4,294 (~9%) fewer latch waits/sec in 10.1c

© 2008 Progress Software Corporation48 OPS-28: A New Spin on Some Old Latches Performance – you got it! ~40% ~56% # Users

© 2008 Progress Software Corporation49 OPS-28: A New Spin on Some Old Latches In Summary  Better insight  We’ve done some things  You can too Tuning Move to 10.1C

© 2008 Progress Software Corporation50 OPS-28: A New Spin on Some Old Latches Questions ?

© 2008 Progress Software Corporation51 OPS-28: A New Spin on Some Old Latches Thank You

© 2008 Progress Software Corporation52 OPS-28: A New Spin on Some Old Latches