[20190416]查看shared latch gets的变化.txt

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 addr,name,level#,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('&&1')||'%';
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        630         69         73              0                0             0                   0          0  541058918

--//补充一点我发现空扫描v$latch也会导致gets的增加.扫描 v$latch_parent不会.

2.测试:
$ cat peek.sh
#! /bib/bash
# 参数如下:latch_name Monitoring_duration
sqlplus -s -l / as sysdba <<EOF
col laddr new_value laddr
SELECT sysdate,addr laddr FROM v\$latch_parent WHERE NAME='$1';
oradebug setmypid
$(seq $2|xargs -I{} echo -e 'oradebug peek 0x&laddr 60\nhost sleep 1' )
EOF
--//修改peek查看的长度60.

$ cat i3.sh
#! /bin/bash
zdate=$(date '+%H%M%S')
echo $zdate
source peek.sh 'gcs partitioned table hash' 36 | timestamp.pl >| /tmp/peeks_${zdate}.txt &
seq 36 | xargs -I{} echo -e 'sqlplus -s -l / as sysdba <<< @latch_free\nsleep 1'  | bash >| /tmp/latch_free_${zdate}.txt &
# 参数如下: @ latch.txt latch_name willing why where mode sleep_num
sqlplus /nolog @ shared_latch.txt 'gcs partitioned table hash' 1 4 5  8 6 > /dev/null &
sleep 2
sqlplus /nolog @ shared_latch.txt 'gcs partitioned table hash' 1 7 8  8 6 > /dev/null &
sleep 2
sqlplus /nolog @ shared_latch.txt 'gcs partitioned table hash' 1 9 10 8 6 > /dev/null &
sleep 2
sqlplus /nolog @ shared_latch.txt 'gcs partitioned table hash' 1 11 12 8 6 > /dev/null &
wait

$ grep  -v '^.*: $' /tmp/peeks_153425.txt | cut -c10- | uniq -c
      1  SYSDATE             LADDR
      1  ------------------- ----------------
      1  2019-04-16 15:34:25 0000000060018A18
      1  Statement processed.
      2  [060018A18, 060018A54) = 00000001 00000000 00000277 00000096 00000006 00000005 00000004 00000000 00000000 00000045 00000000 00000000 203FE766 00000000 00000049
      2  [060018A18, 060018A54) = 00000002 00000000 00000278 00000096 00000006 00000008 00000007 00000000 00000000 00000045 00000000 00000000 203FE766 00000000 00000049
      2  [060018A18, 060018A54) = 00000003 00000000 00000279 00000096 00000006 0000000A 00000009 00000000 00000000 00000045 00000000 00000000 203FE766 00000000 00000049
      2  [060018A18, 060018A54) = 00000003 00000000 0000027A 00000096 00000006 0000000C 0000000B 00000000 00000000 00000045 00000000 00000000 203FE766 00000000 00000049
      2  [060018A18, 060018A54) = 00000002 00000000 0000027A 00000096 00000006 0000000C 0000000B 00000000 00000000 00000045 00000000 00000000 203FE766 00000000 00000049
      2  [060018A18, 060018A54) = 00000001 00000000 0000027A 00000096 00000006 0000000C 0000000B 00000000 00000000 00000045 00000000 00000000 203FE766 00000000 00000049
     24  [060018A18, 060018A54) = 00000000 00000000 0000027A 00000096 00000006 0000000C 0000000B 00000000 00000000 00000045 00000000 00000000 203FE766 00000000 00000049

SYS@book> select addr,name,level#,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('&&1')||'%';
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        634         69         73              0                0             0                   0          0  541058918

--//0x27A=634
--//0x277=631
--//0x45=69
--//0x49=73
--//上下对比可以发现MISSES,SLEEPS次数没有变化.gets增加4次.WAIT_TIME的时间也没有变化.

$ cat i4.sh
#! /bin/bash
zdate=$(date '+%H%M%S')
echo $zdate
source peek.sh 'gcs partitioned table hash' 36 | timestamp.pl >| /tmp/peeks_${zdate}.txt &
seq 36 | xargs -I{} echo -e 'sqlplus -s -l / as sysdba <<< @latch_free\nsleep 1'  | bash >| /tmp/latch_free_${zdate}.txt &
# 参数如下: @ latch.txt latch_name willing why where mode sleep_num
sqlplus /nolog @ shared_latch.txt 'gcs partitioned table hash' 1 4 5  x 6 > /dev/null &
sleep 2
sqlplus /nolog @ shared_latch.txt 'gcs partitioned table hash' 1 7 8  s 6 > /dev/null &
sleep 2
sqlplus /nolog @ shared_latch.txt 'gcs partitioned table hash' 1 9 10 s 6 > /dev/null &
sleep 1.9
sqlplus /nolog @ shared_latch.txt 'gcs partitioned table hash' 1 11 12 s 6 > /dev/null &
wait

