Transaction Log Internals and Performance David M Maxwell

Slides:



Advertisements
Similar presentations
Oracle Architecture. Instances and Databases (1/2)
Advertisements

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.
© 2009 IBM Corporation March 1, 2009 Log File Management in DB2 for Linux, UNIX, and Windows Ron Castelletto IBM Canada Lab
FlareCo Ltd ALTER DATABASE AdventureWorks SET PARTNER FORCE_SERVICE_ALLOW_DATA_LOSS Slide 1.
SharePoint and SQL Server integration Demo: SQL Server Optimizing Configurations SQL Server 2014 for SharePoint 2013 Avoiding ginormous transaction.
1 - Oracle Server Architecture Overview
10 Copyright © 2009, Oracle. All rights reserved. Managing Undo Data.
Module 5 Understanding SQL Server 2008 R2 Recovery Models.
Backup and Recovery Part 1.
Tuning SQL Server 2012 for SharePoint 2013 Jump Start 01 | Key SQL Server and SharePoint Server Integration Concepts (50 minutes) Dedicated Server or.
BARBARIN DAVID SQL Server Senior Consultant Pragmantic SA SQL Server Denali : New administration features.
Tuning SQL Server 2012 for SharePoint 2013 Jump Start 01 | Key SQL Server and SharePoint Server Integration Concepts (50 minutes) Dedicated Server or.
Modification is sent by application to SQL Server Modification is sent by application to SQL Server 1 Data pages are located in, or.
Transactions and Locks Lesson 22. Skills Matrix Transaction A transaction is a series of steps that perform a logical unit of work. Transactions must.
Stephan Hurni Consultant Trivadis AG, SQL Server notes from the field.
1 Demystifying the Transaction Log. 2 Rob Canzonire Advisory Database Administrator at Blue Cross Blue Shield of Louisiana Microsoft Certified Solutions.
Tuning SQL Server 2012 for SharePoint 2013 Jump Start 01 | Key SQL Server and SharePoint Server Integration Concepts (50 minutes) Dedicated Server or.
© Dennis Shasha, Philippe Bonnet 2001 Log Tuning.
Resolving Journaling of Journal Anomaly in Android I/O: Multi-Version B-tree with Lazy Split Wook-Hee Kim 1, Beomseok Nam 1, Dongil Park 2, Youjip Won.
Pedro Azevedo Lopes Premier Field Engineer Microsoft Corporation.
Transactions and Locks A Quick Reference and Summary BIT 275.
Process Architecture Process Architecture - A portion of a program that can run independently of and concurrently with other portions of the program. Some.
Connect with life Vinod Kumar Technology Evangelist - Microsoft
Transaction Log Internals Dharmendra Keshari President - KDSSG.
Academic Year 2014 Spring. MODULE CC3005NI: Advanced Database Systems “DATABASE RECOVERY” (PART – 2) Academic Year 2014 Spring.
Backup and Recovery - II - Checkpoint - Transaction log – active portion - Database Recovery.
Data Disaster Recovery Planning Greg Fibiger 1/7/2016.
7 Copyright © Oracle Corporation, All rights reserved. Instance and Media Recovery Structures.
3 Copyright © 2004, Oracle. All rights reserved. Database Architecture Comparison.
SQL Server High Availability Introduction to SQL Server high availability solutions.
Oracle Database Architectural Components
Indexing strategies and good physical designs for performance tuning Kenneth Ureña /SpanishPASSVC.
10 Copyright © 2007, Oracle. All rights reserved. Managing Undo Data.
SQL Backups for Beginners by Mark Gordon
Monitoring SQL with System Center
Transaction Log Fundamentals
Inside transaction logging
Transaction Log Deep Dive
SharePoint Solutions Architect, Protiviti
Get Into the Goldilocks Zone
Installation and database instance essentials
Chapter Overview Understanding the Database Architecture
Upgrading to SQL Server 2016
SQL Server May Let You Do It, But it Doesn’t Mean You Should
SQL Backups for Beginners by Mark Gordon
The Vocabulary of Performance Tuning
Understanding and Managing SQL Server's Transaction Log
Inside transaction logging
Turbo-Charged Transaction Logs
Microsoft Virtual Academy
TEMPDB – INTERNALS AND USAGE
SQL SERVER TRANSACTION LOG INSIDE
Transaction Log Fundamentals
Overview: File system implementation (cont)
Database Backup and recovery
The Vocabulary of Performance Tuning
Keeping the Lights on with SQL Server 2012 AlwaysOn
Andrew Fryer Microsoft UK
A Beginners Guide to Transactions
Transaction Log Performance Tuning
Your Data Any Place, Any Time
The Vocabulary of Performance Tuning
Skype for Business Assessment Results
System Center Configuration Manager Assessment Results
SQL Server Assessment Results
SharePoint Server Assessment Results
System Center Operations Manager Assessment Results
Accelerated DATABASE RECOVERY
Hybrid Buffer Pool The Good, the Bad and the Ugly
Presentation transcript:

