关于shared pool的深入探讨六(转)

关于shared pool的深入探讨六[@more@]

研究了几天shared pool,没想到忽然就撞到问题上来了。作为一个案例写出来给大家参考一下吧。

问题起因是公司做短信群发,就是那个18万买的4000字的短信小说(嘘,小声点,我也没看过...)。群发的时候每隔一段时间就会发生一次消息队列拥堵的情况,在数据库内部实际上是向一个数据表中记录发送日志。

我们介入来检查数据库的问题,在一个拥堵时段我开始诊断:

SQL> select sid,event,p1,p1raw from v$session_wait;

SID EVENT P1 P1RAW

---------- ---------------------------------------------------------------- ---------- --------

76 latch free 2147535824 8000CBD0

83 latch free 2147535824 8000CBD0

148 latch free 3415346832 CB920E90

288 latch free 2147535824 8000CBD0

285 latch free 2147535824 8000CBD0

196 latch free 2147535824 8000CBD0

317 latch free 2147535824 8000CBD0

2 pmon timer 300 0000012C

1 rdbms ipc message 300 0000012C

4 rdbms ipc message 300 0000012C

6 rdbms ipc message 180000 0002BF20

SID EVENT P1 P1RAW

---------- ---------------------------------------------------------------- ---------- --------

18 rdbms ipc message 6000 00001770

102 rdbms ipc message 6000 00001770

311 rdbms ipc message 6000 00001770

194 rdbms ipc message 6000 00001770

178 rdbms ipc message 6000 00001770

3 log file parallel write 1 00000001

13 log file sync 2705 00000A91

16 log file sync 2699 00000A8B

104 log file sync 2699 00000A8B

308 log file sync 2694 00000A86

262 log file sync 2705 00000A91

SID EVENT P1 P1RAW

---------- ---------------------------------------------------------------- ---------- --------

172 log file sync 2689 00000A81

169 log file sync 2705 00000A91

108 log file sync 2694 00000A86

38 log file sync 2707 00000A93

34 db file scattered read 63 0000003F

5 smon timer 300 0000012C

27 SQL*Net message to client 1413697536 54435000

60 SQL*Net message to client 1413697536 54435000

239 SQL*Net message to client 1413697536 54435000

...ignore some idle waiting here...

11 SQL*Net message from client 675562835 28444553

12 SQL*Net message from client 1413697536 54435000

170 rows selected.

在这次查询中,我发现大量的latch free等待,再次查询时这些等待消失,应用也恢复了正常。

SQL> select sid,event,p1,p1raw from v$session_wait where event not like 'SQL*Net%';

SID EVENT P1 P1RAW

---------- ---------------------------------------------------------------- ---------- --------

2 pmon timer 300 0000012C

1 rdbms ipc message 300 0000012C

4 rdbms ipc message 300 0000012C

6 rdbms ipc message 180000 0002BF20

18 rdbms ipc message 6000 00001770

102 rdbms ipc message 6000 00001770

178 rdbms ipc message 6000 00001770

194 rdbms ipc message 6000 00001770

311 rdbms ipc message 6000 00001770

3 log file parallel write 1 00000001

148 log file sync 2547 000009F3

SID EVENT P1 P1RAW

---------- ---------------------------------------------------------------- ---------- --------

273 log file sync 2544 000009F0

190 log file sync 2545 000009F1

5 smon timer 300 0000012C

14 rows selected.

接下来我们来看这些latch free等待的是哪些latch。

SQL> select addr,latch#,name,gets,spin_gets from v$latch order by spin_gets;

ADDR LATCH# NAME GETS SPIN_GETS

-------- ---------- ------------------------------------------------ ----------

80001398 3 session switching 111937 0

80002010 6 longop free list 37214 0

800023A0 7 cached attr list 0 0

80002628 10 event group latch 2391668 0

.....

80003F3C 28 message pool operations parent latch 3 0

.....

80006030 60 mostly latch-free SCN 19 0

80005F8C 59 file number translation table 68 0

80005F14 58 dlm cr bast queue latch 0 0

80005E8C 57 name-service request 0 0

80005E14 56 name-service memory objects 0 0

80005DA0 55 name-service namespace bucket 0 0

ADDR LATCH# NAME GETS SPIN_GETS

-------- ---------- ------------------------------------------------ ----------

