Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM...

30
Performance Optimization with SAP on DB2 for Linux, Unix, and Windows – DB2 Backup Performance Sven-Uwe Kusche IBM May 2009

Transcript of Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM...

Page 1: Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM Table1 Table1 Table2 Table2 Table1 Unused Table1 Table2 Table2 Unused Unused Unused DART

Performance Optimization with SAP on DB2 for Linux,Unix, and Windows – DB2 Backup Performance

Sven-Uwe Kusche IBMMay 2009

Page 2: Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM Table1 Table1 Table2 Table2 Table1 Unused Table1 Table2 Table2 Unused Unused Unused DART

© SAP 2007 / Page 2

Agenda

Backup TuningPresentationQ&A

The DB2 Backup UtilityPresentationQ&A

Page 3: Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM Table1 Table1 Table2 Table2 Table1 Unused Table1 Table2 Table2 Unused Unused Unused DART

Agenda

Backup TuningPresentationQ&A

The DB2 Backup UtilityPresentationQ&A

Page 4: Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM Table1 Table1 Table2 Table2 Table1 Unused Table1 Table2 Table2 Unused Unused Unused DART

Backup Architecture

Database backup

DB2 backup utility

DB2 configuration files DB2 container(s)

Update

Backup image

Create

Read contents Read contents tohigh water mark

......

Recovery history file• Event• Date• Object• Granularity• ......

Please note:DB2 backup is

no file level backup!

Page 5: Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM Table1 Table1 Table2 Table2 Table1 Unused Table1 Table2 Table2 Unused Unused Unused DART

Backup Command

db2agentdb2agent

db2meddb2meddb2meddb2med

db2bmdb2bmdb2bmdb2bmdb2bmdb2bm

db2pfchrdb2pfchrdb2pfchrdb2pfchr

db2pfchrdb2pfchr

Connection Layer Database Layer

7 backup buffers

pcibm16:db2w50 >db2 backup db PRD onlineto /dev/nst0, /dev/nst1with 7 buffersparallelism 3 2x db2med

3x db2bm

REA

D

REA

D

REA

D

Tablespace 1 Tablespace 2 Tablespace 3

WR

ITE

WR

ITE

Page 6: Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM Table1 Table1 Table2 Table2 Table1 Unused Table1 Table2 Table2 Unused Unused Unused DART

DB2 Backup in SAP – DB13

Page 7: Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM Table1 Table1 Table2 Table2 Table1 Unused Table1 Table2 Table2 Unused Unused Unused DART

Backup Configurationdb2diag.log

2009-04-07-10.49.21.597395+120 E253547G483 LEVEL: InfoPID : 7307 TID : 1195371424 PROC : db2sysc 0INSTANCE: db2w50 NODE : 000 DB : W50APPHDL : 0-12 APPID: *LOCAL.db2w50.090407084918AUTHID : DB2W50EDUID : 35 EDUNAME: db2agent (W50) 0FUNCTION: DB2 UDB, database utilities, sqluxGetDegreeParallelism, probe:507DATA #1 : <preformatted>Autonomic backup/restore - using parallelism = 16.…Autonomic BAR - heap consumption.Targetting (90%) - 8973 of 9970 pages.…Autonomic backup - tuning enabled.Using buffer size = 553, number = 16.

Backup-Information in db2diag.log in DIAGLEVEL 3:DB2 9.1: As of FP7DB2 9.5: As of FP4DB2 9.7: As of FP0

Page 8: Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM Table1 Table1 Table2 Table2 Table1 Unused Table1 Table2 Table2 Unused Unused Unused DART

Monitor Backup Process

pcibm16:db2w50> db2 list utilities show detail

ID = 489

Type = BACKUP

Database Name = W50

Partition Number = 0

Description = online db

Start Time = 03/19/2009 09:38:22.280464

Throttling:

Priority = Unthrottled

Progress Monitoring:

Estimated Percentage Complete = 14

Total Work = 8034538965 bytes

Completed Work = 1093299133 bytes

Start Time = 03/19/2009 09:38:22.386954

Page 9: Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM Table1 Table1 Table2 Table2 Table1 Unused Table1 Table2 Table2 Unused Unused Unused DART

Backup CheckDB2 Recovery History File

