+ All Categories
Home > Documents > Tuningbasedon Wall ClockTime insteadof ElapsedTime · PDF fileTuningbasedon Wall ClockTime...

Tuningbasedon Wall ClockTime insteadof ElapsedTime · PDF fileTuningbasedon Wall ClockTime...

Date post: 07-Mar-2018
Category:
Upload: vomien
View: 213 times
Download: 1 times
Share this document with a friend
25
Tuning based on Wall Clock Time instead of Elapsed Time Wall Clock Time Tuning in Databases Gerwin Hendriksen Principal Consultant [email protected] Version 2.0 13 June 2017 © 2016 Gerwin Hendriksen
Transcript
Page 1: Tuningbasedon Wall ClockTime insteadof ElapsedTime · PDF fileTuningbasedon Wall ClockTime insteadof ElapsedTime ...  ... See the Excel: WCT Calculated:

Tuning based on Wall Clock Time instead of Elapsed Time

Wall Clock Time Tuning in Databases

Gerwin Hendriksen

Principal Consultant

[email protected]

Version 2.0

13 June 2017

© 2016 Gerwin Hendriksen

Page 2: Tuningbasedon Wall ClockTime insteadof ElapsedTime · PDF fileTuningbasedon Wall ClockTime insteadof ElapsedTime ...  ... See the Excel: WCT Calculated:

Agenda:

© 2016 Gerwin Hendriksen

• Tuning with AWR:

• What about parallel?

• What about WCT?

• How to get WCT data?

• What can we do more?

• Q/A

Page 3: Tuningbasedon Wall ClockTime insteadof ElapsedTime · PDF fileTuningbasedon Wall ClockTime insteadof ElapsedTime ...  ... See the Excel: WCT Calculated:

What about Parallel…

© 2016 Gerwin Hendriksen

Page 4: Tuningbasedon Wall ClockTime insteadof ElapsedTime · PDF fileTuningbasedon Wall ClockTime insteadof ElapsedTime ...  ... See the Excel: WCT Calculated:

Tuning with AWR…

© 2016 Gerwin Hendriksen

The normal way of database performance tuning is the

usage of AWR data.

Problems occur with this way of tuning when introducing

parallel.

So lets first checkout an AWR report…

Page 5: Tuningbasedon Wall ClockTime insteadof ElapsedTime · PDF fileTuningbasedon Wall ClockTime insteadof ElapsedTime ...  ... See the Excel: WCT Calculated:

AWR Reports…

© 2016 Gerwin Hendriksen

• AWR Snapshot: 166-167

• AWR Snapshot: 167-168

• AWR Snapshot: 168-169

• AWR Snapshot: 169-170

• AWR Snapshot: 170-171

Page 6: Tuningbasedon Wall ClockTime insteadof ElapsedTime · PDF fileTuningbasedon Wall ClockTime insteadof ElapsedTime ...  ... See the Excel: WCT Calculated:

So lets see the details:

© 2016 Gerwin Hendriksen

…and what is different for the different statements…

1248

163264128

Page 7: Tuningbasedon Wall ClockTime insteadof ElapsedTime · PDF fileTuningbasedon Wall ClockTime insteadof ElapsedTime ...  ... See the Excel: WCT Calculated:

Yes! We did some tuning…

© 2016 Gerwin Hendriksen

Based on AWR we did some tuning, we saw that the

system had still some resources available, so increasing

parallel processes looked to be very smart…

BUT…. IS IT REALLY SMART???

Page 8: Tuningbasedon Wall ClockTime insteadof ElapsedTime · PDF fileTuningbasedon Wall ClockTime insteadof ElapsedTime ...  ... See the Excel: WCT Calculated:

So what about the End-User?

© 2016 Gerwin Hendriksen

• AWR doesn’t give us

the information!!

• Oracle made SQL-

Monitoring…

Lets checkout

Oracle SQL-Monitoring…

Page 9: Tuningbasedon Wall ClockTime insteadof ElapsedTime · PDF fileTuningbasedon Wall ClockTime insteadof ElapsedTime ...  ... See the Excel: WCT Calculated:

Wall Clock Time YEAH !!!

© 2016 Gerwin Hendriksen

• P1-ccacskfsnz2y4_10041456

• P2-5tm2zdkuyb3vk_10041458

• P4-8qzbnban8mdsm_10041535

• P8-dv0jap9p5vfr5_10041506

• P16-gmfh78v3n2f55_10041509

• P32-b23ua8kyvnq5d_10041515

• P64-8dn43389f4qvk_10041523

• P128-cc05cd0hz4brx_10041528

Page 10: Tuningbasedon Wall ClockTime insteadof ElapsedTime · PDF fileTuningbasedon Wall ClockTime insteadof ElapsedTime ...  ... See the Excel: WCT Calculated:

Questions Rising…

© 2016 Gerwin Hendriksen

• How can we checkout a change in performance from an

end-user perspective when changing the number of

parallel threads used for a query?

• The same thing applies for checking out overall database

performance from an end-user perspective. What did the

change do for the end-user performance?

Page 11: Tuningbasedon Wall ClockTime insteadof ElapsedTime · PDF fileTuningbasedon Wall ClockTime insteadof ElapsedTime ...  ... See the Excel: WCT Calculated:

The data for SQL-Monitoring comes from the columns:

• tm_delta_time

• tm_delta_cpu_time

• tm_delta_db_time

• delta_time

Data for SQL-Monitoring:

© 2016 Gerwin Hendriksen

Out of views:

• ASH: v$active_session_history

• AWR: dba_hist_active_sess_history

Blog Dominic Brooks !