Transaction Log Internals and Performance David M Maxwell 2/23/2019 4:22 PM Transaction Log Internals and Performance David M Maxwell © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Who am I? David M Maxwell Where I’m at: twitter.com/dmmaxwell 2/23/2019 4:22 PM Who am I? David M Maxwell Where I’m at: twitter.com/dmmaxwell dmmaxwell@gmail.com dmmaxwell.wordpress.com © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Agenda What’s really in the Transaction Log? 2/23/2019 4:22 PM Agenda What’s really in the Transaction Log? How does SQL Server manage the Log file? Resolving common Transaction Log issues. Performance tuning for the Transaction Log. © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Transaction Log Contents 2/23/2019 4:22 PM Transaction Log Contents By example: an UPDATE statement. Data page is read into Buffer Pool memory. Write-Ahead Logging details the change in the Transaction Log. The page is modified in the Buffer Pool. Not all changes are user-initiated, but all changes are logged. © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Commit vs. Rollback COMMIT TRANSACTION ROLLBACK TRANSACTION 2/23/2019 4:22 PM Commit vs. Rollback COMMIT TRANSACTION A “commit” record is written to the log and the transaction ends. ROLLBACK TRANSACTION “Compensation” and “Abort” records are written to the log. The modified page in the Buffer Pool memory is changed back. Compensation records are roll-forward only. © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

2/23/2019 4:22 PM The role of CHECKPOINT CHECKPOINT writes changed (dirty) pages to disk. The transaction does not have to be completed. By default, this happens every 60 seconds. Configuring the CHECKPOINT interval: At the server level: use “Recovery Interval (minutes)” At the database level: use “Target Recovery Time (seconds)” © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Demo: Reading the log contents using fn_dblog(). 2/23/2019 4:22 PM © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

How SQL manages Transaction Log space. 2/23/2019 4:22 PM How SQL manages Transaction Log space. The log file contains smaller Virtual Log Files (VLFs). The number of VLFs depends on the create or growth size of the Log, and the version of SQL Server. For SQL Server versions 2014 and later, if the growth is less than 1/8 of the current log size, only 1 VLF is created. Create / Growth Size Number of VLFs Created < 64 MB 4 VLFs at 1/4 of the size Between 64 MB and 1 GB 8 VLFs at 1/8 of the size > 1 GB 16 VLFs at 1/16 of the size © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Example of VLF Creation 2/23/2019 4:22 PM Example of VLF Creation Consider a 2GB log file created with 16 VLFs, at 128 MB each. If the log is set to grow 10%... SQL 2012 or earlier will create 8 VLFs at 25 MB each SQL 2014 or later will create 1 VLF at 204 MB If the log is set to grow 1GB… SQL 2012 or earlier will create 8 VLFs at 128 MB each SQL 2014 or later will create 8 VLFs at 128 MB each Note that as this log passes 8GB in size, things change for SQL 2014 and later. © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

2/23/2019 4:22 PM How VLFs are used When a transaction begins writing to the log, the VLF containing the information becomes “Active”. The last VLF written to is always active. VLFs become inactive (truncated) when the records are no longer needed. SIMPLE recovery model: CHECKPOINT FULL or BULK_LOGGED recovery models: Log Backup Secondary Truncation Points: Open or Un-Replicated Transactions Availability Group or Mirrored Transactions © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

2/23/2019 4:22 PM VLFs in Action © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Demos: Examining VLFs with fn_dblog() and LOGINFO. 2/23/2019 4:22 PM Demos: Examining VLFs with fn_dblog() and LOGINFO. Troubleshooting Common Transaction Log Issues © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Performance Tuning: IO or Workload? 2/23/2019 4:22 PM Performance Tuning: IO or Workload? Examine the Wait Stats against your baseline. Long individual waits? Probably an IO issue. Small but more frequent waits? Probably a change in the workload. IO Tuning Check VLF counts, Fragmentation, Pre-Allocation Random vs. Sequential IO No, I don’t care if you have SSDs. This all still applies.  Workload Tuning Configuring recovery intervals Mitigating page splits. Batching transactions. © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Demo Performance Tuning Methods for the Transaction Log 2/23/2019 4:22 PM Demo Performance Tuning Methods for the Transaction Log © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Summary Understand the roles of COMMIT, ROLLBACK, and CHECKPOINT. 2/23/2019 4:22 PM Summary Understand the roles of COMMIT, ROLLBACK, and CHECKPOINT. Understand how SQL manages VLFs, and how to pre-allocate for transaction log space. Understand what happens when things go wrong, and how to fix them. Understand when to tune for IO or Workload. © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

2/23/2019 4:22 PM Resources Microsoft: SQL Server Transaction Log Architecture and Management Guide. SQL Skills: Transaction Log archives (Kimberly Tripp) eBook: SQL Server Transaction Log Management by Tony Davis and Gail Shaw © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

2/23/2019 4:22 PM Thanks  Here’s that contact info again: David M Maxwell Where I’m at: twitter.com/dmmaxwell dmmaxwell@gmail.com dmmaxwell.wordpress.com © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.