ITPub博客

首页 > 数据库 > Oracle > 50 = 0x96 4.如果看jonathan Lewis中文版本P60:

50 = 0x96 4.如果看jonathan Lewis中文版本P60:

原创 Oracle 作者:musicqaz 时间:2021-03-04 16:46:47 0 删除 编辑

SYS@book> @ viewlatch.sql 'gcs partitioned table hash'
ADDR             NAME                                         LEVEL#       GETS     MISSES     SLEEPS IMMEDIATE_GETS IMMEDIATE_MISSES WAITERS_WOKEN WAITS_HOLDING_LATCH  SPIN_GETS  WAIT_TIME
---------------- ---------------------------------------- ---------- ---------- ---------- ---------- -------------- ---------------- ------------- ------------------- ---------- ----------
0000000060018A18 gcs partitioned table hash                        6        296          0          0              0                0             0                   0          0          0

$ . i5.sh
105343
[1]-  Done                    source peek.sh 'gcs partitioned table hash' 10 | timestamp.pl >|/tmp/peeks_${zdate}.txt
[2]+  Done                    seq 10 | xargs -I{} echo -e 'sqlplus -s -l / as sysdba <<< @latch_free\nsleep 1' | bash >|/tmp/latch_free_${zdate}.txt

SYS@book> @ viewlatch.sql 'gcs partitioned table hash'
ADDR             NAME                                         LEVEL#       GETS     MISSES     SLEEPS IMMEDIATE_GETS IMMEDIATE_MISSES WAITERS_WOKEN WAITS_HOLDING_LATCH  SPIN_GETS  WAIT_TIME
---------------- ---------------------------------------- ---------- ---------- ---------- ---------- -------------- ---------------- ------------- ------------------- ---------- ----------
0000000060018A18 gcs partitioned table hash                        6        446          1          0              0                0             0                   0          1          0

--//并发执行150个进程获取gcs partitioned table hash latch,可以发现gets增加150,但是注意1个细节,出现1次MISSES,1次
--//SPIN_GETS。我一直以为大量share latch的请求不会出现阻塞进入SPIN,而实际上的测试还是有少量进入spin。

$ grep  -v '^.*: $' /tmp/peeks_105343.txt  | cut -c10- | uniq -c
      1  SYSDATE             LADDR
      1  ------------------- ----------------
      1  2021-02-08 10:53:43 0000000060018A18
      1  Statement processed.
      2  [060018A18, 060018A54) = 00000000 00000000 00000128 00000096 00000006 00000010 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
      5  [060018A18, 060018A54) = 00000096 00000000 000001BE 00000096 00000006 0000005B 00000004 00000000 00000000 00000001 00000000 00000000 00000000 00000000 00000000
      3  [060018A18, 060018A54) = 00000000 00000000 000001BE 00000096 00000006 0000005B 00000004 00000000 00000000 00000001 00000000 00000000 00000000 00000000 00000000
--//150 = 0x96

4.如果看jonathan Lewis<ORALCE 核心技术>中文版本P60:

表4-3
-------------------------------------------------------------------------
需要的栓锁访问                                   使用方法
-------------------------------------------------------------------------
以共享模式获取其他进程以共享模式持有的共享栓锁   休眠前仅自旋cou_count+2次.
--------------------------------------------------------------------------

--// 英文版本P72:

Table 4-3. Summary of Activity When a Latch Isn't Acquired on the First Attempt  
------------------------------------------------------------------------------------------------------------------
Required Latch Access                                        Method Used
------------------------------------------------------------------------------------------------------------------
Get exclusive latch                                          Attempt immediate get, go into spin cycle
                                                             once (in this case the process spins 20,000
                                                             times), attach to wait list, attempt immediate
                                                             get, go to sleep  
                                                            
Get shareable latch in exclusive mode when another           Go into spin cycle (in this case the process
process is holding it in some mode (whether shared,          spins 2,000 times each cycle), attach to wait
exclusive, or blocking)                                      list, repeat spin cycle, go to sleep if
                                                             unsuccessful

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69995498/viewspace-2761198/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2021-03-04

  • 博文量
    13
  • 访问量
    7172