Page 12: Tuningbasedon Wall ClockTime insteadof ElapsedTime · PDF fileTuningbasedon Wall ClockTime insteadof ElapsedTime ...  ... See the Excel: WCT Calculated:

Active Session History…

© 2016 Gerwin Hendriksen

Page 13: Tuningbasedon Wall ClockTime insteadof ElapsedTime · PDF fileTuningbasedon Wall ClockTime insteadof ElapsedTime ...  ... See the Excel: WCT Calculated:

AWR and ASH:

© 2016 Gerwin Hendriksen

Page 14: Tuningbasedon Wall ClockTime insteadof ElapsedTime · PDF fileTuningbasedon Wall ClockTime insteadof ElapsedTime ...  ... See the Excel: WCT Calculated:

WCT vs Elapsed Time…

© 2016 Gerwin Hendriksen

Session

Session

Parallel 1

Parallel 2

Parallel 3

Parallel 4

WCT for Non Parallel = Elapsed Time

WCT for Parallel WCT Improvement

Elapsed Time in Parallel = Sum of all used system time of involved threads

THREADS

Page 15: Tuningbasedon Wall ClockTime insteadof ElapsedTime · PDF fileTuningbasedon Wall ClockTime insteadof ElapsedTime ...  ... See the Excel: WCT Calculated:

How to get Wall Clock Time…

© 2016 Gerwin Hendriksen

• ASH samples every second. If we find an entry for a

session in ASH, we can say that it was running for one

second.

• AWR takes one out of ten ASH samples. If we find an

entry for session in AWR, we can say that it was running

for 10 seconds.

• In both above claims is some error, but with lots of

samples and longer running queries it works fine!!

Page 16: Tuningbasedon Wall ClockTime insteadof ElapsedTime · PDF fileTuningbasedon Wall ClockTime insteadof ElapsedTime ...  ... See the Excel: WCT Calculated:

Next to get Wall Clock Time…

© 2016 Gerwin Hendriksen

Parallel Server processes run under different sessions, but

have the same coordinator process (qc_session_id) and so

can be counted as elapse time for one and the same query.

Lets Dive into ASH and AWR…

DEMO TIME!!!

Page 17: Tuningbasedon Wall ClockTime insteadof ElapsedTime · PDF fileTuningbasedon Wall ClockTime insteadof ElapsedTime ...  ... See the Excel: WCT Calculated:

Calculate Wall Clock Time…1

© 2016 Gerwin Hendriksen

Specific statement in ASH (v$active_session_history):

WCT in seconds =

<ASH Samples containing one of related sessions>

x 1 second

ELA (DB-Time) in seconds =

<ASH Sampl. sum of occurrence of each related session>

x 1 second

Page 18: Tuningbasedon Wall ClockTime insteadof ElapsedTime · PDF fileTuningbasedon Wall ClockTime insteadof ElapsedTime ...  ... See the Excel: WCT Calculated:

Calculate Wall Clock Time…2

© 2016 Gerwin Hendriksen

Specific stat. in AWR (dba_hist_active_sess_history):

Cumalative WCT in seconds =

<AWR Samples contain at least one of related sessions>

x 10 seconds

Cumalative ELA (DB-Time) in seconds =

<AWR Sampl. sum of occurrence of each related session>

x 10 seconds

Page 19: Tuningbasedon Wall ClockTime insteadof ElapsedTime · PDF fileTuningbasedon Wall ClockTime insteadof ElapsedTime ...  ... See the Excel: WCT Calculated:

Calculate Wall Clock Time…3

© 2016 Gerwin Hendriksen

For one execution in AWR (dba_hist_sqlstat):

Estimation Parallel =

Cum. ELA / Cum. WCT

Estimation WCT per exection =

ELA from AWR Report / Est. Parallel / Number of Exec

Page 20: Tuningbasedon Wall ClockTime insteadof ElapsedTime · PDF fileTuningbasedon Wall ClockTime insteadof ElapsedTime ...  ... See the Excel: WCT Calculated:

© 2016 Gerwin Hendriksen

Page 21: Tuningbasedon Wall ClockTime insteadof ElapsedTime · PDF fileTuningbasedon Wall ClockTime insteadof ElapsedTime ...  ... See the Excel: WCT Calculated:

Data gathered…

© 2016 Gerwin Hendriksen

See the Excel:

Page 22: Tuningbasedon Wall ClockTime insteadof ElapsedTime · PDF fileTuningbasedon Wall ClockTime insteadof ElapsedTime ...  ... See the Excel: WCT Calculated:

WCT Calculated:

© 2016 Gerwin Hendriksen

Page 23: Tuningbasedon Wall ClockTime insteadof ElapsedTime · PDF fileTuningbasedon Wall ClockTime insteadof ElapsedTime ...  ... See the Excel: WCT Calculated:

WCT SQL Monitoring:

© 2016 Gerwin Hendriksen

Page 24: Tuningbasedon Wall ClockTime insteadof ElapsedTime · PDF fileTuningbasedon Wall ClockTime insteadof ElapsedTime ...  ... See the Excel: WCT Calculated:

Conclusion…

© 2016 Gerwin Hendriksen

• ASH and AWR can be used to calculate Wall Clock Time

for statements running more than 30 seconds quite

reliable.

• So extra data should be gathered from AWR to be able to

make good tuning decissions when parallel is used. In

EXADATA systems this is really important.

Page 25: Tuningbasedon Wall ClockTime insteadof ElapsedTime · PDF fileTuningbasedon Wall ClockTime insteadof ElapsedTime ...  ... See the Excel: WCT Calculated:

Gerwin [email protected]

© 2016 Gerwin Hendriksen


Recommended