introduction to db2 symmetric multiprocessing for ibm i · next, you will learn some usage details...

37
1 Introduction to DB2 Symmetric Multiprocessing for IBM i

Upload: others

Post on 26-Apr-2020

10 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

1

IntroductiontoDB2SymmetricMultiprocessingforIBMi

Page 2: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

2

About the Author: Mike Cain, DB2 for i Center of Excellence, IBM STG Lab Services and Training Mike Cain is the leader of the DB2 for i Center of Excellence team in the IBM Systems and Technology Group Lab Services and Training organization in Rochester, Minnesota. Prior to his current position, he was the team leader of the AS/400 Teraplex Integration Center and worked as an IBM AS/400 systems engineer and technical consultant. Mike can be reached at: [email protected]

Page 3: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

Introd Welcomewithin IB(SMP) feoperating IBM i wa PrerequisThis coufor i data

duction e to this onlinM i. The pur

eature of IBMg system run

s formerly ca

sites: rse will be m, or use solu

ne course, erpose of this M i™. The renning on the

alled i5/OS®

most useful toutions that m

entitled DB2 course is to

eader will lea IBM® POW

®.

o IBM i™ demake use of S

Symmetric o explain thearn about daWER® platfor

evelopers wSQL to conn

Multiprocesse DB2® Symatabase pararm.

who code SQnect and retr

sing: Databammetric Multiallelism withi

QL queries torieve data fro

ase Paralleliiprocessing n the IBM i

o access DBom DB2 for

3

sm

B2® i.

Page 4: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

4

Agenda This course will first talk about the need for installing the DB2 Symmetric Multiprocessing (SMP) feature of IBM i. You will even learn how to determine if this feature has already been installed on your system or on a particular logical partition. A discussion will follow on the IBM i architecture and how it works cohesively with DB2 for i to deliver powerful parallelism for database access. Next, you will learn some usage details on how to turn SMP on and off, and how to manage the degree of parallelism that is used by a particular job. Feedback is important to understanding how well your jobs are monitoring SMP performance, via Visual Explain and other tools. This will be reviewed. This course will conclude by reviewing several tips and considerations related to the use of database parallelism in the IBM i environment. It is strongly recommended that database administrators, engineers, analysts, and developers who are new to DB2 for i or using SQL on IBM i, attend the DB2 for i SQL Performance workshop. This class provides in-depth information on the way to architect and implement a high-performing and scalable DB2 for i solution. You can find more information about this workshop: ibm.com/systems/i/db2/db2performance.html

Page 5: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

DB2 S The DB2installed,databaseand withimanagem

SMP mus2 SMP featur, and activate parallelismin the databament system

st be instre is an optioed—enables

m is based onase manage

m that is integ

talled on of IBM i (s DB2 for i ton technologyement systemgrated within

a.k.a., i5/OSo perform day that is inhem. This is onn the operati

S). This featuatabase opeerent both wine of the adving system.

ure—when perations in paithin the opevantages of

purchased, arallel. The

erating systea database

5

em

Page 6: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

Verify To verify installed Configuraoption 26

y DB2 SMthe presencsoftware byation and Se6 of IBM i (se

MP via Syce of SMP ousing Syste

ervice –> Soee red circle

ystem i Nn an IBM i s

em i Navigatoftware –> Ines in the grap

Navigatosystem or ontor. Drill downstalled Prodphic).

or ne of its logicwn the navigaducts. DB2 S

cal partitionsation bar as Symmetric M

s, display a lfollows:

Multiprocess

6

ist of

ing is

Page 7: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

Verify To verify “Display 26.

y DB2 SMthe DB2 SMinstalled lice

MP via OSMP option froensed progra

S Commaom a commaams”. Page

and Lineand line, typdown throug

e pe GO LICPGgh the IBM i

GM, then seoptions look

lect option 1king for num

7

10 to mber

Page 8: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

IBM i A The archfor datab• The ind

synchparalproce

• DB2 for

disk udisk usingle

• As the d

hardwcan tmain

Architechitecture andbase paralleldependent I/Ohronous andlel operation

