Who protect large pool?

June 11th, 2007 | Categories: Boring | Tags:

Recently,read a document sent by wwwf. It’s reference Note: 62140.1.And says “The large pool is protected by the ’shared pool’ latch for memory allocation and management”.

I did test and show that shared pool latch has more contention when sorting & hash join during MTS mode,compared with dedicate mode.


Test Scripts and Steps:

SQL> exec statspack.snap
 
cat binzhang.sh
---------------------------------------------
--
sqlplus binzhang/binzhang@mts9205 <<EOF >>binzhang.text.log

alter session set hash_area_size=100000;
select /*+ use_hash(a1 a2) */count(*) from t a1,t a2
where a1.object_id=a2.object_id;
exit;
EOF
-----------------------------------------
--
 

cat runtest.sh
--------------------------------------
--
wait

./
binzhang.sh &
.
.
.
./
binzhang.sh &
wait
./
binzhang.sh &
.
.
.
./
binzhang.sh &
wait
./
binzhang.sh &
.
.
.
./
binzhang.sh &
wait
-------------------------------------
--
 

SQL> exec statspack.snap

Results under MTS mode:it shows 13,870 shared pool latch requests.

  1. Pct    Avg   Wait                 Pct
  2.                               Get          Get   Slps   Time       NoWait NoWait
  3. Latch                       Requests      Miss  /Miss    (s)     Requests   Miss
  4. ------------------------ -------------- ------ ------ ------ ------------ ------
  5. shared pool                      13,870    0.6    0.0      0            0
  6.  
  7. ^LLatch Sleep breakdown for DB: MTS9205  Instance: MTS9205  Snaps: 2 -3
  8. -> ordered by misses desc
  9.  
  10.                                       Get                            Spin &
  11. Latch Name                       Requests      Misses      Sleeps Sleeps 1->4
  12. -------------------------- -------------- ----------- ----------- ------------
  13. shared pool                        13,870          80           2 78/2/0/0/0
  14. cache buffers chains              361,377          13           8 0/0/0/0/0
  15.           -------------------------------------------------------------
  16. ^LLatch Miss Sources for DB: MTS9205  Instance: MTS9205  Snaps: 2 -3
  17. -> only latches with sleeps are shown
  18. -> ordered by name, sleeps desc
  19.                                                      NoWait              Waiter
  20. Latch Name               Where                       Misses     Sleeps   Sleeps
  21. ------------------------ -------------------------- ------- ---------- --------
  22. cache buffers chains     kcbgtcr: kslbegin excl           0          4        8
  23. cache buffers chains     kcbrls: kslbegin                 0          4        2
  24. shared pool              kghalo                           0          2        0
  25.           -------------------------------------------------------------

Yong told me that kghalo means “kernel generic heap allocate”.

Under dedicate mode, it needs 2,962 shared pool latch requests,far less than MTS mode

  1. Pct    Avg   Wait                 Pct
  2.                               Get          Get   Slps   Time       NoWait NoWait
  3. Latch                       Requests      Miss  /Miss    (s)     Requests   Miss
  4. ------------------------ -------------- ------ ------ ------ ------------ ------
  5. shared pool                       2,962    0.3    0.0      0            0
  6.  
  7.  
  8. ^LLatch Sleep breakdown for DB: MTS9205  Instance: MTS9205  Snaps: 4 -5
  9. -> ordered by misses desc
  10.  
  11.                                       Get                            Spin &
  12. Latch Name                       Requests      Misses      Sleeps Sleeps 1->4
  13. -------------------------- -------------- ----------- ----------- ------------
  14. cache buffers chains              359,873          39          23 0/0/0/0/0
  15. library cache                       8,989          34           5 29/5/0/0/0
  16.           -------------------------------------------------------------
  17. ^LLatch Miss Sources for DB: MTS9205  Instance: MTS9205  Snaps: 4 -5
  18. -> only latches with sleeps are shown
  19. -> ordered by name, sleeps desc
  20.                                                      NoWait              Waiter
  21. Latch Name               Where                       Misses     Sleeps   Sleeps
  22. ------------------------ -------------------------- ------- ---------- --------
  23. cache buffers chains     kcbrls: kslbegin                 0         14        3
  24. cache buffers chains     kcbgtcr: kslbegin excl           0          7       18
  25. cache buffers chains     kcbchg: kslbegin: bufs not       0          1        0
  26. cache buffers chains     kcbgcur: kslbegin                0          1        1
  27. library cache            kglpndl: child: before pro       0          3        0
  28. library cache            kgllkdl: child: cleanup          0          1        0
  29. library cache            kglupc: child                    0          1        0
  30.           -------------------------------------------------------------

Aslo,shared pool latch has less contention,compared with other latches, in dedicate mode.

Shared pool latch also protect shared pool in sga. So some applications that do overmuch sorts&hash opeartions would work worse under MTS if it already has latch contention on shared pool, literal SQL etc.

Del.icio.us Google书签 Digg Live Bookmark Technorati Furl Yahoo书签 Facebook 百度搜藏 新浪 ViVi 365Key 网摘 天极网摘 和讯网摘 博拉网 POCO 网摘 饭否 QQ 书签 Digbuzz 我挖网 Mister Wong
No comments yet.