80005D2C 54 name-service pending queue 0 0

80005CB4 53 name-service request queue 0 0

80004E08 52 name-service entry 0 0

80008AB0 76 KCL lock element parent latch 0 0

80008A48 75 KCL instance latch 0 0

80007F18 73 redo copy 816 0

80007BBC 71 archive process latch 0 0

80007B54 70 archive control 1 0

80006A10 68 Active checkpoint queue latch 2003308 0

800064B0 66 large memory latch 0 0

80006448 65 cache protection latch 0 0

ADDR LATCH# NAME GETS SPIN_GETS

-------- ---------- ------------------------------------------------ ----------

800060EC 61 batching SCNs 0 0

8000CAB0 96 global transaction 6833807 0

8000CA48 95 global tx free list 58258 0

8000C238 93 cost function 0 0

80009FCC 91 temp lob duration state obj allocation 0 0

8000995C 87 ktm global data 8118 0

80009228 84 transaction branch allocation 282388 0

80008EC4 80 begin backup scn array 6968 0

80008D54 79 loader state object freelist 42712 0

80008B80 78 KCL freelist latch 0 0

80008B18 77 KCL name table latch 0 0

ADDR LATCH# NAME GETS SPIN_GETS

-------- ---------- ------------------------------------------------ ----------

8000D484 118 presentation list 0 0

8000D41C 117 session timer 855944 0

.....

8000E9D0 129 process queue 44 0

8000E900 127 query server freelists 66 0

8000FC84 140 AQ Propagation Scheduling System Load 0 0

8000E898 126 query server process 10 0

8000E27C 125 job_queue_processes parameter latch 111937 0

8000DA1C 124 NLS data objects 2 0

ADDR LATCH# NAME GETS SPIN_GETS

-------- ---------- ------------------------------------------------ ----------

8000D95C 123 ncodef allocation latch 111937 0

8000D674 122 virtual circuits 0 0

8000D60C 121 virtual circuit queues 159877 0

8000D5A4 120 virtual circuit buffers 0 0

8000D4EC 119 address list 2 0

.....

8000CD70 102 Direct I/O Adaptor 2 0

.....

80002408 8 GDS latch 30 0

800092E4 85 sort extent pool 69834 1

8000EC38 132 parallel query alloc buffer 80 1

8000E968 128 error message lists 22 1

80001400 4 process group creation 2615542 2

8000EAA0 131 parallel query stats 14 2

ADDR LATCH# NAME GETS SPIN_GETS

-------- ---------- ------------------------------------------------ ----------

8000CD08 101 Token Manager 1151107 2

8000CB18 97 global tx hash mapping 507846 2

80006378 63 cache buffer handles 315924 4

8000EA38 130 process queue reference 190993 5

80003E3C 26 channel handle pool latch 2391680 18

80003EAC 27 channel operations parent latch 4783425 24

80009B90 89 intra txn parallel recovery 32654 33

8000FCF8 141 fixed table rows for x$hs_session 161368 41

800012C8 1 process allocation 2391688 154

80009B28 88 parallel txn reco latch 174519 271

8000CCA0 100 library cache load lock 14947545 5958

ADDR LATCH# NAME GETS SPIN_GETS

-------- ---------- ------------------------------------------------ ----------

8000C8D0 94 user lock 13086412 6078

8000914C 82 list of block allocation 120650357 12024

80006A78 69 Checkpoint queue latch 154361751 17686

80009D34 90 sequence cache 64611720 32027

80009090 81 dml lock allocation 234465024 45351

800091C0 83 transaction allocation 214227648 48345

800096AC 86 undo global data 188271244 49641

800028A0 13 enqueue hash chains 373244264 131322

80007E04 72 redo allocation 439389808 201498

80001468 5 session idle bit 2039097976 204969

80002838 12 enqueues 471338482 273695

ADDR LATCH# NAME GETS SPIN_GETS

-------- ---------- ------------------------------------------------ ----------

80001330 2 session allocation 261826230 428312

800063E0 64 multiblock read objects 1380614923 1366278

800026B8 11 messages 207935758 1372606

80001218 0 latch wait list 203479569 1445342

80006310 62 cache buffers chains 3.8472E+10 2521699

8000A17C 92 row cache objects 1257586714 2555872