essors (IOPs

r i uses storaunits. For exunits for optie disk unit, a

disk units arware supporake full advamemory like

cture d technologyism. StartingO subsystemd asynchronons to accesss) and/or I/O

age managexample, as aimal performand it also pr

re accessed,rts a very larantage of alle cache for d

y of the POWg at the bottom, along withous databas

s data on muO adapters (I

ement to sprea table is popmance. This srovides the b

, the data is rge memory the availabdatabase ob

WER systemom of the diah IBM i storase I/O requesultiple disk unOAs), witho

ead the datapulated, the spreading ofbasis for par

brought intosystem. As le memory.

bjects, or an

running IBMagram… age managests. These rnits simultanut using the

abase objecspace is autf data minimrallel I/O.

o memory. Ta true 64-biThis providein-memory

M i provides

ement, allowrequests canneously via t CPU.

ts across alltomatically a

mizes conten

The design ot system, IB

es the advandatabase.

the foundati

s for n make use othe I/O

l the availaballocated on ntion on any

of the POWEM i and DB2

ntage of usin

8

ion

of

le the

ER 2 for i ng

Page 9: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

9

• IBM i systems have a unique way of addressing storage. It views the disk space on the server and the server's main memory as one large storage area. This way of addressing storage is known as single-level storage. The concept of single-level storage means that the knowledge of the underlying characteristics of hardware devices (in this case, main memory storage, solid state disk storage and spinning disk storage) resides in the System Licensed Internal Code (SLIC). All the storage is automatically managed by the system. No user intervention is needed to take full advantage of any storage technology. Programs work with objects; and objects are accessed by name, not by address.

• POWER™ systems support multiple 64-bit CPUs or cores (currently up to 256). IBM i can take

advantage of multiple CPUs or cores by automatically dispatching work to one or more CPUs or cores.

As the query request is processed, the integrated database takes advantage of the advanced system and operating system technologies to exploit symmetric multiprocessing, and thus achieve database parallelism.

Page 10: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

n-way Within IBthe abilityadvantagindividuaavailablewith eighseven sitThis is w

y Process

BM i, a unit oy to dispatchge of allowinal job, threade, they providht cores avait idle. To util

where DB2 S

sing

of work is defh this work tog more requ

d, or task cande little or nolable, this joize the otheMP comes i

fined as a joo any one ofuests to be pn only run ono help. For eob will only tar cores, addnto play.

ob, thread, of the availabprocessed, an a single CPexample, if oake advantaitional techn

or task. Built ble CPUs or as more CPUPU or core.

one job is exege of one of

niques and s

into the opecores. This

Us are madeIf additionalecuting on af the CPUs wstrategies mu

erating systeconcept has

e available. A CPUs are

a server or Lwhile the othust be applie

10

em is s the Any

LPAR her ed.

Page 11: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

How S The DB2additionaenables dI/O) that result. Ththe procequery cawork load While usparallelistasks or t Given thaarchitect

SMP Wor2 Symmetric al methods adatabase pashare memohis parallel pessors workin be significd across mo

ing SMP doesm is most ethreads.

at SMP is acure, table pa

rks Multiproces

and strategiearallelism onory and diskprocessing ming on a sing

cantly improvore than one

es not requiffective whe

chieved throartitioning is

ssing featurees for retrievn a single sek resources wmeans that thgle query simved with thisprocessor.

re the preseen there is m

ugh the usenot required

e provides thing data andrver or LPARwork simultahe databasemultaneouslys feature on m

ence of moremore than one

e of the POWd for databas

he optimizer d processingR where muaneously towe engine cany. The perfomulti-core sy

e than one Ce physical p

WER server ase parallelis

and databasg data in parltiple proces

ward achievinn have more ormance of aystems by d

CPU or core,processor av

and the IBMm.

