oracle performance tunning(4)
四、診斷latch競爭
1、概念
Latch是簡單的、低層次的序列化技術,用以保護SGA中的共享資料結構,比如併發使用者列表和 buffer cache裡的blocks資訊。一個伺服器程式或後臺程式在開始操作或尋找一個共享資料結構之前必須獲得對應的latch,在完成以後釋放latch。 不必對latch本身進行最佳化,如果latch存在競爭,表明SGA的一部分正在經歷不正常的資源使用。
1)Latch的作用:
A、序列化訪問:保護SGA中的共享資料結構;保護共享記憶體的分配。
B、序列化執行:避免同時執行某些關鍵程式碼;避免互相干擾。
2)Latch請求的兩種型別:
A、willing-to-wait:請求的程式經過短時間的等待後再次發出請求,直到獲得latch
B、immediate:如果沒有獲得latch,請求的程式不等待,而是繼續處理其他指令。
2、檢查Latch競爭
檢查latch free是不是主要的wait event:
Select * from v$system_event order by time_waited;
檢查latch的使用情況:
Select * from v$latch:
與willing-to-wait請求有關的列:gets、misses、sleeps、wait_time、cwait_time、spin_gets
與immediate請求有關的列:immediate_gets、immediate_misses
Gets: number of successful willing-to-wait requests for a latch;
Misses: number of times an initial wiling-to-wait request was unsuccessful;
Sleeps: number of times a process waited after an initial willing-to-wait request;
Wait_time: number of milliseconds waited after willing-to-wait request;
Cwait_time: a measure of the cumulative wait time including the time spent spinning and sleeping,the overhead of context switches due to OS time slicing and page faults and interrupts;
Spin_gets: gets that misses first try but succeed after spinning.
Immediate_gets: number of successful immediate requests for each latch;
Immediate_misss: number of unsuccessful immediate requests for each latch;
一般無需調整latch,但是下列的措施是有用的:
A、對處於競爭中的latch做進一步的調查
B、如果競爭主要存在於shared pool和library cache中,可以考慮調整應用
C、如果進一步的調查顯示需要調整shared pool和buffer cache,就進行調整
Select * from v$latch where name like ‘%shared pool%’ or name like ‘%library cache%’;
如果競爭是在shared pool或library cache上,表示下列集中情況:
A、不能共享的sql,應檢查他們是否相似,考慮以變數代替sql中的常量:
Select sql_text from v$sqlarea where executions=1 order by upper(sql_text);
B、共享sql被重新編譯,考慮library cache的大小是否需要調整:
SELECT sql_text,parse_calls,executions FROM v$sqlarea where parse_calls>5;
C、library cache不夠大。[@more@]
1、概念
Latch是簡單的、低層次的序列化技術,用以保護SGA中的共享資料結構,比如併發使用者列表和 buffer cache裡的blocks資訊。一個伺服器程式或後臺程式在開始操作或尋找一個共享資料結構之前必須獲得對應的latch,在完成以後釋放latch。 不必對latch本身進行最佳化,如果latch存在競爭,表明SGA的一部分正在經歷不正常的資源使用。
1)Latch的作用:
A、序列化訪問:保護SGA中的共享資料結構;保護共享記憶體的分配。
B、序列化執行:避免同時執行某些關鍵程式碼;避免互相干擾。
2)Latch請求的兩種型別:
A、willing-to-wait:請求的程式經過短時間的等待後再次發出請求,直到獲得latch
B、immediate:如果沒有獲得latch,請求的程式不等待,而是繼續處理其他指令。
2、檢查Latch競爭
檢查latch free是不是主要的wait event:
Select * from v$system_event order by time_waited;
檢查latch的使用情況:
Select * from v$latch:
與willing-to-wait請求有關的列:gets、misses、sleeps、wait_time、cwait_time、spin_gets
與immediate請求有關的列:immediate_gets、immediate_misses
Gets: number of successful willing-to-wait requests for a latch;
Misses: number of times an initial wiling-to-wait request was unsuccessful;
Sleeps: number of times a process waited after an initial willing-to-wait request;
Wait_time: number of milliseconds waited after willing-to-wait request;
Cwait_time: a measure of the cumulative wait time including the time spent spinning and sleeping,the overhead of context switches due to OS time slicing and page faults and interrupts;
Spin_gets: gets that misses first try but succeed after spinning.
Immediate_gets: number of successful immediate requests for each latch;
Immediate_misss: number of unsuccessful immediate requests for each latch;
一般無需調整latch,但是下列的措施是有用的:
A、對處於競爭中的latch做進一步的調查
B、如果競爭主要存在於shared pool和library cache中,可以考慮調整應用
C、如果進一步的調查顯示需要調整shared pool和buffer cache,就進行調整
Select * from v$latch where name like ‘%shared pool%’ or name like ‘%library cache%’;
如果競爭是在shared pool或library cache上,表示下列集中情況:
A、不能共享的sql,應檢查他們是否相似,考慮以變數代替sql中的常量:
Select sql_text from v$sqlarea where executions=1 order by upper(sql_text);
B、共享sql被重新編譯,考慮library cache的大小是否需要調整:
SELECT sql_text,parse_calls,executions FROM v$sqlarea where parse_calls>5;
C、library cache不夠大。[@more@]
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/18921899/viewspace-1016897/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle performance tunningOracleORM
- oracle performance tunning(1)OracleORM
- oracle performance tunning(2)OracleORM
- oracle performance tunning(3)OracleORM
- oracle performance tunning(5)OracleORM
- oracle performance tunning(6)OracleORM
- oracle performance tunning(7)OracleORM
- oracle performance tunning(8)OracleORM
- oracle performance tunning(9)OracleORM
- oracle performance tunning(10)OracleORM
- Oracle Performance Tuning 11g2 (4)OracleORM
- oracle sql tunning all hintsOracleSQL
- Oracle Performance ChecklistOracleORM
- oracle sql tunning 15 --常用改寫OracleSQL
- Oracle Performance Tune PlanOracleORM
- oracle performance Features and VersionsOracleORM
- Oracle Performance Top Issue listOracleORM
- Oracle Performance Testing PrincipleOracleORM
- [Oracle Script] ASM Disks Performance metricOracleASMORM
- Oracle Performance Storyteller MERGEOracleORM
- How to use hints in Oracle sql for performanceOracleSQLORM
- 【SQL Performance Analyzer】Oracle 11g SQL Performance Analyzer feature使用SQLORMOracle
- oracle.Performance.Tuning筆記OracleORM筆記
- Oracle Advanced Performance Tuning ScriptsOracleORM
- Oracle -- Common Performance Tuning IssuesOracleORM
- 關閉sql tunningSQL
- Oracle Advanced Performance Tuning Scripts(轉)OracleORM
- A taste of SQL Performance Analyzer in oracle 11gASTSQLORMOracle
- Oracle SQL performance with database links - dblinkOracleSQLORMDatabase
- SQL TUNNING 注意事項SQL
- Oracle Performance Tuning 11g2 (2)OracleORM
- Oracle Performance Tuning 11g2 (6)OracleORM
- Oracle Performance Tuning 11g2 (5)OracleORM
- Oracle Performance Tuning 11g2 (3)OracleORM
- Oracle Performance Tuning 11g2 (1)OracleORM
- Oracle Doc list involved with performance tuningOracleORM
- [筆記]Semaphores Tunning on RedHat Linux for Oracle 9i or 10g筆記RedhatLinuxOracle
- 【OCM】Oracle Database 10g: Performance Tuning(一)OracleDatabaseORM