SYS@book> select addr,name,level#,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('&&1')||'%';
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        634         69         73              0                0             0                   0          0  541058918

$ grep  -v '^.*: $' /tmp/peeks_153730.txt | cut -c10- | uniq -c
      1  SYSDATE             LADDR
      1  ------------------- ----------------
      1  2019-04-16 15:37:30 0000000060018A18
      1  Statement processed.
      6  [060018A18, 060018A54) = 00000015 20000000 0000027B 00000096 00000006 00000005 00000004 00000000 00000000 00000045 00000000 00000000 203FE766 00000000 00000049
      6  [060018A18, 060018A54) = 00000001 00000000 0000027C 00000096 00000006 00000008 00000007 00000000 00000000 00000046 00000000 00000000 207CF91C 00000000 0000004A
      6  [060018A18, 060018A54) = 00000001 00000000 0000027D 00000096 00000006 0000000A 00000009 00000000 00000000 00000047 00000000 00000000 20F71FAA 00000000 0000004B
      6  [060018A18, 060018A54) = 00000001 00000000 0000027E 00000096 00000006 0000000C 0000000B 00000000 00000000 00000048 00000000 00000000 21AFED4D 00000000 0000004C
     12  [060018A18, 060018A54) = 00000000 00000000 0000027E 00000096 00000006 0000000C 0000000B 00000000 00000000 00000048 00000000 00000000 21AFED4D 00000000 0000004C

SYS@book> select addr,name,level#,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('&&1')||'%';
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        638         72         76              0                0             0                   0          0  565177677

--//上下比较,可以发现GETS增加4次,MISSES,SLEEPS增加3次.WAIT_TIME从565177677=>541058918, 相减等于24118759,可以猜测这个单位是微秒.换算后大约24秒.基本符合.
--//也可以发现持有该latch时,gets数量增加.

3.继续测试:
--//如果大量的并发S mode会出现什么情况呢?
$ cat i5.sh
#! /bin/bash
zdate=$(date '+%H%M%S')
echo $zdate
source peek.sh 'gcs partitioned table hash' 10 | timestamp.pl >| /tmp/peeks_${zdate}.txt &
seq 10 | xargs -I{} echo -e 'sqlplus -s -l / as sysdba <<< @latch_free\nsleep 1'  | bash >| /tmp/latch_free_${zdate}.txt &
# 参数如下: @ latch.txt latch_name willing why where mode sleep_num
sleep 1
seq 100 | xargs -I {} -P 100 sqlplus /nolog @ shared_latch.txt 'gcs partitioned table hash' 1 4 {}  s 6 > /dev/null
wait
--//100个会话并发的情况呢?

SYS@book> select addr,name,level#,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('&&1')||'%';
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        840         73         76              0                0             0                   0          1  565177677

$ grep  -v '^.*: $' /tmp/peeks_155301.txt | cut -c10- | uniq -c
      1  SYSDATE             LADDR
      1  ------------------- ----------------
      1  2019-04-16 15:53:01 0000000060018A18
      1  Statement processed.
      2  [060018A18, 060018A54) = 00000000 00000000 00000348 00000096 00000006 00000055 00000004 00000000 00000000 00000049 00000000 00000000 21AFED4D 00000000 0000004C
      6  [060018A18, 060018A54) = 00000064 00000000 000003AC 00000096 00000006 0000001C 00000004 00000000 00000000 0000004C 00000000 00000000 21AFED4D 00000000 0000004C
      2  [060018A18, 060018A54) = 00000000 00000000 000003AC 00000096 00000006 0000001C 00000004 00000000 00000000 0000004C 00000000 00000000 21AFED4D 00000000 0000004C

SYS@book> select addr,name,level#,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('&&1')||'%';
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        940         76         76              0                0             0                   0          4  565177677

--//没有问题计数正确!!没有丢失.
--//0x21AFED4D=565177677,对应的是wait_time总和.