se engine wrallel. SMP ssors (CPU ang a single ethan one (o

a CPU-boundistributing th

database vailable to ru

i advanced

11

with

and end or all) d he

n the

Page 12: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

CQE v Databaseor OS throf achievGenerallyunits thatthe numb The row parent jomanages

ersus SQ

e parallelismreads. The Cving paralleliy speaking, t contain theber of physic

selection anob scheduless and merge

QE

m is achievedClassic Quersm. The SQCQE limits t

e data. In concal CPUs or

nd column prs the work anes the results

d through thery Engine (C

QL Query Enthe number ntrast, SQE cores availa

rocessing is nd communis into the bu

e use of sysCQE) databagine (SQE) of tasks (forlimits the nu

able to it.

performed iicates the reffer that is re

stem licensease engine uquery engin

r a given requmber thread

in the respecequests to theturned to th

d internal couses SLIC tane uses OS tquest) to the ds (for a giv

ctive task orhe tasks or thhe applicatio

ode (SLIC) taasks as a methreads. number of d

ven request)

r thread. Thehreads. It alson.

12

asks eans

disk to

e so

Page 13: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

Functi By instalmethods certain dprocessedynamic contrast, SMP. Foreason w Another (sometimdatabasemay be afiles acce With mul

ions Par

ling and enaand strategatabase fea

ed by the DBSQL requesnative, recor example, R

why using SQ

important usmes referred e engine to uan importantessed by tha

tiple indexes

rallel-en

abling the DBies. Howevetures and fu

B2 optimizer st from withinord level accRPG READ QL DML to a

se of SMP isto as “keyed

use all of thet strategy what application

s or keyed lo

abled by

B2 SMP feater, these parunctions. Ge

is eligible—n a high-leve

cess from witor CHAIN o

access data

s to speed upd access pae available rehen an applicn is available

ogical files o

y SMP

ture, the querallel methodnerally spea

—regardless oel language thin high-levperations aris advantage

p the creatioths”). Creatiesources to cation is unae.

over a table o

ery optimizeds and strateaking, any quof programmprogram is e

vel languagere not paralleeous.

on and maintng indexes wspeed up th

available unt

or physical f

r is able to cegies are onuery request

ming interfaceligible to us

e programs isel enabled. T

tenance of Dwith SMP al

he creation ptil an index f

file, index ma

consider parnly available t that is

ce. A static ose SMP. In s not enableThis is one

DB2 indexeslows the

process. Thisfor one of th

aintenance

13

rallel for

or

ed for

s

s e

Page 14: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

14

occurs whenever rows are added, changed, or deleted. Normally, each index is maintained synchronously—that is, one at a time. With SMP enabled, blocked INSERT or WRITE operations can benefit from the fact that the database engine maintains each index in parallel. This is accomplished by using one database task to maintain each index – again trading the use of additional resources for a decrease in time. This has the benefit of reducing the overall index maintenance time and the overall INSERT time. It should be noted, the IBM OmniFind Text Search Server for DB2 for i (5733-OMF) indexes are not affected by DB2 SMP. In other words, the text indexes are not created in parallel nor maintained in parallel via the SMP feature. Within IBM i, DB2 has the ability to import fixed format or stream (CSV) data into a table. This function is known as copy from import file, and is invoked using the command CPYFRMIMPF. This feature is parallel-enabled via SMP. Note that only when copying data from a fixed format file is SMP available. Copying data from a stream file is not done in parallel via the SMP feature. CPYTOIMPF is also not parallel enabled. Within IBM i, DB2 has the ability to physically reorganize the rows within a table. This function is known as reorganize physical file member, and is invoked using the System i Navigator (right click on a table) or the OS command RGZPFM. This feature is parallel-enabled via SMP.

Page 15: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

SQL R While INSmethods that partiscanned Some opbenefit fr If a temp As databwhich staSMP.

equests

SERT, UPDare parallelcular operatand the row

perations, surom SMP.

orary index

base operatioatements, st

and SMP

ATE and DE enabled viation can use

ws tested in p

uch as orderi

is created d

ons are analrategies and

P

ELETE opera DB2 SMP, parallelism parallel.

ing the data

uring the qu

lyzed and tud methods a

ations cannoThis meansand benefit

via a sort, a

uery request,

uned for perfare parallel-e

ot execute ins that if the qfrom SMP.

are not perfo

, the operati

formance, it enabled and

n parallel, mquery is usinIn other wor

ormed in par

on can bene

is importantpotentially b

most query ng a table scrds, the table

rallel and do

efit from SM

t to remembebenefit from

15

can, e is

not

P.

er

Page 16: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

Parall As alreadinstalled the reque The defacan be separameteCURRENmultiple t There areparallelisoccur in that datainto memCPU par

lel Databdy mentioneon the syste

est.

ault setting foet via the syer on the chaNT DEGREEtimes within

e two forms sm allows forparallel. CPU in parallel.

mory, but onlallelism can

base Proed early, the em (or LPAR

or DB2 is to ystem value ange query E. In fact, thea job to togg

of databaser the accessU parallelismFor exampley process ro be used to

ocessinguse of datab

R). However

allow no datQQRYDEGRattributes (Ce CHGQRYAgle parallelis

e parallelismsing of data im allows for e, a table scaows with oneboth access

base paralle, SMP must

tabase paraREE, a quer

CHGQRYA) cA command sm on and o

: I/O parallen parallel, bboth the accan can use pe task. With s the data in

elism requirealso be ena

llelism. The ry option filecommand, oor SET stat

off.

elism and CPbut the procecessing of dparallel I/O tthe SMP feaparallel and

es the SMP fabled for the

parallel proce (QAQQINI)or the SQL stement can b

PU parallelisessing of thaata and the to access anature installed to process

feature to be job process

cessing deg), the DEGRstatement SEbe issued