80007F80 74 redo writing 264722932 4458044

80006700 67 cache buffers lru chain 5664313769 30046921

8000CBD0 98 shared pool 122433688 59070585

8000CC38 99 library cache 4414533796 1037032730

142 rows selected.

SQL> select startup_time from v$instance;

STARTUP_T

---------

13-AUG-04

检查数据库启动时间

我们注意到,在当前数据库中竞争最严重的两个latch是shared pool和library cache.显然这极有可能是SQL的过度解析造成的。进一步我们检查v$sqlarea发现:

SQL> select sql_text,VERSION_COUNT,INVALIDATIONS,PARSE_CALLS,OPTIMIZER_MODE,

PARSING_USER_ID,PARSING_SCHEMA_ID,ADDRESS,HASH_VALUE

from v$sqlarea where version_count >1000;

2

SQL_TEXT

------------------------------------------------------------------------------------------------------------------------

VERSION_COUNT INVALIDATIONS PARSE_CALLS OPTIMIZER_MODE PARSING_USER_ID

PARSING_SCHEMA_ID ADDRESS HASH_VALUE

------------- ------------- ----------- ------------------------- --------------- ----------------- -------- ----------

insert into sms_log (MSGDATE,MSGTIME,MSGID,MSGKIND,MSGTYPE,MSGTYPE_MOMT,

MSGLEN,MSGSTATUS,AREAID,IFIDDEST,IFIDSRC,ADDRSRC,ADDRDEST,ADDRFEE,

ADDRUSER,SERVICECODE,PLANID,FEETYPE,FEEVALUE,DATACODING,FLAGS,SMLEN,

SMCONT) values (:b0,:b1,:b2,:b3,:b4,:b5,:b6,:b7,:b8,:b9,:b10,:b11,:b12,:b13,:b14,:b15,:b16,:b17,:b18,:b19,:b20,:b21,:b22)

7023 0 1596 MULTIPLE CHILDREN PRESENT 36 36 C82AF1C8 3974744754

这就是写日志记录的代码,这段代码使用了绑定变量,但是version_count却有7023个。也就是这个sql有7023个子指针.这是不可想象的。

通过前面几节的研究我们知道,如果这个sql有7023个子指针,那么意味着这些子指针都将存在于同一个Bucket的链表上。那么这也就意味着,如果同样SQL再次执行,Oracle将不得不搜索这个链表以寻找可以共享的SQL。这将导致大量的library cache latch的竞争。

这时候我开始猜测原因:

1.可能代码存在问题,在每次执行之前程序修改某些session参数,导致sql不能共性

2.可能是8.1.5的v$sqlarea记录存在问题,我们看到的结果是假象:)

3.Bug

Ok,我们的诊断不能停。最直接的我dump内存来看:

SQL> ALTER SESSION SET EVENTS 'immediate trace name LIBRARY_CACHE level 4';

察看trace文件得到如下结果(摘录包含该段代码的片断):

BUCKET 21049:

LIBRARY OBJECT HANDLE: handle=c82af1c8

name=

insert into sms_log (MSGDATE,MSGTIME,MSGID,MSGKIND,MSGTYPE,MSGTYPE_MOMT,MSGLEN,

MSGSTATUS,AREAID,IFIDDEST,IFIDSRC,ADDRSRC,ADDRDEST,ADDRFEE,ADDRUSER,

SERVICECODE,PLANID,FEETYPE,FEEVALUE,DATACODING,FLAGS,SMLEN,SMCONT) values

(:b0,:b1,:b2,:b3,:b4,:b5,:b6,:b7,:b8,:b9,:b10,:b11,:b12,:b13,:b14,:b15,:b16,:b17,:b18,:b19,:b20,:b21,:b22)

hash=ece9cab2 timestamp=09-09-2004 12:51:29

namespace=CRSR flags=RON/TIM/PN0/LRG/[10010001]

kkkk-dddd-llll=0000-0001-0001 lock=N pin=S latch=5

lwt=c82af1e0[c82af1e0,c82af1e0] ltm=c82af1e8[c82af1e8,c82af1e8]

pwt=c82af1f8[c82af1f8,c82af1f8] ptm=c82af250[c82af250,c82af250]

ref=c82af1d0[c82af1d0,c82af1d0]

LIBRARY OBJECT: object=c1588e84

