[20190419]shared latch spin count 2.txt
[20190419]shared latch spin count 2.txt
--//上午测试shared latch XX模式的情况,链接:http://blog.itpub.net/267265/viewspace-2641902/
--//继续测试其它情况.
--//链接:http://andreynikolaev.wordpress.com/2011/01/14/spin-tales-part-2-shared-latches-in-oracle-9-2-11g/
S mode get X mode get
Held in S mode Compatible 2*_spin_count
Held in X mode 0 2*_spin_count
Blocking mode 0 2*_spin_count
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
SYS@book> @ hide spin_count
NAME DESCRIPTION DEFAULT_VALUE SESSION_VALUE SYSTEM_VALUE
----------------- ---------------------------------- ------------- ------------- ------------
_mutex_spin_count Mutex spin count TRUE 255 255
_spin_count Amount to spin waiting for a latch TRUE 2000 2000
$ cat shared_latch.txt
/* 参数如下: @ latch.txt latch_name willing why where mode sleep_num */
--//connect / as sysdba
col laddr new_value laddr
col vmode new_value vmode
select decode(lower('&&5'),'s',8,'x',16,'8',8,'16',16) vmode from dual ;
SELECT addr laddr FROM v$latch_parent WHERE NAME='&&1';
oradebug setmypid
oradebug call kslgetsl_w 0x&laddr &&2 &&3 &&4 &vmode
host sleep &&6
oradebug call kslfre 0x&laddr
--//exit
--//注:我前几天的测试脚本有connect / as sysdba,exit这两行,我为了调式方便,先注解这2行,避免反复退出进入会话.
2.测试1:
--//选择一个shared latch测试,我选择"test shared non-parent l0" latch测试:
SYS@book> select * from shared_latches where name='test shared non-parent l0';
VERSION LATCH# NAME S
---------- ------ ------------------------- -
11.2.0.4.0 6 test shared non-parent l0 Y
2.测试一些细节不再列出,参考链接:http://blog.itpub.net/267265/viewspace-2641902/
--//测试XS模式的情况:
--//session 1:
SYS@book> @ shared_latch.txt "test shared non-parent l0" 1 1 2 x 100000
--//session 2:
SYS@book> @ spid
SID SERIAL# PROCESS SERVER SPID PID P_SERIAL# C50
---------- ---------- ------------------------ --------- ------ ------- ---------- --------------------------------------------------
1 11 31454 DEDICATED 31455 24 5 alter system kill session '1,11' immediate;
--//记下spid=31455.
SYS@book> @shared_latch.txt "test shared non-parent l0" 1 3 4 s 1
--//注意session 申请S mode.
--//window 3:执行:
$ rlwrap gdb -p 31455 -x spin_s.gdb
Breakpoint 1 at 0x93f97a8
Breakpoint 2 at 0x93f9b74
Breakpoint 3 at 0x9808932
Breakpoint 4 at 0x9809840
Breakpoint 5 at 0x37990d6400
Breakpoint 6 at 0x93f9ddc
Breakpoint 7 at 0x93faa36
Breakpoint 8 at 0xa865ca
Breakpoint 9 at 0xa874fa
Breakpoint 10 at 0xa875be
(gdb) c
Continuing.
...
kslgetl 6010d860, 1, 2126093176, 3991
ksl_get_shared_latch laddr:85f7f4c8, willing:1, where:-2043602896, why:96, mode:16
ksl_get_shared_latch laddr:85f7f4c8, willing:1, where:-2043602896, why:95, mode:8
ksl_get_shared_latch laddr:85f7f4c8, willing:1, where:-2043602896, why:96, mode:16
ksl_get_shared_latch laddr:85f7f4c8, willing:1, where:-2043602896, why:95, mode:8
ksl_get_shared_latch laddr:85f7f4c8, willing:1, where:-2043602896, why:96, mode:16
ksl_get_shared_latch laddr:85f7f4c8, willing:1, where:-2043602896, why:95, mode:8
ksl_get_shared_latch laddr:85f7f4c8, willing:1, where:-2043602896, why:96, mode:16
ksl_get_shared_latch laddr:60009a18, willing:1, where:3, why:4, mode:8
kslgess 60009a18, 8, 0, 3
kslskgs 60009a18, 0, 1129096976, 1129097520
kslskgs 60009a18, 0, 1129096976, 1129097520
---Type <return> to continue, or q <return> to quit---
skgpwwait 1129096760, 202182304, -2044672536, 0
sskgpwwait 1129096760, 202182304, -2044672536, 0
semop 315588608, 1129096560, 1, -1
--//按ctrl+c出现如下:
kslskgs 60009a18, 0, 1129096976, 1129097520
--//可以看出X模式的情况,申请S mode,第2进程直接调用semop.根本不做spin操作.
3.测试2:
--//测试SX模式的情况:
--//session 1:
SYS@book> @ shared_latch.txt "test shared non-parent l0" 1 1 2 s 100000
--//session 持有S mode.
--//session 2:
SYS@book> @shared_latch.txt "test shared non-parent l0" 1 3 4 x 1
--//注意session 申请x mode.
--//window 3:执行:
$ rlwrap gdb -p 31455 -x spin_s.gdb
..
ksl_get_shared_latch laddr:85f7f4c8, willing:1, where:-2043602896, why:95, mode:8
ksl_get_shared_latch laddr:85f7f4c8, willing:1, where:-2043602896, why:96, mode:16
ksl_get_shared_latch laddr:60009a18, willing:1, where:3, why:4, mode:16
kslgess 60009a18, 16, 0, 3
kslskgs 60009a18, 0, 1129096976, 1129097520
spin count loop: 2000 a875be
spin count loop: 1999 a875be
spin count loop: 1998 a875be
spin count loop: 1997 a875be
...
spin count loop: 3 a875be
spin count loop: 2 a875be
spin count loop: 1 a875be
kslskgs 60009a18, 0, 1129096976, 1129097520
spin count loop: 1 a875be
skgpwwait 1129096760, 202182304, -2044672536, 0
sskgpwwait 1129096760, 202182304, -2044672536, 0
semop 315588608, 1129096560, 1, -1
--//按ctrl+c后.
kslskgs 60009a18, 0, 1129096976, 1129097520
spin count loop: 2000 a875be
--//可以S模式的情况,申请X mode,第2进程spin_count=2000.
4.测试3:
--//Blocking mode,首先我对这个模式的理解不是非常清晰.
--//我的理解
A.当前X mode持有,不管S,X模式申请都会阻塞,再有进程申请的情况.
B.当前S mode持有,X模式申请,后续再有进程申请的情况.
--//也就是这个情况至少3个会话,我分别测试看看
--//session 1:
SYS@book> @ shared_latch.txt "test shared non-parent l0" 1 1 2 s 100000
--//session 2:
SYS@book> @ shared_latch.txt "test shared non-parent l0" 1 3 4 x 1
--//session 3:
--//spid=31572
SYS@book> @ shared_latch.txt "test shared non-parent l0" 1 5 6 s 1
--//gdb监测session 3进程:
$ rlwrap gdb -p 31572 -x spin_s.gdb
...
ksl_get_shared_latch laddr:85f7fa68, willing:1, where:-2042914736, why:95, mode:8
ksl_get_shared_latch laddr:85f7fa68, willing:1, where:-2042914736, why:96, mode:16
ksl_get_shared_latch laddr:60009a18, willing:1, where:5, why:6, mode:8
kslgess 60009a18, 8, 0, 5
kslskgs 60009a18, 0, -1923148048, -1923147504
kslskgs 60009a18, 0, -1923148048, -1923147504
skgpwwait -1923148264, 202182304, -2044655416, 0
sskgpwwait -1923148264, 202182304, -2044655416, 0
semop 315588608, -1923148464, 1, -1
kslskgs 60009a18, 0, -1923148048, -1923147504
--//申请S mode,没有spin.
--//session 1:
SYS@book> @ shared_latch.txt "test shared non-parent l0" 1 1 2 s 100000
--//session 2:
SYS@book> @ shared_latch.txt "test shared non-parent l0" 1 3 4 x 1
--//session 3:
--//spid=31572
SYS@book> @ shared_latch.txt "test shared non-parent l0" 1 5 6 x 1
--//gdb监测session 3进程:
$ rlwrap gdb -p 31572 -x spin_s.gdb
...
ksl_get_shared_latch laddr:85f7fa68, willing:1, where:-2042914736, why:96, mode:16
ksl_get_shared_latch laddr:60009a18, willing:1, where:5, why:6, mode:16
kslgess 60009a18, 16, 0, 5
kslskgs 60009a18, 0, -1923148048, -1923147504
spin count loop: 2000 a875be
spin count loop: 1999 a875be
spin count loop: 1998 a875be
spin count loop: 1997 a875be
...
spin count loop: 1 a875be
kslskgs 60009a18, 0, -1923148048, -1923147504
spin count loop: 1 a875be
skgpwwait -1923148264, 202182304, -2044655416, 0
sskgpwwait -1923148264, 202182304, -2044655416, 0
semop 315588608, -1923148464, 1, -1
kslskgs 60009a18, 0, -1923148048, -1923147504
spin count loop: 2000 a875be
--//申请X mode,spin_count=2000.
--//XSS的情况:
ksl_get_shared_latch laddr:85f7fa68, willing:1, where:-2042914736, why:96, mode:16
ksl_get_shared_latch laddr:60009a18, willing:1, where:5, why:6, mode:8
kslgess 60009a18, 8, 0, 5
kslskgs 60009a18, 0, -1923148048, -1923147504
kslskgs 60009a18, 0, -1923148048, -1923147504
skgpwwait -1923148264, 202182304, -2044655416, 0
sskgpwwait -1923148264, 202182304, -2044655416, 0
semop 315588608, -1923148464, 1, -1
kslskgs 60009a18, 0, -1923148048, -1923147504
--//XSX的情况:
ksl_get_shared_latch laddr:85f7fa68, willing:1, where:-2042914736, why:96, mode:16
ksl_get_shared_latch laddr:60009a18, willing:1, where:5, why:6, mode:16
kslgess 60009a18, 16, 0, 5
kslskgs 60009a18, 0, -1923148048, -1923147504
spin count loop: 2000 a875be
spin count loop: 1999 a875be
spin count loop: 1998 a875be
spin count loop: 1997 a875be
spin count loop: 1996 a875be
spin count loop: 1995 a875be
...
sskgpwwait -1923148264, 202182304, -2044655416, 0
semop 315588608, -1923148464, 1, -1
kslskgs 60009a18, 0, -1923148048, -1923147504
spin count loop: 2000 a875be
--//总之:阻塞申请X mode,spin_count=2000.S mode 直接调用semop休眠.
5.总结
--//画一个表格:
S mode get X mode get
Held in S mode Compatible _spin_count
Held in X mode 0 _spin_count
Blocking mode 0 _spin_count
[20190419]shared latch spin count 2.txt的更多相关文章
- [20190419]shared latch spin count.txt
[20190419]shared latch spin count.txt --//昨天测试exclusive latch spin count = 20000(缺省).--//今天测试shared ...
- [20190418]exclusive latch spin count.txt
[20190418]exclusive latch spin count.txt--//昨天测试"process allocation" latch,主要这个latch与其它拴锁s ...
- [20190416]查看shared latch gets的变化.txt
[20190416]查看shared latch gets的变化.txt 1.环境:SYS@book> @ ver1PORT_STRING VERSION ...
- [20190416]完善shared latch测试脚本2.txt
[20190416]完善shared latch测试脚本2.txt --//昨天测试shared latch,链接:http://blog.itpub.net/267265/viewspace-264 ...
- [20190415]关于shared latch(共享栓锁).txt
[20190415]关于shared latch(共享栓锁).txt http://andreynikolaev.wordpress.com/2010/11/17/shared-latch-behav ...
- [20190505]关于latch 一些统计信息.txt
[20190505]关于latch 一些统计信息.txt --//我在两篇文章,提到一些latch的统计信息.链接如下:http://blog.itpub.net/267265/viewspace-2 ...
- [20190319]shared pool latch与library cache latch的简单探究.txt
[20190319]shared pool latch与library cache latch的简单探究.txt --//昨天看Oracle DBA手记3:数据库性能优化与内部原理解析.pdf 电子书 ...
- [20190416]11g下那些latch是Exclusive的.txt
[20190416]11g下那些latch是Exclusive的.txt --//昨天测试了11g下那些latch是共享的,链接:--//是否反过来剩下的都是Exclusive的.继续测试: 1.环境 ...
- [20190415]10g下那些latch是共享的.txt
[20190415]10g下那些latch是共享的.txt http://andreynikolaev.wordpress.com/2010/11/23/shared-latches-by-oracl ...
随机推荐
- 第65章 博客帖子 - Identity Server 4 中文文档(v1.0.0)
第65章 博客帖子 65.1 团队帖子 65.1.1 2019 IdentityServer中的范围和声明设计 尝试使用IdentityServer4的设备流程 OAuth2中隐含流的状态 另一种保护 ...
- C#动态调用泛型类、泛型方法
在制作一个批量序列化工具时遇到了如下问题,在此记录一下,仅供参考. 主程序加载另一个程序集,将其中的所有类取出,然后对这些类分别调用泛型类或泛型方法.控制台程序解决方案如下: Main工程:提供Wor ...
- 将个人博客从GitHub迁移至阿里云服务器过程总结
让我们先回顾下前两篇博客: 程序员如何从0到1搭建自己的技术博客 在个人博客中优雅的使用Gitalk评论插件 通过前两篇博客,我们了解了如何快速的从0到1搭建一个个人博客并使用了Gitalk评论插件, ...
- Dynamics CRM中跨域调用Web API 2
关注本人微信和易信公众号: 微软动态CRM专家罗勇 ,回复224或者20160611可方便获取本文,同时可以在第一间得到我发布的最新的博文信息,follow me!我的网站是 www.luoyong. ...
- 使用Fiddler获取OAuth2认证的access token时候返回502
微软动态CRM专家罗勇 ,回复322或者20190402可方便获取本文,同时可以在第一间得到我发布的最新博文信息,follow me! 我这里Fiddler的Composer功能来获取OAuth2 认 ...
- SQL SERVER数据库的简单介绍
一.数据库技术的发展 数据库技术是应数据管理任务的需求而产生的,先后经历了人工管理.文件系统.数据库系统等三个阶段. 二.关系型数据库 SQL Server属于关系型数据库. 关系模型 以二维表来描述 ...
- OKR能解决996吗?德鲁克怎么看?
最近网络上热议的“996”,不由让人想起我们的邻国日本.他们在20年前就有过一个热词“过劳死”,就是职场加班太严重导致的猝死. 最近有一本书新书<过劳时代>,说的就是日本20年前的过劳死. ...
- 记录SoapUI使用说明
一.SoapUI简介 SoapUI是一个开源测试工具,通过soap/http来检查.调用.实现Web Service的功能/负载/符合性测试.该工具既可作为一个单独的测试软件使用,也可利用插件集成到E ...
- 解决Ajax请求时无法重定向的问题
今天发现,当使用Ajax请求时,如果后台进行重定向到其他页面时是无法成功的,只能在浏览器地址栏输入才能够实现重定向. Ajax默认就是不支持重定向的,它是局部刷新,不重新加载页面. 需要实现的功能是, ...
- 吴恩达机器学习笔记59-向量化:低秩矩阵分解与均值归一化(Vectorization: Low Rank Matrix Factorization & Mean Normalization)
一.向量化:低秩矩阵分解 之前我们介绍了协同过滤算法,本节介绍该算法的向量化实现,以及说说有关该算法可以做的其他事情. 举例:1.当给出一件产品时,你能否找到与之相关的其它产品.2.一位用户最近看上一 ...