Translation

The oldest posts, are written in Italian. If you are interested and you want read the post in English, please use Google Translator. You can find it on the right side. If the translation is wrong, please email me: I'll try to translate for you.
Visualizzazione post con etichetta DB Time. Mostra tutti i post
Visualizzazione post con etichetta DB Time. Mostra tutti i post

mercoledì, marzo 16, 2016

DB Time (2 of 3) (ENG)

Here the Italian version

DB Time (1 of 3)
DB Time (3 of 3) (soon)

DB Time = CPU Time + Wait Time

is the equation that ties the main components of the database:
- work time
- wait time

You can rewrite this equation as (you divide by DB Time and multiply by 100)

100 = (CPU Time/DB Time)*100 + (Wait Time/DB time)*100

This is the way the "AWR" shows us the "Top Timed Events". Let's see. The example that follows, is taken from one of the last tuning I made on a version of Oracle 10g


  • AWR Report - 10.2.0.5 Version

 

  

 

DB Time = 440 mins = 26400 secs

log file switch (checkpoint incoplete) 11908 / 26400 => 0,45106 => 45,1%
gc buffer busy 5376 / 26400 => 0,20363636 => 20,4
PX Deq Credit: send blkd 1537 / 26400 => 0,058219696 => 5,8%
buffer busy waits 1358 / 26400 => 0,0514393939 => 5,1%

In later versions, the name of the column containing the percentage (second from right) "% DB Time"
 
  • AWR Report - 11.2.0.4 Version

     

  




DB Time = 498 mins = 29880 secs

db file sequential read 2736 / 29880 => 0,09156 => 9,15%
db file scattered read 1753 / 29880 => 0,05866 => 5,86%
log file sync 1500 / 29880 => 0,05020 => 5,02%
row cache lock 1096 / 29880 => 0,03668 => 3,67%

  • AWR Report - 12.1.0.2 Version


 

 

DB Time = 21 mins = 1260 secs

db file sequential read 57,5 / 1260 => 0,04563 => 4,56%
rdbms ipc reply 50,7 / 1270 => 0,04023 => 4,02%
DFS lock handle 18,2 / 1270 => 0,01433 => 1,43%
log file sync 13,6 / 1270 => 0,01070 => 1,07%

DB Time (1 of 3) DB Time (2 of 3) (soon)

lunedì, marzo 14, 2016

DB Time (1 di 3) (ENG)

Here the Italian version

DB Time (2 of 3)
DB Time (3 of 3) (soon)


When you fight with tuning, you always have to deal with time. The end user, perceives all problems in term of response time. Time is the link from user experience with database performance.

In Oracle 10g, was introduced the “Intelligent Infrastructure”.

The goal of this infrastructure is:
- self-monitor
- self-diagnostic
- self-tuning

This was in 2004.

In this post and the next, I'm going to talk about 2 tools the Oracle “Intelligent Infrastructure” give us:
- DB Time
- ASH

DB Time

It is defined as the “amount of time spent within the database in processing an user request”.

It unit of measure is microseconds and you can get it directly from Data Dictionary. The views are:
- V$SYS_TIME_MODEL
- V$SESS_TIME_MODEL

When a process can't consume CPU, it have to wait in order to use CPU again. We know this wait as "wait event". In other words when a process can't use a CPU, it alert you that it need to wait and the reason of wait is the "wait event".

The important thing is that not always the waits impact the performance. If not, then we consider this waits as "Idle". Instead, if the wait have performance impact, then we consider the wait
 as “Non-Idle”.