m. I/O at data does

processing nd bring the ed and enabthe rows in

16

e sing

ree EE ET

not of rows

bled,

Page 17: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

17

parallel, using multiple tasks or threads. Setting the parallel degree allows the query optimizer to consider the use of SMP. The optimizer determines whether or not the query will benefit from parallel methods, and builds the appropriate strategy for using database parallelism within the query plan.

Page 18: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

Degre *NONE –optimizerand will p *IO – Thidoes not SQE con

ee Param

– This is the r cannot useperform para

is value indicrequire the

nsiders I/O p

meter Va

default value any paralleallel I/O rega

cates that thSMP feature

parallelism w

lues

ue system wiel methods, nardless of thi

he CQE optime since the a

with or withou

ide. It stipulaneither CPUis setting.

mizer can usability to useut this setting

ates that DBU nor I/O para

se parallel I/e parallel I/Og.

B2 for i and thallelism. Alth

/O methods O is intrinsica

he query hough, SQE

only. This seally part of IB

18

E can

etting BM i.

Page 19: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

Degre *OPTIMIZmethodsa plan to as a “goo *MAX – T(The useuse all orbetter yerequest. Once thup or doparallel degree odetermin

ee Param

ZE – This va. (The use ouse a good

od neighbor

This value se of parallel Cr a good shat, a way to a

e query optown based odegree detof 4. Specifned at optim

meter Va

alue specifieof parallel CP share of thepolicy.”

tates that thCPU methodare of the coallow a much

timizer has on a percenermined at fying *OPTImization tim

lues

es that the oPU methods e computing

e optimizer ds requires tmputing res

h larger shar

determinedntage. Specoptimizatio

IMIZE 150%me by 150%

ptimizer canrequires the resources,

can use botthe SMP feasources. Thinre of resourc

d the parallcifying *OP

on time by 5% tells DB2

% - a degree

n use both pae SMP featubut not all o

h parallel I/Oature.) The onk of this as ces to be us

lel degree, PTIMIZE 5050% - a deg2 ro increase of 8 beco

arallel I/O anure.) The optof the resour

O and paralleoptimizer will

a “bad neiged for a give

the amoun0% tells DB2gree of 8 be

se the paralmes a degr

nd parallel Ctimizer will bces. Think o

el CPU meth build a plan

ghbor policy.en DB job or

nt can be dia2 to reduceecomes a lel degree ree of 12. T

19

CPU build of this

hods. n to ” Or r