Op Obj Timestamp+Sequence Type Dev Earliest Log Current Log Backup ID-----------------------------------------------------------------------------------------------------------B D 20090316110019001 N D S0000073.LOG S0000079.LOG-------------------------------------------------------------------------------------------------Contains 46 tablespace(s):

00001 SYSCATSPACE...00025 W50#ZBTAB1D00026 W50#ZBTAB1I----------------------------------------------------------------------------Comment: DB2 BACKUP W50 ONLINEStart Time: 20090316110019End Time: 20090316113144----------------------------------------------------------------------------00010 Location: /db2/W50/backup

db2w50:>db2 list history backup all for W50

Recovery history file

• Range of relevant log files• Object Granularity• Event• Start and end time• Backup Image Location

Page 10: Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM Table1 Table1 Table2 Table2 Table1 Unused Table1 Table2 Table2 Unused Unused Unused DART

Backup CheckDB2 Recovery History File in SAP – DB12

Page 11: Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM Table1 Table1 Table2 Table2 Table1 Unused Table1 Table2 Table2 Unused Unused Unused DART

Monitoring Tablespace Status

while true; dodatedb2 "select TBSP_ID, substr(TBSP_NAME,1,14) as TBSP_NAME,

TBSP_PAGE_TOP as HWM_IN_PAGES, substr(TBSP_STATE,1,18)as STATUS from SYSIBMADM.TBSP_UTILIZATION"

sleep 60done

Wed May 6 04:14:05 CEST 2009TBSP_ID TBSP_NAME HWM_IN_PAGES STATUS------------- -------------- ------------- ------------------

0 SYSCATSPACE 25812 BACKUP_IN_PROGRESS...

9 W50#DDICD 30982 NORMAL10 W50#DDICI 9762 BACKUP_IN_PROGRESS

...20 W50#ES700D 314776 NORMAL21 W50#ES700I 103242 NORMAL22 W50#SOURCED 4984 BACKUP_IN_PROGRESS23 W50#SOURCEI 7062 BACKUP_IN_PROGRESS24 W50#PROTD 7828 BACKUP_IN_PROGRESS25 W50#PROTI 2898 BACKUP_IN_PROGRESS26 W50#LOADD 1464 BACKUP_IN_PROGRESS

...44 record(s) selected.

backup alreadyfinished

backup runningor still queued

Only information about the status „backup complete“!

Page 12: Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM Table1 Table1 Table2 Table2 Table1 Unused Table1 Table2 Table2 Unused Unused Unused DART

Check of Backup Image Contentdb2ckbkp

db2ckbkp -H <backup image>

.....Server Database Name -- W50Timestamp -- 20081203121747Database Partition Number -- 0Instance -- db2w50Backup Mode -- 0Includes Logs -- 0Compression -- 0Backup Type -- 0Backup Gran. -- 0Status Flags -- 1......

Backup Mode: 0=offline, 1=onlineInclude Logs: 0=exclude logs, 1=include logsCompression: 0=no compression, 1=compressionBackup Type: 0=full, 3=tablespaceBackup Gran.: 0=normal, 16=incremental, 48=delta

Recovery history file is missing?Information from

theBackup Image via

db2ckbkp -H

Page 13: Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM Table1 Table1 Table2 Table2 Table1 Unused Table1 Table2 Table2 Unused Unused Unused DART

Summary

Your questions

?

Your questions

?

Page 14: Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM Table1 Table1 Table2 Table2 Table1 Unused Table1 Table2 Table2 Unused Unused Unused DART

Agenda

Backup TuningPresentationQ&A

The DB2 Backup UtilityPresentationQ&A

Page 15: Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM Table1 Table1 Table2 Table2 Table1 Unused Table1 Table2 Table2 Unused Unused Unused DART

Backup Optimization

Targets:

- Reduction of Database Size

- Reduction of Backup Image Size

- Reduction of Backup Runtime

Solutions:

- Tablespace Redistribution

- Deep Compression

- Reduction of High Water Mark

- Backup Tuning

Page 16: Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM Table1 Table1 Table2 Table2 Table1 Unused Table1 Table2 Table2 Unused Unused Unused DART

Backup Runtime

Influencing Factors:

