[20190417]隱含引數_SPIN_COUNT.txt
[20190417]隱含引數_SPIN_COUNT.txt
--//在探究latch spin計數之前,先簡單探究_SPIN_COUNT.實際上oracle現在版本latch spin的數量不再是2000,而是記錄在
--//x$ksllclass裡面.透過例子說明:
1.環境:
SYS@book> @ ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
SYS@book> select * from x$ksllclass ;
ADDR INDX INST_ID SPIN YIELD WAITTIME SLEEP0 SLEEP1 SLEEP2 SLEEP3 SLEEP4 SLEEP5 SLEEP6 SLEEP7
---------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
00000000861986C0 0 1 20000 0 1 8000 8000 8000 8000 8000 8000 8000 8000
00000000861986EC 1 1 20000 0 1 1000 1000 1000 1000 1000 1000 1000 1000
0000000086198718 2 1 20000 0 1 8000 8000 8000 8000 8000 8000 8000 8000
0000000086198744 3 1 20000 0 1 1000 1000 1000 1000 1000 1000 1000 1000
0000000086198770 4 1 20000 0 1 8000 8000 8000 8000 8000 8000 8000 8000
000000008619879C 5 1 20000 0 1 8000 8000 8000 8000 8000 8000 8000 8000
00000000861987C8 6 1 20000 0 1 8000 8000 8000 8000 8000 8000 8000 8000
00000000861987F4 7 1 20000 0 1 8000 8000 8000 8000 8000 8000 8000 8000
8 rows selected.
SYS@book> select CLASS_KSLLT,count(*) from x$kslltr group by CLASS_KSLLT;
CLASS_KSLLT COUNT(*)
----------- ----------
2 1
0 581
SYS@book> select CLASS_KSLLT,decode(CLASS_KSLLT,2,KSLLTNAM) name,count(*) from x$kslltr group by CLASS_KSLLT,decode(CLASS_KSLLT,2,KSLLTNAM);
CLASS_KSLLT NAME COUNT(*)
----------- ------------------ --------
0 581
2 process allocation 1
--//還可以看出僅僅1個latch屬於2類(latch name='process allocation').其它都是0類.實際上即使是0類,後面的SLEEP0-7不再使用.
--//可以發現預設全部SPIN=20000.
2.測試1:
SYS@book> alter system set "_spin_count"=200 scope=memory;
System altered.
--//實際上動態修改無效.重新登入會話:
SYS@book> select * from x$ksllclass ;
ADDR INDX INST_ID SPIN YIELD WAITTIME SLEEP0 SLEEP1 SLEEP2 SLEEP3 SLEEP4 SLEEP5 SLEEP6 SLEEP7
---------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
00000000861986C0 0 1 20000 0 1 8000 8000 8000 8000 8000 8000 8000 8000
00000000861986EC 1 1 20000 0 1 1000 1000 1000 1000 1000 1000 1000 1000
0000000086198718 2 1 20000 0 1 8000 8000 8000 8000 8000 8000 8000 8000
0000000086198744 3 1 20000 0 1 1000 1000 1000 1000 1000 1000 1000 1000
0000000086198770 4 1 20000 0 1 8000 8000 8000 8000 8000 8000 8000 8000
000000008619879C 5 1 20000 0 1 8000 8000 8000 8000 8000 8000 8000 8000
00000000861987C8 6 1 20000 0 1 8000 8000 8000 8000 8000 8000 8000 8000
00000000861987F4 7 1 20000 0 1 8000 8000 8000 8000 8000 8000 8000 8000
8 rows selected.
--//SPIN數量不變.實際上動態修改,對應exclusive latch無效.僅僅對shared latch有效,導致實際spin 數量等於_spin_count*2.(我當前沒有測試)
--//參考連結:
3.測試2:
SYS@book> alter system set "_spin_count"=200 scope=spfile ;
System altered.
--//重啟資料庫觀察:
SYS@book> select * from x$ksllclass ;
ADDR INDX INST_ID SPIN YIELD WAITTIME SLEEP0 SLEEP1 SLEEP2 SLEEP3 SLEEP4 SLEEP5 SLEEP6 SLEEP7
---------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
00000000861986C0 0 1 200 0 1 8000 8000 8000 8000 8000 8000 8000 8000
00000000861986EC 1 1 200 0 1 1000 1000 1000 1000 1000 1000 1000 1000
0000000086198718 2 1 200 0 1 8000 8000 8000 8000 8000 8000 8000 8000
0000000086198744 3 1 200 0 1 1000 1000 1000 1000 1000 1000 1000 1000
0000000086198770 4 1 200 0 1 8000 8000 8000 8000 8000 8000 8000 8000
000000008619879C 5 1 200 0 1 8000 8000 8000 8000 8000 8000 8000 8000
00000000861987C8 6 1 200 0 1 8000 8000 8000 8000 8000 8000 8000 8000
00000000861987F4 7 1 200 0 1 8000 8000 8000 8000 8000 8000 8000 8000
8 rows selected.
--//這樣更改才生效.
SYS@book> alter system reset "_spin_count";
System altered.
--//實際上可以但是設定_latch_class_N引數.
SYS@book> alter system set "_latch_class_0"=1000 scope=spfile;
System altered.
--//重啟資料庫觀察:
SYS@book> select * from x$ksllclass ;
ADDR INDX INST_ID SPIN YIELD WAITTIME SLEEP0 SLEEP1 SLEEP2 SLEEP3 SLEEP4 SLEEP5 SLEEP6 SLEEP7
---------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
00000000861986C0 0 1 1000 0 1 8000 8000 8000 8000 8000 8000 8000 8000
00000000861986EC 1 1 20000 0 1 1000 1000 1000 1000 1000 1000 1000 1000
0000000086198718 2 1 20000 0 1 8000 8000 8000 8000 8000 8000 8000 8000
0000000086198744 3 1 20000 0 1 1000 1000 1000 1000 1000 1000 1000 1000
0000000086198770 4 1 20000 0 1 8000 8000 8000 8000 8000 8000 8000 8000
000000008619879C 5 1 20000 0 1 8000 8000 8000 8000 8000 8000 8000 8000
00000000861987C8 6 1 20000 0 1 8000 8000 8000 8000 8000 8000 8000 8000
00000000861987F4 7 1 20000 0 1 8000 8000 8000 8000 8000 8000 8000 8000
8 rows selected.
--//你甚至指定特定的latch採用特定的類.還可以修改後面的YIELD,WAITTIME,SLEEP0-SELLP7值.例子:
*._latch_classes='8:3'
*._latch_class_3='100 0 1 10000 20000 30000 40000 50000 60000 70000 80000'
SYS@book> select * from v$latchname where name='process allocation';
LATCH# NAME HASH
---------- ---------------------------------------- ----------
8 process allocation 2600548697
--//_latch_classes 裡面8 值LATCH#,後面3值類.可以指定多個,例子:
--//alter system set "_latch_classes"='46:3 103:3' scope=spfile;
--//還原:
SYS@book> alter system reset "_latch_class_0";
System altered.
4.加強記憶我找一個latch測試看看:
--//上午測試是process allocation,現在測試看看類0的修改是否有效.
select addr,name,level#,latch#,gets,misses,sleeps,immediate_gets,immediate_misses,waiters_woken,waits_holding_latch,spin_gets,wait_time from v$latch_parent where lower(name) like '%'||lower('test excl. parent l0')||'%'
ADDR NAME LEVEL# LATCH# GETS MISSES SLEEPS IMMEDIATE_GETS IMMEDIATE_MISSES WAITERS_WOKEN WAITS_HOLDING_LATCH SPIN_GETS WAIT_TIME
---------------- ---------------------------------------- ---------- ---------- ---------- ---------- ---------- -------------- ---------------- ------------- ------------------- ---------- ----------
00000000600098D8 test excl. parent l0 0 4 7 0 0 0 0 0 0 0 0
--//LATCH#=4.
SYS@book> create pfile='/tmp/@.ora' from spfile ;
File created.
--//修改/tmp/book.ora 加入:
*._latch_classes='4:3'
*._latch_class_3='100 0 1 10000 20000 30000 40000 50000 60000 70000 50000'
SYS@book> startup pfile=/tmp/@.ora
ORACLE instance started.
Total System Global Area 643084288 bytes
Fixed Size 2255872 bytes
Variable Size 205521920 bytes
Database Buffers 427819008 bytes
Redo Buffers 7487488 bytes
Database mounted.
Database opened.
SYS@book> select * from x$ksllclass ;
ADDR INDX INST_ID SPIN YIELD WAITTIME SLEEP0 SLEEP1 SLEEP2 SLEEP3 SLEEP4 SLEEP5 SLEEP6 SLEEP7
---------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
00000000861986C0 0 1 20000 0 1 8000 8000 8000 8000 8000 8000 8000 8000
00000000861986EC 1 1 20000 0 1 1000 1000 1000 1000 1000 1000 1000 1000
0000000086198718 2 1 20000 0 1 8000 8000 8000 8000 8000 8000 8000 8000
0000000086198744 3 1 100 0 1 10000 20000 30000 40000 50000 60000 70000 50000
0000000086198770 4 1 20000 0 1 8000 8000 8000 8000 8000 8000 8000 8000
000000008619879C 5 1 20000 0 1 8000 8000 8000 8000 8000 8000 8000 8000
00000000861987C8 6 1 20000 0 1 8000 8000 8000 8000 8000 8000 8000 8000
00000000861987F4 7 1 20000 0 1 8000 8000 8000 8000 8000 8000 8000 8000
8 rows selected.
SYS@book> select CLASS_KSLLT,decode(CLASS_KSLLT,2,KSLLTNAM,3,KSLLTNAM) name,count(*) from x$kslltr group by CLASS_KSLLT,decode(CLASS_KSLLT,2,KSLLTNAM,3,KSLLTNAM);
CLASS_KSLLT NAME COUNT(*)
----------- ---------------------------------------- ----------
0 580
3 test excl. parent l0 1
2 process allocation 1
--//latch_name='test excl. parent l0',CLASS_KSLLT=3.
$ cat p4.sh
#! /bin/bash
vdate=$(date '+%H%M%S')
echo $vdate
source peek.sh "$1" 20 | timestamp.pl >| /tmp/peekx_${vdate}.txt &
sqlplus -s -l / as sysdba <<EOF >| /tmp/latch_free_${vdate}.txt &
$(seq 20 | xargs -I {} echo -e '@latch_free \n host sleep 1')
EOF
sleep 1
# 引數如下: @ exclusive_latch.txt latch_name willing why where sleep_num
sqlplus /nolog @ exclusive_latch.txt "$1" 1 4 5 10 > /dev/null &
sleep 2
sqlplus /nolog @ exclusive_latch.txt "$1" 1 6 7 10 > /dev/null &
p=$!
strace -ftrT -p $p -o /tmp/pp_${vdate}.txt > /dev/null &
wait
$ . p4.sh 'test excl. parent l0'
172843
Process 29626 attached - interrupt to quit
Process 29628 attached
Process 29645 attached
Process 29626 suspended
[1] Done source peek.sh "$1" 20 | timestamp.pl >|/tmp/peekx_${vdate}.txt
[3] Done sqlplus /nolog @ exclusive_latch.txt "$1" 1 4 5 10 > /dev/null
[2] Done sqlplus -s -l / as sysdba >|/tmp/latch_free_${vdate}.txt <<EOF
$(seq 20 | xargs -I {} echo -e '@latch_free \n host sleep 1')
EOF
Process 29626 resumed
Process 29645 detached
Process 29626 detached
[4]- Done sqlplus /nolog @ exclusive_latch.txt "$1" 1 6 7 10 > /dev/null
Process 29628 detached
[5]+ Done strace -ftrT -p $p -o /tmp/pp_${vdate}.txt > /dev/null
--// /tmp/pp_172843.txt
29628 0.000081 write(10, "\n", 1) = 1 <0.000026>
29628 0.000149 select(0, [], [], [], {0, 10000}) = 0 (Timeout) <0.010082>
29628 0.010161 select(0, [], [], [], {0, 20000}) = 0 (Timeout) <0.020110>
29628 0.020195 select(0, [], [], [], {0, 30000}) = 0 (Timeout) <0.030115>
29628 0.030207 select(0, [], [], [], {0, 40000}) = 0 (Timeout) <0.040118>
29628 0.040216 select(0, [], [], [], {0, 50000}) = 0 (Timeout) <0.050120>
29628 0.050209 select(0, [], [], [], {0, 60000}) = 0 (Timeout) <0.060129>
29628 0.060218 select(0, [], [], [], {0, 70000}) = 0 (Timeout) <0.070140>
29628 0.070230 select(0, [], [], [], {0, 50000}) = 0 (Timeout) <0.050124>
29628 0.050213 select(0, [], [], [], {0, 50000}) = 0 (Timeout) <0.050118>
29628 0.050207 select(0, [], [], [], {0, 50000}) = 0 (Timeout) <0.050124>
29628 0.050216 select(0, [], [], [], {0, 50000}) = 0 (Timeout) <0.050134>
29628 0.050224 select(0, [], [], [], {0, 50000}) = 0 (Timeout) <0.050117>
29628 0.050207 select(0, [], [], [], {0, 50000}) = 0 (Timeout) <0.050120>
29628 0.050209 select(0, [], [], [], {0, 50000}) = 0 (Timeout) <0.050117>
29628 0.050206 select(0, [], [], [], {0, 50000}) = 0 (Timeout) <0.050120>
29628 0.050211 select(0, [], [], [], {0, 50000}) = 0 (Timeout) <0.050125>
--//可以發現一樣有效.
$ awk '/select/ {print $NF}' /tmp/pp_172843.txt | tr -d '<>' | xargs | sed 's/ /+/g' | bc -l
7.899805
--//接近8秒.spin佔用時間不多.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2641767/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 常用指令碼:獲取隱含引數指令碼
- Oracle direct path read相關隱含引數Oracle
- [20190401]隱含引數_mutex_spin_count.txtMutex
- v$parameter gv$parameter 檢視 DDL 與隱含引數
- [20191206]隱含引數_db_always_check_system_ts.txt
- Oracle 11G 隱含引數“_controlfile_autobackup_delay”Oracle
- 【PARANETERS】Oracle異常恢復相關的隱含引數Oracle
- 使用隱含引數testMappingSpeed排查GoldenGate抽取慢的步驟APPGo
- [20200420]V$SES_OPTIMIZER_ENV 查不到剛修改的隱含引數.txt
- 日誌損壞時,加入隱含引數開啟資料庫的總結資料庫
- histb 引導核心 boot_cmd 引數含義boot
- SpringDataJpa列印Sql詳情(含引數)SpringSQL
- [20220913]hugepage相關引數含義.txt
- [20191204]hugepage相關引數含義.txt
- php引數3個點的含義PHP
- Python中key引數的含義及用法Python
- Python 中 key 引數的含義及用法Python
- 檢視oralce10g,11g隱含引數,並在SQLPLUS視窗格式化輸出SQL
- 關於隱藏引數:_no_recovery_through_resetlogs
- git merge合併程式碼時各引數含義Git
- 10.使用隱含規則
- SAP Fiori 應用 url 中的 DraftUUID 引數的含義RaftUI
- 含兩個引數的三元函式的高階偏導數函式
- SAP Fiori Launchpad url 引數 sap-app-origin-hint 的含義APP
- 電腦顯示器各項引數的含義科普大全:買液晶顯示器主要看哪些引數?
- Jmeter分散式壓測實戰及踩坑處理(含引數化)JMeter分散式
- 記一下rgb螢幕時序引數對應的含義
- 好程式設計師大資料教程Scala系列之隱式轉換和隱式引數程式設計師大資料
- 隱藏程式命令列引數,例如輸入密碼等高危操作命令列密碼
- 關於 SAP UI5 引數 $$updateGroupId 前面兩個 $ 符號的含義UI符號
- [高頻面試]解釋執行緒池的各個引數含義面試執行緒
- 坑坑坑,刪庫跑路的多種隱含命令
- 什麼是請求引數、表單引數、url引數、header引數、Cookie引數?一文講懂HeaderCookie
- 查閱linux tcp核心引數kernel parameter tcp_max_syn_backlog含義之一LinuxTCP
- PHP雙引號的小隱患PHP
- python疑問5:位置引數,預設引數,可變引數,關鍵字引數,命名關鍵字引數區別Python
- 12.MyBatis學習--對映檔案_引數處理_單個引數&多個引數&命名引數MyBatis
- Java對比有引數和無引數Java