aled e the

This

Page 20: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

20

way the optimizer is still responsible for determining the initial parallel degree value, but the database engineer can adjust the value based on environmental considerations or criteria unknown to the optimizer.

Page 21: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

Degre *SYSVAthe syste *NBRTACPU metbuild a pexperimeenvironmWITH EX

ee Param

L – This valuem value wit

ASKS nn – Tthods The ulan to use thentation andment given thXTREME CA

meter Va

ue is used ohout knowin

This value indse of paralle

he number o testing, and

hat it forces. AUTION.

lues

on the CHGQng what the s

dicates that el CPU methf task or thre

d is not nece(the optimiz

QRYA commsystem value

the optimizehods requireseads requesessarily desigzer to use pa

mand to “resee actually is.

er can use bs the SMP fe

sted. This vagned for usearallelism. AV

et” the job’s .

both parallel feature.) Thealue is used e in a producVOID THIS

query degre

I/O and parae optimizer wfor ction VALUE OR

21

ee to

allel will

USE

Page 22: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

Backg Some daare recogvalue frovalue to sparticula

ground Database requgnized on thm the systemsomething or QDBSRVx

Databaseuests are exee job list by m value QQ

other than thxx job whose

e Server ecuted withithe name “QRYDEGREEe system va

e degree valu

Jobs n the IBM i b

QDBSRVxx.E prior to haalue, use theue you wish

background ” These jobsndling a req

e CHGQRYA to alter.

database ses pick up the

quest. To chaA command

erver jobs, ae parallel deange the degand specify

22

and gree gree the

Page 23: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

Visual To assistthe primaSystem i CQE depthe left inrespectiv

l Explain

t with verifyinary feedbackNavigator -

picts paralleln this screenve icon is se

n Feedba

ng the use ok mechanismDatabase. V

database mn capture), alected.

ack – CQ

of parallel mems is Visual Visual Expla

methods usinnd as textua

E

ethods, querExplain, wh

ain renders t

ng specific ical feedback t

ry plan inforich is part ofhe query pla

cons within tto the right o

mation is prof IBM i Accean as a pictu

the query graof the query

ovided. Oneess for Windoure or graph