- Database Size- Hardware (Storage, CPU, Memory, Network, Target Device)- Configuration (IO Server, Parallelism, Number of Buffers....)- File System Caching- Tablespace Distribution- High Water Mark- (Extentsize)

Page 17: Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM Table1 Table1 Table2 Table2 Table1 Unused Table1 Table2 Table2 Unused Unused Unused DART

Tablespace Redistribution

2

1 2 3 4

3

4 1

Backup Runtime (parallelism 3)

2/1

Tablespace Distribution

1 2/1 3 4

3

2/2 42/2 2/3

1

2/3

R3loadExport / Import

Includingredistribution,Compression

andHWM reduction

Beneficial Distribution

Unequal Distribution

Redistribution

Page 18: Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM Table1 Table1 Table2 Table2 Table1 Unused Table1 Table2 Table2 Unused Unused Unused DART

Reduction of High Water MarkOverview

Extent 0

Tablespace

New HWM

Old HWM

Tablespace

Tablespace Tablespace

Back

up ru

ntim

e

Back

up ru

ntim

e

db2dart +reorg /

db6convor

R3loadexport/import

Please note: The method db2dart+reorg / db6conv is for a multipleiteration very painful and the Method R3load will need downtime!

Page 19: Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM Table1 Table1 Table2 Table2 Table1 Unused Table1 Table2 Table2 Unused Unused Unused DART

Reduction of High Water Markdb2dart

Extent 0

Tablespace

HWM

Table1

Table1

Table2

Table2

Table1

Unused

Table1

Table2

Table2

Unused

Unused

Unused

DART (V9.1) Report:2009-05-04-08.02.34.624901

Database Name: L70Operational Mode: Database Inspection Only (INSPECT)

____________________________________________________________Action option: LHWMTablespace-ID: 26; Desired Highwater Mark (Number-pages): 10

Step #1: Object ID = 22

=> Offline REORG of this table using the LONGLOBDATA option (do notspecify a temporary tablespace).

Table: SAPR3.EDI40

DAT object size: 12INX object size: 0XDA object size: 0LF object size: 0LOB object size: 0LOBA object size: 0BMP object size: 0

Total size of object parts: 12Minimum number of extents that will move by this operation: 12

Current highwater mark: 348Desired highwater mark: 4Number of used extents in tablespace: 337Number of free extents below original HWM: 13Number of free extents below desired HWM: 0Number of free extents below current HWM: 12

Step #2: Object ID = 4…….

db2dart /LHWM

Page 20: Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM Table1 Table1 Table2 Table2 Table1 Unused Table1 Table2 Table2 Unused Unused Unused DART

Reduction of High Water MarkReorganization

Extent 0 Table1

Table1

Table2

Table2

Table1

Unused

Table1

Table2

Table2

Unused

Unused

Unused

HWM

Extent 0 Table1

Table1

Table2

Table2

Table1

Table1

Table2

Table2

Unused

Unused

Unused

Unused

reorg table<table1>

Significant Improvements with DB2 V9.7.

Page 21: Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM Table1 Table1 Table2 Table2 Table1 Unused Table1 Table2 Table2 Unused Unused Unused DART

Reduction of High Water Markdb6conv

Db6conv moves tables from onetablespace to another by

recreating them in the specifiedtarget tablespace.

An offline and an online table moveis selectable.

Page 22: Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM Table1 Table1 Table2 Table2 Table1 Unused Table1 Table2 Table2 Unused Unused Unused DART

Reduction of High Water MarkR3load Export/Import

DB DB

R3load export

R3load exportimage

R3load

impo

rt

with co

mpress

ion

Caution: This method will need downtime!

Page 23: Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM Table1 Table1 Table2 Table2 Table1 Unused Table1 Table2 Table2 Unused Unused Unused DART

IO Server = Prefetcher

Tablespace 1Tablespace 1 Tablespace 2 Tablespace 3

Buffer pool

Tablespace 1Tablespace 1 Tablespace 2 Tablespace 3

Buffer pool

Database Configuration parameternum_ioserver not optimal for daily

business and online backups

Database Configuration parameternum_ioserver with correct settings for

daily business and online backups

Backup

Prefetching

In case of Online Backups please increase the number of Prefetchers (num_ioserver).Rule of Thumb: (Maximum Number of Tablespace Containers over all Tablespaces) x 2

