[20190402]對比_mutex_wait_scheme不同模式cpu消耗.txt
[20190402]對比_mutex_wait_scheme不同模式cpu消耗.txt
--//前幾天做了sql語句在mutexes上的探究.今天對比不同_mutex_wait_scheme模式cpu消耗.
1.環境:
SYS@book> @ hide mutex
NAME DESCRIPTION DEFAULT_VALUE SESSION_VALUE SYSTEM_VALUE
------------------- ------------------ ------------- ------------- ------------
_mutex_spin_count Mutex spin count TRUE 255 255
_mutex_wait_scheme Mutex wait scheme TRUE 2 2
_mutex_wait_time Mutex wait time TRUE 1 1
--//注:_mutex_wait_time=1,相當1釐秒.
SCOTT@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
$ cat m2.txt
set verify off
column a noprint new_value v_a;
--select mod ( &&3 ,3) a from dual ;
--alter session set optimizer_index_cost_adj= &&3;
host sleep $(echo &&3/50| bc -l )
insert into job_times values ( sys_context ('userenv', 'sid') ,dbms_utility.get_time ,'&&2') ;
commit ;
declare
v_id number;
v_d date;
begin
for i in 1 .. &&1 loop
--select 1 into v_id from dual ;
--select sysdate into v_d from dual ;
select deptno into v_id from dept where deptno=10;
end loop;
end ;
/
update job_times set time_ela = dbms_utility.get_time - time_ela where sid=sys_context ('userenv', 'sid') and method='&&2';
commit;
--quit
$ seq 150 | xargs -I {} -P 150 bash -c "sqlplus -s -l scott/book @m2.txt 1e6 f2_150 {} >/dev/null"
SYS@book> @ mutexy 6 a31kd5tkdvvmm
HASH SUM_SLEEPS SUM_GETS LOCATION MUTEX_TYPE MUTEX_ADDR SQLID KGLNAOWN C100
---------- ---------- ---------- ------------------------------ -------------------- ---------------- ------------- -------- ---------------------------------------
1692266099 2263154 4.6431E+10 kksLockDelete [KKSCHLPIN6] Cursor Pin 000000007C88E330 a31kd5tkdvvmm SELECT DEPTNO FROM DEPT WHERE DEPTNO=10
1692266099 2183544 4.4733E+10 kksfbc [KKSCHLFSP2] Cursor Pin 000000007C88E330 a31kd5tkdvvmm SELECT DEPTNO FROM DEPT WHERE DEPTNO=10
1692266099 5256 600010918 kksfbc [KKSCHLPIN1] Cursor Pin 000000007C88E330 a31kd5tkdvvmm SELECT DEPTNO FROM DEPT WHERE DEPTNO=10
1692266099 6 45955498 kksHeapReadUnlock [KKSCHLRDUP] Cursor Pin 000000007C88E330 a31kd5tkdvvmm SELECT DEPTNO FROM DEPT WHERE DEPTNO=10
--//MUTEX_ADDR=000000007C88E330.
2.測試一:
--//測試_mutex_wait_scheme=2的情況:
--//session 1:
SCOTT@book> @ spid
SID SERIAL# PROCESS SERVER SPID PID P_SERIAL# C50
---------- ---------- ------------------------ --------- ------ ------- ---------- --------------------------------------------------
295 5 65222 DEDICATED 65223 21 3 alter system kill session '295,5' immediate;
--//session 2:
SYS@book> oradebug setmypid
Statement processed.
SYS@book> oradebug peek 0x000000007C88E330 8
[07C88E330, 07C88E338) = 00000000 00000000
SYS@book> oradebug poke 0x000000007C88E330 8 0x0000000200000127
BEFORE: [07C88E330, 07C88E338) = 00000000 00000000
AFTER: [07C88E330, 07C88E338) = 00000127 00000002
--//session 1:
SCOTT@book> @ m2.txt 1 c1 0
1 row created.
Commit complete.
--//掛起!!
$ top -p 65223
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
65223 oracle 20 0 857m 29m 25m S 0.3 0.0 0:00.41 oracle
--//CPU消耗0.3.
--//另外我執行如下:
SYS@book> @ mutexy 5 a31kd5tkdvvmm
HASH SUM_SLEEPS SUM_GETS LOCATION MUTEX_TYPE MUTEX_ADDR SQLID KGLNAOWN C100
---------- ---------- ---------- ------------------------------ -------------------- ---------------- ------------- -------- ---------------------------------------
1692266099 2263154 4.6431E+10 kksLockDelete [KKSCHLPIN6] Cursor Pin 000000007C88E330 a31kd5tkdvvmm SELECT DEPTNO FROM DEPT WHERE DEPTNO=10
1692266099 2183544 4.4733E+10 kksfbc [KKSCHLFSP2] Cursor Pin 000000007C88E330 a31kd5tkdvvmm SELECT DEPTNO FROM DEPT WHERE DEPTNO=10
1692266099 19266 600013714 kksfbc [KKSCHLPIN1] Cursor Pin 000000007C88E330 a31kd5tkdvvmm SELECT DEPTNO FROM DEPT WHERE DEPTNO=10
1692266099 6 45955498 kksHeapReadUnlock [KKSCHLRDUP] Cursor Pin 000000007C88E330 a31kd5tkdvvmm SELECT DEPTNO FROM DEPT WHERE DEPTNO=10
--//等一會...
SYS@book> @ mutexy 5 a31kd5tkdvvmm
HASH SUM_SLEEPS SUM_GETS LOCATION MUTEX_TYPE MUTEX_ADDR SQLID KGLNAOWN C100
---------- ---------- ---------- ------------------------------ -------------------- ---------------- ------------- -------- ---------------------------------------
1692266099 2263154 4.6431E+10 kksLockDelete [KKSCHLPIN6] Cursor Pin 000000007C88E330 a31kd5tkdvvmm SELECT DEPTNO FROM DEPT WHERE DEPTNO=10
1692266099 2183544 4.4733E+10 kksfbc [KKSCHLFSP2] Cursor Pin 000000007C88E330 a31kd5tkdvvmm SELECT DEPTNO FROM DEPT WHERE DEPTNO=10
1692266099 26386 600013714 kksfbc [KKSCHLPIN1] Cursor Pin 000000007C88E330 a31kd5tkdvvmm SELECT DEPTNO FROM DEPT WHERE DEPTNO=10
1692266099 6 45955498 kksHeapReadUnlock [KKSCHLRDUP] Cursor Pin 000000007C88E330 a31kd5tkdvvmm SELECT DEPTNO FROM DEPT WHERE DEPTNO=10
--//僅僅LOCATION=kksfbc [KKSCHLPIN1],SUM_SLEEPS數量在增加.
AFTER: [07C88E330, 07C88E338) = 00000127 00000002
SYS@book> oradebug poke 0x000000007C88E330 8 0x0
BEFORE: [07C88E330, 07C88E338) = 00000127 00000002
AFTER: [07C88E330, 07C88E338) = 00000000 00000000
3.測試二:
--//測試_mutex_wait_scheme=1的情況:
--//基本重複上面的步驟,不再列出執行步驟.
SYS@book> alter system set "_mutex_wait_scheme"=1 scope=memory;
System altered.
$ top -p 65223
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
65223 oracle 20 0 857m 29m 25m S 3.0 0.0 0:01.29 oracle
--//CPU消耗3.
4.測試三:
--//測試_mutex_wait_scheme=1的情況:
--//基本重複上面的步驟,不再列出執行步驟.
SYS@book> alter system set "_mutex_wait_scheme"=0 scope=memory;
System altered.
$ top -p 65223
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
65223 oracle 20 0 857m 29m 25m S 39.9 0.0 0:06.99 oracle
--//CPU消耗39.9
5.總結:
--//畫一個表格如下:
-------------------------------------------------------------------------------------------------------
_mutex_wait_scheme CPU使用率 描述
------------------------------------------------------------------------------------------------------
2 .3 2秒時間內,semtimedop 182次 getrusage 2次 _mutex_spin_count=255
12 2秒時間內,semtimedop 167次 getrusage 2次 _mutex_spin_count=65535
1 3 2秒時間內, select 16XX次(每次呼叫0.001秒).,getrusage 2次
0 39.9 呼叫99次sched_yield,然後1次seelct(每次呼叫0.001秒).
------------------------------------------------------------------------------------------------------
--//注:這是我當前硬體條件下的測試結果,而且我一直阻塞sql語句執行並且_mutex_wait_time=1的情況.
--//一些測試資料參考連結:
http://blog.itpub.net/267265/viewspace-2639675/
http://blog.itpub.net/267265/viewspace-2640003/
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2640073/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [20210803]對比transparent hugepage的記憶體消耗.txt記憶體
- Java不同資料結構記憶體消耗比較Java資料結構記憶體
- 找出消耗CPU最高的程式對應的SQL語句SQL
- [20190402]Library Cache mutex.txtMutex
- [20220610]對比表結構的不同.txt
- MySQL 5.7定位消耗CPU高的SQLMySql
- 不同的連線方式效能對比!
- 獲得消耗cpu較高的topsqlSQL
- [20190402]關於semtimedop函式呼叫2.txt函式
- Redis 不同插入方法的效能對比Redis
- 不同平臺上mysql的對比(轉)MySql
- 不同環境Odoo執行速度對比Odoo
- 透過top命令抓取cpu高消耗的sqlSQL
- 通過top命令抓取cpu高消耗的sqlSQL
- sql調優學習之cpu消耗過多...SQL
- 硬解析帶來高CPU消耗的診斷
- PHP對比兩個資料中不同的元素PHP
- 不同Framework下StringBuilder和String的效能對比,及不同Framework效能比(附Demo)FrameworkUI
- 單例模式實現對比單例模式
- 遊戲測試 Perfdog 實戰之減少 CPU 消耗遊戲
- 檢視當前最消耗CPU/Memory的oracle程式Oracle
- 【AIX 學習】記憶體和CPU消耗程式排序AI記憶體排序
- 橋接模式與裝飾模式的對比橋接模式
- Oracle資料庫 11.2.0.4 EMON程式持續消耗CPUOracle資料庫
- 中印企業商業模式對比模式
- 執行sed命令卡死CPU消耗100%一例分析
- linux下檢視最消耗CPU、記憶體的程式Linux記憶體
- linux 查詢最消耗CPU和記憶體的程式Linux記憶體
- SQLServer如何查詢近3分鐘最消耗CPU的SQLSQLServer
- Express 與 koa 中介軟體模式對比Express模式
- 不同渠道零售企業對比–資料資訊圖
- vivoXplay5全部版本對比評測不同在哪?
- 建立型設計模式對比總結 設計模式(八)設計模式
- AIX常用命令收藏:記憶體和CPU消耗程式排序AI記憶體排序
- AWR報告分析之一:高 DB CPU 消耗的效能根源-eygle
- 伺服器CPU比家用CPU更有哪些優勢伺服器
- 依賴安裝:setup.py和requirements.txt的對比UIREM
- 針對mysql不同binlog模式的一些測試MySql模式