aph (shown graph when

23

e of ows - .

on n the

Page 24: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

Visual SQE depused. In time of thparticula

l Explain

picts databasthese areas

he query. Thr method.

n Feedba

se parallelism of the plan,

he parallel ca

ack – SQE

m by using d parallel stra

apabilities of

E

double arrowategies and f SQE are ex

ws – regardlmethods arextensive and

ess of the pae used to ded not just lim

arallel degreecrease the rmited to a

24

ee run

Page 25: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

Textu Another Performadata thatdisplayedCenter wCache S

al Feedb

mechanism ance Monitot indicates thd using eithe

within Systemnapshot and

back

for providingr (aka the de

he use of parer handwrittem i Navigatord choose An

g optimizer ietailed Datarallel methoden queries or. Right click

nalyze.

nformation abase Monitods and strate

or the reportsk on an SQL

and query por). The Monegies within s provided b

L Performanc

lan feedbacnitor capture

a query. Thby the DB2 Pce Monitor o

k is the SQLs and provid

his data can Performanceor SQL Plan

25

L des be

e

Page 26: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

Work When a dwill be ut(WRKSYThere is a given jo“DBL3… Even thothe accocompleteaccurateexecutionperformeback any

Manage

database reqtilized. Those

YSACT). Thisno way to tieob. The SLIC”.

ough the taskunting of the

es the summly displayedn of the que

ed by the tasy metrics to t

ement Fe

quest – quee tasks or ths command e the SLIC tC tasks that

ks or threadse I/O and CP

marized I/O a by the comry, the job’s

sks or threadthe parent jo

eedback

ry, index crehreads can bis part of theasks back tosupport dat

s do much oPU resourcesand CPU resmand work I/O and CPU

ds. In other wob while the

k – WRKS

eation, etc. –be seen usine Performano a given jobabase paral

of the paralles used is tra

sources usedwith active joU resourceswords, the tawork is bein

SYSACT

– uses SMP,ng the work snce Tools licb. The SMP lelism are re

el I/O and CPansferred to d by the taskobs - WRKA

s may not incasks or threang performed

, multiple tassystem activ

cense prograthreads are

epresented w

PU processithe job. Afteks, threads aACTJOB. Duclude the woads will not hd.

sks or threadvity commanam product.

associated with the nam

ng of a querer the work and job will buring the ork being have reporte

26

ds d

with me

ry,

be

ed

Page 27: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

Availa To take awords, thcomponeexampleelse the resource Enablingwork. Thresponseother wo

able and

advantage ohe system orents. Otherw, a robust seprocessors w

es are limited

SMP for a gose multiplee times. Multrds, more w

d Balance

of SMP, the cr LPAR conf

wise, the optiet of CPU reswill be waitind, then the a

given job wile tasks or thrtiple CPUs oork will be a

ed Resou

computing refiguration muimizer will nosources musng for I/O reqmount of pa

ll allow that jreads will coor cores will accomplished

urces

esources muust have a got be able tost be supporquests to be

arallelism wil

job to use monsume moreallow the tasd in the sam

ust be availaood balance

o make the brted with a ro

e fulfilled. Onl also be lim

multiple taskse resources sks or thread

me unit of tim

able and bale of CPU, mbest use of Sobust set of

n the other hmited.

s or threads with the goa

ds to executme.

lanced. In otemory, and

SMP. For I/O resourc

hand, if the C

to perform tal of faster te in parallel

27

her disk

es; CPU

he

l. In

Page 28: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

Allotti Assume simultane Now asssimultane In other walso alloweven moresource For this ravailable

ing Adeq

a given job deously would

ume a giveneously would

words, enabw that job tore resources

es will be ove

reason, whee to handle th

quate Re

demands ond place 10 u

n job demand place 50 u

bling the opti consume ms to be consercommitted

n considerinhe increased

esources

ne unit of resunits of dema

ds five unitsunits of dema

mizer to chomore resourc

umed. If the and the thro

ng the use ofd demand.

s

sources withand on the s

s of resourceand on the s

oose parallelces. Runninge resources aoughput will

f SMP, ensu

hout SMP. Rsystem resou

es with SMPsystem resou

l methods ang multiple jobare not availbe reduced

ure there will

Running 10 ources.

. Running 10urces.

nd strategiesbs with SMPlable, the co

d.

l be enough

of those jobs

0 of those jo

s for the job P may causeomputing

resources

28

s

obs

will e

Page 29: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

Work With SMdifferent.run prioriare work To preveSMP degmemory includingoptimizerconsider possibly The Maxcomman

Manage

P-enabled w Work Manaity and meming on beha

ent the databgree also cois calculated

g the amountr to use a fausing all of more use of

x-active valued or System

ement an

workloads, IBagement is th

mory pool. Wlf of the pare

base engine ntrols the opd. This fair st of parallelisir share of ththe job’s mef SMP.

e for the mem i Navigator

nd SMP

BM i Work Mhe same givork Manageent job.

from consumptimizer. Durhare helps tsm. All of thehe job’s mememory pool, w

mory pool c(Work Mana

Managementven that the tment is diffe

ming all the ring query opto determinee parallel demory pool. Twhich result

an be vieweagement —>

t processes tasks and therent given t

computing rptimization,

e how aggresegree valuesThe value *Mts in a more

ed and chang> Memory P

are the samhreads use ththat the task

resources fothe job’s faissive the qu

s except *MAMAX allows th

aggressive

ged via the WPools).

me, and yet he parent jo

ks and thread

or parallelismr share of

uery plan willAX, cause thhe optimizerquery plan a

WRKSYSST

29

b’s ds

m, the

l be, he r to and

TS

Page 30: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

SMP C There aredatabaseevaluatinattributes SMP matemporarexample processin It is impoany partiresults inrunning ithreads. clause.

Consider

e some appe techniquesng the use ofs.

y be used fory, intermediof this is the

ng, the temp

ortant to remcular order.

n a different on parallel, thTo ensure a

rations: C

lication envis are not allof SMP, it is i

or some partiate results; e creation ofporary index

ember that SAs a matterorder each the rows can a consistent

Conditio

ronments in owed, do notmportant to

ts of the quethese result

f a temporarcan be crea

SQL does nr of fact, the time. One rebe processeordering of t

ons that

which SMPt help, or areunderstand

ery plan and ts may be pry index to su

ated in paral

ot guaranteesame query

eason for thised and returthe query re

restrict

P cannot be ee not availabthe applicat

not for otherocessed witupport the qlel, but acce

e the query y executed ms phenomenrned in any oesults, specif

parallel

employed beble. When cotion environm

rs. If the queth parallel muery. To spe

essed withou

results will bmultiple timesnon is the usorder by the fy the SQL O

lism

ecause paraonsidering oment and

ery plan usemethods. An

eed up the ut parallelism

be returned is may return

se of SMP. Wmultiple tas

ORDER BY

30

allel or

es

m.

in n the When sks or

Page 31: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

SMP Cresou When cobenefit frdatabasesmall sethand, if aquery miparallel. If the querun in pamagical o

Considerrces

onsidering throm SMP ane techniquest of rows via a query requght benefit f

ery request irallel can incor free—it is

rations: A

e use and bd others ma

s while otheran index, th

uest is accesfrom SMP by

s expected tcrease the r

s the result o

Applicat

benefits of SMay not. Similars may not. Fhen that partssing a majoy allowing th

to access anesponse tim

of using more

tion envi

MP, remembarly, some eFor exampleticular query

ority of the rohe optimizer

nd process mme of the quee resources

ironmen

ber that somenvironmentse, if a query ry will not benows via a tabto use SMP

many rows, ery. This incrto do work i

nts, com

me query reqs can supporequest is ac

nefit from SMble scan, the

P to run the ta

then allowinrease in resin parallel.

puting

quests may ort parallel ccessing a v

MP. On the oen that particable scan in

ng the requeponse time i

31

very other cular n

st to is not

Page 32: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

32

The additional resources must be available during query optimization and query execution. The optimizer uses the static resources that are in place at the time of query optimization. These resources are: the number and type of CPUs or cores as well as their relative power, memory pool size, and number of disk units that contain the database objects being accessed. If the resources are not balanced or not sufficient to support SMP, then the optimizer will not use parallel methods and strategies. When a parallel query plan is executed, this plan will adhere to the rules of work management. The parallel tasks or threads running on behalf of the job will compete for resources just like any other job. If there are not sufficient resources available to support the increase in workload, then the resources will become saturated and the overall throughput may decrease. If no other jobs are competing for resources, then the parallel query plan will be free to use all the available resources and gain the benefits of SMP – namely increased throughput and response time. The best practice to understand the benefits of using SMP is to study the particular workload and environment, or run a benchmark / proof of concept. Short of that, some general guidelines can be used to assess whether or not SMP may be beneficial. A candidate SMP environment should have more than one physical (dedicated) CPU or at least 2 cores, 16 gigabytes of memory per CPU or core (POWER6 and above), and a properly sized and configured I/O subsystem. The CPU utilization should be below 60% for the interval of time when SMP will be considered. For example, assuming an SQL query workload, a nightly batch environment has four cores available and the average (total) CPU utilization is 25% during the nightly processing. To make use of the remaining CPU resources, SMP can be enabled to allow parallel database processing. On the other hand, the daily transaction environment has an average (total) CPU utilization of 85% during the daily processing. During this time interval, the extra computing resources are not available and using SMP will not increase the throughput.

Page 33: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

SMP C When us*OPTIMImemory This will For jobs *MAX. *Mthe datab Setting thintuitive aasynchro

Consider

sing or experZE and anapool to a nuallow the op

that are runMAX will allobase engine

he memory pand more agonous I/O.

rations: F

rimenting witlyze the quember that re

ptimizer to de

ning alone inow the optim use more C

pool’s paginggressive wit

First tim

th SMP for tery plan and epresents thetermine a re

n a memory izer to cons

CPU resourc

g option to *th I/O reque

me tips

the first timerun time. See true numbealistic fair s

pool, start bider using al

ces.

*CALC will asts. The val

e, start with tet the MAX Aber of concurshare of the

by using *OPll the memor

allow the datue of *CALC

he parallel dACTIVE valurrent, active memory poo

PTIMIZE, anry in the poo

tabase enginC allows mor

degree set toue for the jobs or thre

ol for the job

nd then moveol, but will als

ne to be morre parallel,

33

o

eads. bs.

e to so let

re

Page 34: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

34

Based on the application’s behavior and SQL interface, the optimizer can use an optimization goal of First I/O or All I/O. The First I/O optimization goal tends to avoid parallel methods and strategies given that these plans are built to deliver the first n rows of the result set as fast as possible, and a faster query startup time is required. The All I/O optimization goal tends to allow parallel methods and strategies, given that (1) these plans are built to deliver the entire result set as fast as possible, and (2) a slower query startup time is acceptable. Using parallel methods and strategies may require some additional initialization time during query startup in favor of a faster overall query run time.

Page 35: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

Conclu To receivfeature m(5722-DV Db2 Symexcellentsystem rufor i, andavailable

usion

ve the benefmust be instaVP) or can b

mmetric Multt way in whicunning IBM is an exam

e today.

fits of parallealled and enbe ordered s

iprocessing ch to take adi. This featuple of the ou

el database abled. This feparately.

provides higdvantage of re relies on

utstanding va

processing, feature is inc

gh performanall the availathe integratealue provide

the DB2 Sycluded in the

nce databasable resourced technologed by one of

ymmetric Mue DB2 Value

se processinces within thgies found inthe best bus

ltiprocessinge Pack for i

ng and in ande POWER n IBM i and siness syste

35

g

d

DB2 ems

Page 36: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

36

Links More information regarding DB2 for i and the data-centric technologies within IBM i can be found at the following Web sites: DB2 for i home page: ibm.com/systems/i/software/db2/ IBM DeveloperWorks article: Access your DB2 for iSeries Indexes in Parallel, by Kent

Milligan ibm.com/developerworks/db2/library/techarticle/0301milligan/0301milligan.html White paper: IBM DB2 for i indexing methods and strategies, by Mike Cain and Kent

Millgan ibm.com/partnerworld/wps/servlet/ContentHandler/stg_ast_sys_wp_db2_i_indexing_metho

ds_strategies For additional assistance with getting the most out of DB2 for i, send an e-mail to Mike Cain at: [email protected]

Page 37: Introduction to DB2 Symmetric Multiprocessing for IBM i · Next, you will learn some usage details on how to turn SMP on and off, and how to manage the ... knowledge of the underlying

37

Trademarks and Special Notices © Copyright IBM Corporation 2011. All rights Reserved. References in this document to IBM products or services do not imply that IBM intends to make them available in every country. IBM, the IBM logo, and ibm.com are trademarks or registered trademarks of International Business Machines Corporation in the United States, other countries, or both. If these and other IBM trademarked terms are marked on their first occurrence in this information with a trademark symbol (® or ™), these symbols indicate U.S. registered or common law trademarks owned by IBM at the time this information was published. Such trademarks may also be registered or common law trademarks in other countries. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml. Java and all Java-based trademarks and logos are trademarks or registered trademarks of Oracle and/or its affiliates. Microsoft, Windows, Windows NT, and the Windows logo are trademarks of Microsoft Corporation in the United States, other countries, or both. Intel, Intel Inside (logos), MMX, and Pentium are trademarks of Intel Corporation in the United States, other countries, or both. UNIX is a registered trademark of The Open Group in the United States and other countries. Linux is a trademark of Linus Torvalds in the United States, other countries, or both. SET and the SET Logo are trademarks owned by SET Secure Electronic Transaction LLC. Other company, product, or service names may be trademarks or service marks of others. Information is provided "AS IS" without warranty of any kind.