等待模拟-library cache 软解析

本文涉及的产品
公共DNS(含HTTPDNS解析),每月1000万次HTTP解析
全局流量管理 GTM,标准版 1个月
云解析 DNS,旗舰版 1个月
简介: create table test(it int);insert into testvalues(10);commit;create or replace procedure do_soft_parse(p_idx in number) is  ...
create table test
(it int);
insert into test
values(10);
commit;

create or replace procedure do_soft_parse(p_idx in number)
 is 
    v_value number;
    v_cursor sys_refcursor;
 begin
    execute immediate 'alter session set session_cached_cursor=0';
    for idx in 1..100000 loop
    open v_cursor for 'select 1 from test test'||p_idx||' where rownum=1';
    fetch v_cursor into v_value;
    close v_cursor;
 end loop;
 end;
 alter system flush shared_pool;
 同时执行大量的软解析。
 var job_no number;
 begin 
   for idx in 1..49 loop
    dbms_job.submit(:job_no,'do_soft_parse('||idx||');');
    commit;
end loop;
end;
本会话执行
execute do_soft_parse(50);

测试使用9I latch free 出现但是9I中的LATCH FREE P2可以对应v$latch 中的LATCH#找到是LIBRARY CACHE,
使用session_cached_cursors参数后可以发现library 有明显减少大约1半
 
 
使用前
SQL> select * from v$session_event a,(select SID from v$mystat where rownum
  2  where a.SID=b.sid order by TIME_WAITED desc;
 
       SID EVENT                                                            TOTAL_WAITS TOTAL_TIMEOUTS TIME_WAITED AVERAGE_WAIT   MAX_WAIT TIME_WAITED_MICRO        SID
---------- ---------------------------------------------------------------- ----------- -------------- ----------- ------------ ---------- ----------------- ----------
        54 SQL*Net message from client                                               19              0        8167          430       8062          81667520         54
        54 latch free                                                               237              0        4700           20         63          47001876         54
        54 SQL*Net message to client                                                 19              0           0            0          0                44         54
 
SQL> 
SQL> select c.sid,b.NAME,a.VALUE from v$sesstat a ,v$statname b ,(select SID from v$mystat where rownum
  2    where a.SID=c.sid and a.STATISTIC#=b.STATISTIC# and (b.NAME like '%parse%') and a.VALUE0 ;
 
       SID NAME                                                                  VALUE
---------- ---------------------------------------------------------------- ----------
        54 parse time cpu                                                            8
        54 parse time elapsed                                                     3898
        54 parse count (total)                                                  100018
        54 parse count (hard)                                                        5
  
 使用后
SQL> 
SQL> select c.sid,b.NAME,a.VALUE from v$sesstat a ,v$statname b ,(select SID from v$mystat where rownum
  2    where a.SID=c.sid and a.STATISTIC#=b.STATISTIC# and (b.NAME like '%parse%') and a.VALUE0 ;
 
       SID NAME                                                                  VALUE
---------- ---------------------------------------------------------------- ----------
        51 parse time cpu                                                            3
        51 parse time elapsed                                                     1977
        51 parse count (total)                                                  100012
        51 parse count (hard)                                                        4
 
SQL> 
SQL> select * from v$session_event a,(select SID from v$mystat where rownum
  2  where a.SID=b.sid order by TIME_WAITED desc;
 
       SID EVENT                                                            TOTAL_WAITS TOTAL_TIMEOUTS TIME_WAITED AVERAGE_WAIT   MAX_WAIT TIME_WAITED_MICRO        SID
---------- ---------------------------------------------------------------- ----------- -------------- ----------- ------------ ---------- ----------------- ----------
        51 SQL*Net message from client                                               23              0        6620          288       6143          66195328         51
        51 latch free                                                               144              0        2993           21         47          29926551         51
        51 SQL*Net message to client                                                 23              0           0            0          0                54         51

阅读(1873) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
评论热议
请登录后评论。

登录 注册

相关文章
|
8月前
|
Java
Java线程通信的精髓:解析通知等待机制的工作原理
Java线程通信的精髓:解析通知等待机制的工作原理
96 3
Java线程通信的精髓:解析通知等待机制的工作原理
|
SQL Oracle 关系型数据库
|
网络协议 应用服务中间件 nginx
nginx internal DNS cache poisoning
nginx maintains an internal DNS cache for resolved domain names.
882 0
|
网络协议
针对前段爆出的DNS Cache Poison的一些分析
 http://bbs.chinacissp.com/viewtopic.php?p=81319
681 0
|
2月前
|
监控 Java 应用服务中间件
高级java面试---spring.factories文件的解析源码API机制
【11月更文挑战第20天】Spring Boot是一个用于快速构建基于Spring框架的应用程序的开源框架。它通过自动配置、起步依赖和内嵌服务器等特性,极大地简化了Spring应用的开发和部署过程。本文将深入探讨Spring Boot的背景历史、业务场景、功能点以及底层原理,并通过Java代码手写模拟Spring Boot的启动过程,特别是spring.factories文件的解析源码API机制。
107 2
|
25天前
|
存储 设计模式 算法
【23种设计模式·全精解析 | 行为型模式篇】11种行为型模式的结构概述、案例实现、优缺点、扩展对比、使用场景、源码解析
行为型模式用于描述程序在运行时复杂的流程控制,即描述多个类或对象之间怎样相互协作共同完成单个对象都无法单独完成的任务,它涉及算法与对象间职责的分配。行为型模式分为类行为模式和对象行为模式,前者采用继承机制来在类间分派行为,后者采用组合或聚合在对象间分配行为。由于组合关系或聚合关系比继承关系耦合度低,满足“合成复用原则”,所以对象行为模式比类行为模式具有更大的灵活性。 行为型模式分为: • 模板方法模式 • 策略模式 • 命令模式 • 职责链模式 • 状态模式 • 观察者模式 • 中介者模式 • 迭代器模式 • 访问者模式 • 备忘录模式 • 解释器模式
【23种设计模式·全精解析 | 行为型模式篇】11种行为型模式的结构概述、案例实现、优缺点、扩展对比、使用场景、源码解析

热门文章

最新文章

推荐镜像

更多