[20190416]查看shared latch gets的变化.txt的更多相关文章

  1. [20190416]完善shared latch测试脚本2.txt

    [20190416]完善shared latch测试脚本2.txt --//昨天测试shared latch,链接:http://blog.itpub.net/267265/viewspace-264 ...

  2. [20190415]关于shared latch(共享栓锁).txt

    [20190415]关于shared latch(共享栓锁).txt http://andreynikolaev.wordpress.com/2010/11/17/shared-latch-behav ...

  3. [20190419]shared latch spin count 2.txt

    [20190419]shared latch spin count 2.txt --//上午测试shared latch XX模式的情况,链接:http://blog.itpub.net/267265 ...

  4. [20190505]关于latch 一些统计信息.txt

    [20190505]关于latch 一些统计信息.txt --//我在两篇文章,提到一些latch的统计信息.链接如下:http://blog.itpub.net/267265/viewspace-2 ...

  5. [20190416]process allocation latch.txt

    [20190416]process allocation latch.txt --//看链接:http://andreynikolaev.wordpress.com/2010/12/16/hidden ...

  6. [20190416]11g下那些latch是Exclusive的.txt

    [20190416]11g下那些latch是Exclusive的.txt --//昨天测试了11g下那些latch是共享的,链接:--//是否反过来剩下的都是Exclusive的.继续测试: 1.环境 ...

  7. [20190319]shared pool latch与library cache latch的简单探究.txt

    [20190319]shared pool latch与library cache latch的简单探究.txt --//昨天看Oracle DBA手记3:数据库性能优化与内部原理解析.pdf 电子书 ...

  8. [20190419]shared latch spin count.txt

    [20190419]shared latch spin count.txt --//昨天测试exclusive latch spin count = 20000(缺省).--//今天测试shared ...

  9. [20190423]简单测试latch nowilling等待模式.txt

    [20190423]简单测试latch nowilling等待模式.txt --//我对这个问题的理解就是如果参数willing=0,表示无法获取该latch,直接退出,再寻找类似的latch.--/ ...

随机推荐

  1. Spring Cloud Alibaba基础教程:Nacos的集群部署

    继续说说生产环境的Nacos搭建,通过上一篇<Spring Cloud Alibaba基础教程:Nacos的数据持久化>的介绍,我们已经知道Nacos对配置信息的存储原理,在集群搭建的时候 ...

  2. Java集合学习总结

    java集合 collection public interface Collection<E> extends Iterable<E> List public interfa ...

  3. win10环境下如何运行debug

    在学习汇编的时候,会需要用到debug调试程序,但是现在win10默认已经移除了这个插件,我们需要手动安装,下面就告诉大家如何在win10环境下安装debug. 1:准备工具 1.1 DOSBox 1 ...

  4. Android Aop日志

    Android在许多情况下需要知道一些方法的耗时,然后对与这些耗时进行一些处理和优化.当然我们可以在方法的开头和结尾分别来打一行日志来解决这个问题.但是这个方式侵入性强,而且比较难以修改和删除这些日志 ...

  5. PIC单片机基础2

    PIC中档系列单片机,每条指令14位,共有35条汇编指令,根据操作对象不同,可将其分为三类: 字节操作类指令 位操作类指令 立即数与控制类操作指令 1.字节操作类指令,以MOVF指令为例: 指令:MO ...

  6. How to resolve CSRF protection error while adding service through Ambari api

    Short Description: This article will describe on how to disable CSRF protection in Ambari. Article A ...

  7. 关于uni-app框架的学习-1

    根据官方文档进行学习Uni-APP, 再次过程中,记录一些需要熟悉的内容,有不合适的地方,见着都可知道,----我是一个小白,小白,小白 官网地址:https://uniapp.dcloud.io/ ...

  8. 【自然语言处理篇】--Chatterbot聊天机器人

    一.前述 ChatterBot是一个基于机器学习的聊天机器人引擎,构建在python上,主要特点是可以自可以从已有的对话中进行学(jiyi)习(pipei). 二.具体 1.安装 是的,安装超级简单, ...

  9. python接口自动化(三)--如何设计接口测试用例(详解)

    简介 上篇我们已经介绍了什么是接口测试和接口测试的意义.在开始接口测试之前,我们来想一下,如何进行接口测试的准备工作.或者说,接口测试的流程是什么?有些人就很好奇,接口测试要流程干嘛?不就是拿着接口文 ...

  10. 宁撞金钟一下,不打破鼓三千,IT人要有志气,要进就进大的好的公司

    最近我也在帮一些朋友面试,再结合自身的经验,发现了一个意料之外情理之中的事情:个别挣钱能力一般或规模比较小的公司,对候选人的要求普遍比一些大公司反而高,而且工作时间普遍会比一些好公司要长. 比如一个税 ...