type=CRSR flags=EXS[0001] pflags= [00] status=VALD load=0

CHILDREN: size=7024

child# table reference handle

------ -------- --------- --------

0 c1589040 c1589008 c668c2bc

1 c1589040 bfd179c4 c6ec9ee8

2 c1589040 bfd179e0 c2dd9b3c

3 c1589040 bfd179fc c5a46614

4 c1589040 bfd17a18 c35f1388

5 c1589040 bfd17a34 c77401bc

6 c1589040 bfd17a50 c4092838

7 c1589040 bfddb310 c6cd5258

8 c1589040 bfddb32c c63c6650

9 c1589040 bfddb348 c7e4e3d0

10 c1589040 bfddb364 c4c4b110

11 c1589040 bfddb380 c5950348

12 c1589040 bfddb39c c6c33aa4

13 c1589040 bfddb3b8 c672b0bc

...........................................

.....ignore losts of child cursor here.....

...........................................

7001 bf595bc8 c641fba0 c6467890

7002 bf595bc8 c641fbbc c3417168

7003 bf595bc8 c641fbd8 c3417bb0

7004 bf595bc8 c641fbf4 c2fdccbc

7005 bf595bc8 c641fc10 c7f7ca50

7006 bf595bc8 c641fc2c c7f508ec

7007 bf595bc8 c641fc48 c268d8d8

7008 c641fcb8 c641fc64 bec61ed8

7009 c641fcb8 c641fc80 c4a6cc5c

7010 c641fcb8 c641fc9c c1a8aa34

7011 c641fcb8 c0ae4ea0 c0ae4ddc

7012 c641fcb8 c0ae4ebc bd55fe60

7013 c641fcb8 c0ae4ed8 c226914c

7014 c641fcb8 c0ae4ef4 c51dd2e0

7015 c641fcb8 c0ae4f10 c480c468

7016 c641fcb8 c0ae4f2c c60196d0

7017 c641fcb8 c0ae4f48 c4675d2c

7018 c641fcb8 c0ae4f64 bd5e2750

7019 c641fcb8 c0ae4f80 c09b1bb0

7020 c641fcb8 c0ae4f9c bf2d6044

7021 c641fcb8 c0ae4fb8 c332c1c4

7022 c641fcb8 c0ae4fd4 cbdde0f8

DATA BLOCKS:

data# heap pointer status pins change

----- -------- -------- ------ ---- ------

0 c3ef2c50 c1588f08 I/P/A 0 NONE

这里确实存在7023个子指针

查询v$sql得到相同的结果:

SQL> select CHILD_NUMBER,EXECUTIONS,OPTIMIZER_MODE,OPTIMIZER_COST,PARSING_USER_ID,

2 PARSING_SCHEMA_ID,ADDRESS,HASH_VALUE

3 from v$sql where HASH_VALUE='3974744754';

CHILD_NUMBER EXECUTIONS OPTIMIZER_ OPTIMIZER_COST PARSING_USER_ID PARSING_SCHEMA_ID ADDRESS HASH_VALUE

------------ ---------- ------ ---------- ------------- ------------ -------- ----------

0 12966 CHOOSE 238150 36 36 C82AF1C8 3974744754

1 7111 CHOOSE 238150 36 36 C82AF1C8 3974744754

2 9160 CHOOSE 238150 36 36 C82AF1C8 3974744754

3 9127 CHOOSE 238150 36 36 C82AF1C8 3974744754

4 8109 CHOOSE 238150 36 36 C82AF1C8 3974744754

5 4386 CHOOSE 238150 36 36 C82AF1C8 3974744754

6 4913 CHOOSE 238150 36 36 C82AF1C8 3974744754

7 3764 CHOOSE 238150 36 36 C82AF1C8 3974744754

8 3287 CHOOSE 238150 36 36 C82AF1C8 3974744754

9 3156 CHOOSE 238150 36 36 C82AF1C8 3974744754

.....

7015 1 CHOOSE 238150 36 36 C82AF1C8 3974744754

7016 1 CHOOSE 238150 36 36 C82AF1C8 3974744754

7017 0 CHOOSE 238150 36 36 C82AF1C8 3974744754

7018 9396 NONE 0 0 C82AF1C8 3974744754