So, an active process (that is, it's working) or consume CPU or wait on an Non-idle wait event.

You can write all of this, through a mathematical expression:

DB Time = CPU Time + Non-Idle Wait Time

We consider “Non-Idle” as obvious, so we rewrite the expression as:

DB Time = CPU Time + Wait Time

Really,  the right relation is:

DB Time = CPU Time + Wait Time + gap

This is because when the CPUs are too much active, then the “CPU Queue Time” grows, that is, grows the wait time of processes before they use a CPU again. Oracle calls this specific wait as “CPU Wait Time”. Obviously this is not happy name for a wait event.

You can find more details about "gap", using the below links (see references). In any case, here we are interested to the more usual expression:

DB Time = CPU Time + Wait Time

Reference


mercoledì, febbraio 17, 2016

DB Time (3 di 3) (ITA)

DB Time (1 di 3)
DB Time (2 di 3)

Il “database time” è il tempo totale speso dall’utente o a lavorare “attivamente” oppure ad aspettare “attivamente” in una “database call” (una “db call” è una funzione C nel kernel di Oracle. Se abilitiamo il “training” di una sessione, osserviamo che il kernel stampa una stringa nel file di output, al completamento della “database call”. Le più comuni sono PARSE, EXEC e FETCH).

- Relazione tra “System Load” e “DB Time”
Più utenti => Più “DB call” => il “DB time” aumenta Grandi transazioni => “DB call” più lunghe => il “DB time” aumentA
 -> Il DB time aumenta, all’aumentare del carico di lavoro del sistema

- Relazione tra le performance di un sistema ed il "DB Time"
Le prestazioni di I/O degradano => il tempo di I/O aumenta => il DB time aumenta Le prestazioni applicative degradano => il Wait time aumenta => il DB time aumenta
-> Il DB time aumenta quando le prestazioni.

- Relazione tra le prestazioni di una macchina ed il “DB Time”
Se le CPU della macchina sono eccessivamente attive => i processi foregrounds accumulano “tempo attivo” in run-queue => i tempi di attesa so artificialmente gonfiati => il DB time aumenta
-> Il db Time aumenta quando il le CPU fanno un eccessivo lavoro

Migliorare le prestazioni vuol dire fare lo stesso lavoro in meno “DB Time”, vuol dire cioè rimuovere l’ecceo di “DB Tme”.

Il “Database time” è semplicemente una misura de lavoro fatto dal database. Volendo fare un’analogia, possiamo dire che è l’equivalente dell’unita di misura “Joule” usata in Fisica nel Sistema Internazionale, per misurare l’energia (lavoro fatto da un sistema).

La velocità con cui il “Database Time” è consumato, è il “load average” del database analogo a quello del Sistema Operativo. L’unità di misura di tale velocità, ‘Database Time’/sec, è analoga al “Watt” o a “Joule/sec” nel SI, per misurare la potenza. Poiché l’obiettivo è quello di ridurre la quantità di tempo speso per un certo workload, questo è analogo al consumare meno energia per eseguire lo stesso compito.

  • Update (16/Mar/2016)
Ho aggiunto nuovi documenti come riferimento

Riferimenti

DB Time (2 di 3)

DB Time (2 di 3) (ITA)

DB Time (1 di 3)
DB Time (3 di 3)

DB Time = CPU Time + Wait Time

è l’equazione che lega le principali componenti nel database:
- tempo di lavoro
- tempo di attesa

La stessa equazione possiamo anche riscriverla come (dividendo per DB Time e moltiplicando per 100)

100 = (CPU Time/DB Time)*100 + (Wait Time/DB time)*100

che è il modo in cui AWR ci presenta i Top Timed Events. Vediamo. Il seguente esempio è preso da un recente tuning che ho fatto proprio su una vecchia versione 10g.

Report AWR - Versione 10.2.0.5

 

 



 

DB Time = 440 mins = 26400 secs

Nelle versioni successive, la colonna contenente la percentuale (la seconda da destra) prende esplicitamente il nome di “%DB Time”

log file switch (checkpoint incoplete) 11908 / 26400 => 0,45106 => 45,1%
gc buffer busy 5376 / 26400 => 0,20363636 => 20,4
PX Deq Credit: send blkd 1537 / 26400 => 0,058219696 => 5,8%
buffer busy waits 1358 / 26400 => 0,0514393939 => 5,1%

Nelle versioni successive, la colonna contenente la percentuale (la seconda da destra) prende esplicitamente il nome di “%DB Time

Report AWR - Versione 11.2.0.4



 



DB Time = 498 mins = 29880 secs

db file sequential read 2736 / 29880 => 0,09156 => 9,15%
db file scattered read 1753 / 29880 => 0,05866 => 5,86%
log file sync 1500 / 29880 => 0,05020 => 5,02%
row cache lock 1096 / 29880 => 0,03668 => 3,67%

Report AWR - Versione 12.1.0.2


 

 

DB Time = 21 mins = 1260 secs

db file sequential read 57,5 / 1260 => 0,04563 => 4,56%
rdbms ipc reply 50,7 / 1270 => 0,04023 => 4,02%
DFS lock handle 18,2 / 1270 => 0,01433 => 1,43%
log file sync 13,6 / 1270 => 0,01070 => 1,07%

DB Time (1 di 3) DB Time (3 di 3)

venerdì, febbraio 12, 2016

DB Time (1 di 3) (ITA)

Qui la versione Inglese

DB Time (2 di 3)
DB Time (3 di 3)

Quando abbiamo a che fare con il “tuning“ dobbiamo sempre fare i conti con il tempo. L’utilizzatore finale di un database percepisce ogni tipo di problema sotto forma di tempo di risposta. Il tempo è ciò che mette in relazione l'esperienza utente con le prestazioni del database.

Nella ormai datata versione 10g, Oracle introdusse ciò chiamò “Intelligent Infrastructure”. Lo scopo di tale infrastruttura è triplice:
- self-monitor
- self-diagnostic
- self-tuning

Questo avveniva nel 2004.

In questo documento è nei prossimi, parleremo di 2 strumenti che abbiamo a disposizione
- DB Time
- ASH

DB Time

È definito come la “somma del tempo speso all’interno del database nel processare una richiesta utente”.

È una grandezza misurata in microsecondi e la possiamo ottenere interrogando il dizionario dati. Le viste che espongono le informazioni sono:
- V$SYS_TIME_MODEL
- V$SESS_TIME_MODEL

Quando un processo non può consumare CPU, è costretto ad aspettare per poterla nuovamente impegnarla. Noi conosciamo questa attesa, come “wait event”. Detto in altre parole, quanto un processo non può utilizzare una CPU, ci avvisa dicendo che aspetterà ed il motivo dell’attesa è proprio il “wait event”.

Ma non sempre le attese hanno un impatto sulle prestazioni. In tal caso diciamo che gli eventi di attesa sono di tipo “Idle”. Quando invece l’evento di attesa influenza la risposta di uno statement diciamo che è di tipo “Non-Idle”.

Un processo attivo (che lavora) quindi o consuma CPU, oppure aspetta su un evento di tipo Non-Idle.

Tutto questo può essere espresso attraverso un’espressione matematica, nel seguente modo:

DB Time = CPU Time + Non Idle Wait Time

Quasi sempre il “Non-Idle” è sottinteso, così l’espressione diventa

DB Time = CPU Time + Wait Time

Volendo essere precisi, la relazione corretta è 

DB Time = CPU Time + Wait Time + gap

Il motivo è che quando le CPU di un sistema sono molto impegnate, aumenta il “CPU Queue Time”, ovvero il tempo di attesa che i processi impiegano prima di utilizzare una CPU. Oracle chiama questa particolare attesa,  “CPU Wait Time”, che ovviamente è una scelta piuttosto infelice come nome.

Maggiori dettagli su questa particolare tematica sono ottenibili nei link presenti nei riferimenti sotto indicati. In ogni caso, in questo articolo, siamo interessati al caso più comune:

DB Time = CPU Time + Wait Time

Riferimenti