Page 24: Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM Table1 Table1 Table2 Table2 Table1 Unused Table1 Table2 Table2 Unused Unused Unused DART

pcibm16:db2w50 52> db2 get snapshot for tablespaces on w50 | more

Tablespace Snapshot

..........Tablespace name = W50#DDICDTablespace ID = 8Tablespace Type = Database managed spaceTablespace Content Type = All permanent data. Large table space.Tablespace Page size (bytes) = 16384Tablespace Extent size (pages) = 2Automatic Prefetch size enabled = YesBuffer pool ID currently in use = 1Buffer pool ID next startup = 1Using automatic storage = NoAuto-resize enabled = YesFile system caching = No

................

File System Caching and DB2 Tablespaces

SAP Default: File System Caching NO (DB2 default as of DB2 V9.5)

Please note: After switched OFF, it is necessary to restart the DB!

Bypassing File System Caching (CIO / DIO on) increases the UDI-Performance(Update/Delete/Insert), but can decrease under some circumstances the Backup Performance.For availability of CIO / DIO please check the IBM documentation:http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/index.jsp?topic=/com.ibm.db2.luw.admin.dbobj.doc/doc/c0051304.html

Page 25: Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM Table1 Table1 Table2 Table2 Table1 Unused Table1 Table2 Table2 Unused Unused Unused DART

00:03:58 00:04:02 00:04:00

00:13:32

00:08:04

00:05:26

Extentsize 2 Extentsize 8 Extentsize 16 Extentsize 2 Extentsize 8 Extentsize 16Tablespaces

Backup Test 1 (5 Tablespaces with 5 Containers (2GB) )

Effect of Extentsize on Backup RuntimeFile System Caching ON/OFF

Filesystemcaching onFilesystemcaching off

(SAP default)

Do not blindly increase the Tablespace Extentsize.Larger Extentsize increases space consumption for

empty tables

MDC tables

Backup Performance Optimization for “No File System Caching” istargeted for V9.7 FP1 and V9.5 FP7 (big I/O independent from Extentsize)

STOP

Page 26: Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM Table1 Table1 Table2 Table2 Table1 Unused Table1 Table2 Table2 Unused Unused Unused DART

No Filesystem Caching on Target File Systemincreases Backup Performance

File System

DB2 BackupBuffer

File SystemCaching

File SystemLocking /Queuing

Backup Image

Writes tostandard

File System

Writes usingDirect IO

(DIO)

Writes usingConcurrent

IO (CIO)

Memory

Page 27: Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM Table1 Table1 Table2 Table2 Table1 Unused Table1 Table2 Table2 Unused Unused Unused DART

Storage OptimizationTablespace Layout - Customer Case

Source System (DB2 V9.5):Size: 1,6TBCompression: After Load (800GB free, no possiblity to reduce HWM)Tablespaces: 29Largest Tablespace: 900GBOnline Backup Runtime: 8h

R3load Export/Import including Tablespace Redistribution

Target System (DB2 V9.5):Size: 1,1TBCompression: ADC During Load (14GB free, HWM equal Tablespace Size)Tablespaces: 48Largest Tablespace: 71GBOnline Backup Time 3h 10 min

Test 1: Filesystem Caching OFF on Target Device (Filesystem)Backup Time 2h 17 min

Test 2: Backup Test with parallel WorkloadBackup time with num_ioserver = AUTOMATIC(8) 3h 56 minBackup time with num_ioserver = 20 3h 06 min

Page 28: Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM Table1 Table1 Table2 Table2 Table1 Unused Table1 Table2 Table2 Unused Unused Unused DART

Split Mirror Backup

Production Server Backup Server

Database Instance Database Instance

111

222

3331. Suspend all write

operations to database

2. Create a database copyon file system level

3. Resume all writeoperations

Database Database

Page 29: Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM Table1 Table1 Table2 Table2 Table1 Unused Table1 Table2 Table2 Unused Unused Unused DART

Summary

Your questions

?

Your questions

?

Page 30: Performance Optimization with SAP on DB2 for Linux, Unix ......db2dart Extent 0 Tablespace HWM Table1 Table1 Table2 Table2 Table1 Unused Table1 Table2 Table2 Unused Unused Unused DART

© SAP 2007 / Page 30