7019 5008 CHOOSE 237913 36 36 C82AF1C8 3974744754

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

user_pic_default.png
请登录后发表评论 登录
全部评论
<%=items[i].createtime%>

<%=items[i].content%>

<%if(items[i].items.items.length) { %>
<%for(var j=0;j
<%=items[i].items.items[j].createtime%> 回复

<%=items[i].items.items[j].username%>   回复   <%=items[i].items.items[j].tousername%>: <%=items[i].items.items[j].content%>

<%}%> <%if(items[i].items.total > 5) { %>
还有<%=items[i].items.total-5%>条评论 ) data-count=1 data-flag=true>点击查看
<%}%>
<%}%> <%}%>

转载于:http://blog.itpub.net/9417382/viewspace-937434/

基于传感器数据实现火灾报警预测分析 火警 系统当检测到烟雾、火灾、一氧化碳或其他与火灾有关或一般通知的紧急情况时,向人们发出警告 阅读详情

相关推荐

树莓派安装snowboy

1、树莓派换源 参考链接:https://blog.youkuaiyun.com/qq_43556844/article/details/113615915 2、更新pip3 参考链接:https://blog.youkuaiyun.com/qq_43556844/article/details/113616214 3、存取麦克风 我们使用PortAudio作为音频输入/输出的跨平台支持。我们还使用sox作为快速实用程序来检查麦克风设置是否正确。 sudo apt-get install python-pyaudio python

qq_43556844的博客 1923

Oracle SHARED POOL的SUB POOL技术

在Oracle 10g中,如果设置SGA_TARGET为0,或者在Oracle 10.2.0.5之前的版本中把cursor_space_for_time设置为TRUE时,_enable_shared_pool_durations自动被设置为FALSE。虽然从Oracle 10g开始,Oracle改进了相关算法,允许进程请求内存时可在不同SUB POOL中切换,提高了请求成功的可能性,但需要说明的是,请求切换不是一个无止境操作,而且请求切换也需要额外的管理成本,降低了内存获取的效率。系统CPU的数量。

weixin_46593978的博客 548

英伟达NVIDIA数字IC后端笔试真题(ASIC Physical Design Engineer)

英伟达NVIDIA数字IC后端笔试真题(ASIC Physical Design方向)

weixin_37584728的博客 3912

关于shared pool的深入探讨(一)

关于shared pool的深入探讨(一)link:http://www.eygle.com/internal/shared_pool-1.htm关于shared pool的设置一直是一个争议较多的内容.很多文章上说,shared pool设置过大会带来额外的管理上的负担,从而在某些条件下会导致性能的下降.那么这个管理上的负担指的是什么内容呢?本文对这个内容作一定的深入探讨.本文只

eygle's life 1616

ESP32 Arduino学习篇 (一) 引脚和串口的基本使用

简单来讲arduino就是通过源代码控制开发板的信号输入输出从而实现对一些电子元件的控制,例如LED灯,蜂鸣器,按键arduino程序首先来讲arduino程序是基于C语言,而实现类似对于LED灯和蜂鸣器的简单控制只需简单C语言知识即可实现。arduino程序是基于函数的,而在arduino的库有很多函数,我们只需要调用即可。arduino的程序主体是**setup()函数和loop()**函数以及其它在使用过程中需要构建的函数:setup()函数。

DOF526570的博客 1万+

Mendix 开发实践指南|Mendix平台概览

低代码开发是一种将编码从文本形式转变为视觉形式的应用开发方法。它提供了一个模型驱动的、拖放式的界面,而不是传统的编码环境,使得各种技能水平的开发者——包括专业开发人员、新手、主题专家、业务利益相关者和决策者——都能使用低代码工具来构建驱动价值的企业业务应用。低代码的核心在于提高开发的可访问性和效率,让更多人能够参与到应用开发中来​​。Mendix适用于多种应用场景,包括企业级应用、移动应用、物联网(IoT)应用和微服务架构等。

多年搬砖的经验分享... 4413

oracle shared_pool_size 0,SHARED_POOL_RESERVED_SIZE及RESERVED POOL

一、什么是Reserved Pool某些操作(如large packages or PL/SQL)会需要大的连续的请求share pool空间,如果share pool空间不足且碎片化严重,会迫使oracle寻找未使用的share pool中的空闲chunks来满足这种请求的需要,会造成数据库性能下降。oracle为这些请求专门保留了一部分空间,这部分专属空间就叫做Reserved Pool。Re...