Copyright 2009 SAP AGAll rights reserved

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changedwithout prior notice.Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, Duet, Business ByDesign, ByDesign, PartnerEdge and other SAP products and services mentioned herein as well as theirrespective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned andassociated logos displayed are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

The information in this document is proprietary to SAP. This document is a preliminary version and not subject to your license agreement or any other agreement with SAP. This documentcontains only intended strategies, developments, and functionalities of the SAP® product and is not intended to be binding upon SAP to any particular course of business, product strategy,and/or development. SAP assumes no responsibility for errors or omissions in this document. SAP does not warrant the accuracy or completeness of the information, text, graphics, links, orother items contained within this material. This document is provided without a warranty of any kind, either express or implied, including but not limited to the implied warranties ofmerchantability, fitness for a particular purpose, or non-infringement.

SAP shall have no liability for damages of any kind including without limitation direct, special, indirect, or consequential damages that may result from the use of these materials. This limitationshall not apply in cases of intent or gross negligence.The statutory liability for personal injury and defective products is not affected. SAP has no control over the information that you may access through the use of hot links contained in thesematerials and does not endorse your use of third-party Web pages nor provide any warranty whatsoever relating to third-party Web pages

Weitergabe und Vervielfältigung dieser Publikation oder von Teilen daraus sind, zu welchem Zweck und in welcher Form auch immer, ohne die ausdrückliche schriftliche Genehmigung durchSAP AG nicht gestattet. In dieser Publikation enthaltene Informationen können ohne vorherige Ankündigung geändert werden.Einige von der SAP AG und deren Vertriebspartnern vertriebene Softwareprodukte können Softwarekomponenten umfassen, die Eigentum anderer Softwarehersteller sind.SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, Duet, Business ByDesign, ByDesign, PartnerEdge und andere in diesem Dokument erwähnte SAP-Produkte und Servicessowie die dazugehörigen Logos sind Marken oder eingetragene Marken der SAP AG in Deutschland und in mehreren anderen Ländern weltweit. Alle anderen in diesem Dokument erwähntenNamen von Produkten und Services sowie die damit verbundenen Firmenlogos sind Marken der jeweiligen Unternehmen. Die Angaben im Text sind unverbindlich und dienen lediglich zuInformationszwecken. Produkte können länderspezifische Unterschiede aufweisen.

Die in diesem Dokument enthaltenen Informationen sind Eigentum von SAP. Dieses Dokument ist eine Vorabversion und unterliegt nicht Ihrer Lizenzvereinbarung oder einer anderenVereinbarung mit SAP. Dieses Dokument enthält nur vorgesehene Strategien, Entwicklungen und Funktionen des SAP®-Produkts und ist für SAP nicht bindend, einen bestimmtenGeschäftsweg, eine Produktstrategie bzw. -entwicklung einzuschlagen. SAP übernimmt keine Verantwortung für Fehler oder Auslassungen in diesen Materialien. SAP garantiert nicht dieRichtigkeit oder Vollständigkeit der Informationen, Texte, Grafiken, Links oder anderer in diesen Materialien enthaltenen Elemente. Diese Publikation wird ohne jegliche Gewähr, wederausdrücklich noch stillschweigend, bereitgestellt. Dies gilt u. a., aber nicht ausschließlich, hinsichtlich der Gewährleistung der Marktgängigkeit und der Eignung für einen bestimmten Zwecksowie für die Gewährleistung der Nichtverletzung geltenden Rechts.

SAP übernimmt keine Haftung für Schäden jeglicher Art, einschließlich und ohne Einschränkung für direkte, spezielle, indirekte oder Folgeschäden im Zusammenhang mit der Verwendungdieser Unterlagen. Diese Einschränkung gilt nicht bei Vorsatz oder grober Fahrlässigkeit.Die gesetzliche Haftung bei Personenschäden oder die Produkthaftung bleibt unberührt. Die Informationen, auf die Sie möglicherweise über die in diesem Material enthaltenen Hotlinkszugreifen, unterliegen nicht dem Einfluss von SAP, und SAP unterstützt nicht die Nutzung von Internetseiten Dritter durch Sie und gibt keinerlei Gewährleistungen oder Zusagen überInternetseiten Dritter ab.

Alle Rechte vorbehalten.