weixin_31313019的博客 945

3、灵巧手的设计与构造

本文详细探讨了灵巧手的设计与构造,包括多指结构、关节和连杆设计、传感器集成以及分层控制架构等内容。同时,通过工业装配、医疗手术辅助和日常生活辅助等实际应用案例,展示了灵巧手的灵活性和适应性,并分析了当前设计面临的挑战及未来发展方向。

brandy的博客 490

修改参数SHARED_POOL_SIZE ,JAVA_POOL_SIZE

修改参数SHARED_POOL_SIZE ,JAVA_POOL_SIZE - question: 在oracle升级说明文档里这样写的 make sure that the init.ora parameters SHARED_POOL_SIZE and JAVA_POOL_SIZE are each 150 MB or more before you run the catpatch.sql upgrade script. 我想问一下这两个参数要怎么修改 找到init.ora直接

edifierliu的专栏 8027

【unity游戏开发之InputSystem——01】通过写代码监听InputSystem输入(基于unity6开发介绍)

通过写代码监听InputSystem输入(基于unity6开发介绍)

向宇的博客,专注php/web全栈 unity游戏开发,欢迎大家评论纠错 4892

SAP Group Reporting入门指南(1)--开篇及系统环境搭建

文章介绍了SAP GR的发展历程、与BPC的对比优势,数据收集的多种方式(实时同步、外部导入等)以及合并整体流程,并推出《SAP Group Reporting入门指南》专栏。

bflyfish的博客 282

关于shared pool的深入探讨(一) 【转载】

关于shared pool的深入探讨(一) 作者:eygle|English【转载时请标明出处和作者信息】|【恩墨学院OCM培训传DBA成功之道】链接:http://www.eygle.com/archives/2004/10/shared_pool-1.html 关于shared pool的设置一直是一个争议较多的内容.很多文章上说,shared pool设置过大会带来...

aiduo1030的博客 151

GeoXCP:可解释人工智能中空间解释的不确定性量化

GeoXCP: uncertainty quantification of spatial explanations in explainable AI提出基于保形预测(conformal prediction)的不确定性量化框架——地理空间解释保形预测(GeoXCP),将空间依赖纳入建模过程,生成具有校准不确定性估计的空间自适应解释。通过大量模拟实验和真实世界数据集验证,GeoXCP在不同地理空间场景中能提供可靠解释并有效量化不确定性,推动可解释地理空间机器学习的发展,帮助决策者评估模型驱动洞察的可信度。

May the Force be with you 243

关于shared pool的深入探讨

关于shared pool的深入探讨 作者:eygle   关于shared pool的深入探讨(一) 关于shared pool的设置一直是一个争议较多的内容。很多文章上说,shared pool设置过大会带来额外的管理上的负担,从而在某些条件下会导致性能的下降。那么这个管理上的负担指的是什么内容呢? 本文对这个内容作一定的深入探讨。本文只涉及一个方面,后续的文章将从其他方面继续讨论

haiross的专栏 6166

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

关于shared pool的深入探讨(二)

link:http://www.eygle.com/internal/shared_pool-2.htm我们继续把前面的问题展开一下.其实我们可以从数据库内部监控shared pool的空间碎片情况.这涉及到一个内部视图x$ks...

congwei1159的博客 207

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain&#39;s apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath(&#39;DeepLearnToolbox&#39;));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand(&#39;state&#39;,0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = &#39;sigm&#39;;%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, &#39;Too big error&#39;);```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, &#39;Too big error&#39;);```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

关于shared pool的深入探讨(二)【转载】

关于shared pool的深入探讨(二) 作者:eygle|English【转载时请标明出处和作者信息】|【恩墨学院OCM培训传DBA成功之道】链接:http://www.eygle.com/archives/2004/10/shared_pool-2.html 我们继续把前面的问题展开一下. 其实我们可以从数据库内部监控shared pool的空间碎片情况.这涉及到...

aiduo1030的博客 196

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

自动化分析Oracle shared pool争用因素

Oracle SHARED POOL上的性能问题比BUFFER POOL上的要严重得多。本文将进一步地探讨SHARED POOL上的优化思路。 首先,需要确保SHARED POOL的大小足够。到Oracle 11.2.0.3为止,存放在SHARED POOL中的组件越来越多,对SHARED POOL的要求也越来越高。如果数据库升级,建议适当扩大SHARED POOL。当SHARED POOL内存不够时,相关组件会由于内存不足而产生争用,尤其是ROW CACHE争用可能会导致严重的性能问题。如果SHARED

weixin_46593978的博客 587

oracle shared pool size,SHARED_POOL_RESERVED_SIZE参数的设置及作用

SHARED_POOL_RESERVED_SIZE参数的设置及作用shared_pool_reserved_size:该参数指定了保留的共享池空间,用于满足将来的大的连续的共享池空间请求。当共享池出现过多碎片,请求大块空间会导致Oracle大范围的查找并释放共享池内存来满足请求,由此可能会带来较为严重的性能下降,设置合适的shared_pool_reserved_size参数,结合_shared_...

weixin_39665302的博客 1646

使用DBMS_SHARED_POOL包将PL/SQL大对象保存到Shared Pool

当系统在加载PL/SQL大对象时,有可能遭遇由于Shared Pool中存在大量碎片导致没有足够空间加载的问题。   我们可以将那些经常被使用的PL/SQL大对象预先保存到Shared Pool中,防止加载失败以及经常被换出,提高系统运行效率。 1.创建存储过程初始化测试

chuanzhongdu1的专栏 634

Oracle Shared pool 详解

Oracle Shared pool 详解 分类: Oracle Performance Oracle Advanced Knowledge 2011-06-22 14:30 2529人阅读 评论(0) 收藏 举报   一. Shared Pool 概述             在之前的blog对Oracle 的内存架构也做了一个概述,参考:

个人学习记录所用 1900

关于shared pool的深入探讨(四)

我们进一步来讨论一下shared pool的处理: 先进行相应查询,获得测试数据: [oracle@jumper udump]$ sqlplus "/ as sysdba" SQL*Plus: Release 9.2.0.3.0 - Production on Thu Aug 26 10:21:54 2004 Copyright (c) 19...

aiduo1030的博客 176

Oracle体系结构-Shared Pool详解

(如自治数据库),Shared Pool的调优逐渐自动化(如19c的自动SGA),但理解其原理仍是诊断性能问题的关键。Shared Pool是SGA(System Global Area)的核心组件,其设计目标为。Shared Pool是Oracle。:随着Oracle转向。

m0_37873601的博客 852

DBMS_SHARED_POOL

1. DBMS_SHARED_POOL.ABORTED_REQUEST_THRESHOLD (threshold_size NUMBER); threshold_size单位为byte, 当申请超过此大小空间时将直接报错而不是free unpinned memory within the shared pool. The range ofthreshold_sizeis 5000 to ~2 GB inclusive. The procedures provided here may be use...

彦祖的小号的博客 411

oracle 调整shared pool,Oracle设置Shared Pool的大小

在oracle 10G或者11G版本中,如何合理设置shared pool大小,对oracle数据库的性能影响很大。Shared Pool的大小设置规则如下:1.查到shared pool设置的合理值,语句如下:select 'Shared Pool' component,shared_pool_size_for_estimate estd_sp_size,estd_lc_time_saved_f...

weixin_39797758的博客 1716

Troubleshooting: Tuning the Shared Pool and Tuning Library Cache Latch Contention (文档 ID 62143.1)

In this Document   Purpose   Introduction   Ask Questions, Get Help, And Share Your Experiences With This Article   Troubleshooting Steps

mybluetiankong的专栏 1436

oracle11 share pool,Oracle Shared pool 详解

. Shared Pool概述在之前的blog对的内存也做了一个概述,参考:Oracle内存架构详解在网上搜到一篇介绍shared pool非常详细的pdf资料。 原文链接以找不到,但还是要感谢作者Kamus的辛勤劳动。结合Kamus的pdf和csdn网友的blog,重新整理了一下,链接如下:IINTRODUCT IIONWhatis shared pool? This first query t...

weixin_39730671的博客 546
上一篇: 关于shared pool的深入探讨五(转)
下一篇: 使用ERRORSTACK进行错误跟踪及诊断(转)
congwan5321
博客等级 码龄11年 1粉丝 0原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值