提高短连接监听性能方法测试
浏览:2228次 出处信息
创建测试脚本
通过在三个会话中同时执行test_login.sh脚本,模拟当数据库多个短连接情况性能
[oracle@xifenfei tmp]$ more test_login.sh #!/bin/bash echo "start login database `date`*********" >>/tmp/test_1.log e=2000 for((i=1;i<=$e;i=i+1)) do /tmp/login_oracle.sh done echo "end login database `date`*********" >>/tmp/test_1.log [oracle@xifenfei tmp]$ more login_oracle.sh #!/bin/bash sqlplus chf/xifenfei@ORA11G_P</dev/null select to_char(sysdate,\'yyyy-mm-dd hh24:mi:ss\') from dual; exit XFF --ORA11G_P根据不同的测试情景指定不同名称
情况1:一个监听情况下
start login database Tue May 1 18:03:32 CST 2012********* start login database Tue May 1 18:03:35 CST 2012********* start login database Tue May 1 18:03:37 CST 2012********* end login database Tue May 1 18:08:20 CST 2012********* end login database Tue May 1 18:08:25 CST 2012********* end login database Tue May 1 18:08:26 CST 2012********* --计算2000个会话登录/查询/推出时间 4:48 4:40 4:49
情况2:三个监听,客户端配置tns负载均衡
--监听配置 LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1521)) ) ) SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = ora11g) (ORACLE_HOME = /u01/oracle/oracle/product/11.2.0/db_1) (SID_NAME = ora11g) ) ) ADR_BASE_LISTENER = /u01/oracle LISTENER1 = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1522)) ) ) SID_LIST_LISTENER1 = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = ora11g) (ORACLE_HOME = /u01/oracle/oracle/product/11.2.0/db_1) (SID_NAME = ora11g) ) ) ADR_BASE_LISTENER1 = /u01/oracle LISTENER2 = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1523)) ) ) SID_LIST_LISTENER2 = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = ora11g) (ORACLE_HOME = /u01/oracle/oracle/product/11.2.0/db_1) (SID_NAME = ora11g) ) ) ADR_BASE_LISTENER2 = /u01/oracle --tns配置 ORA11G_M = (DESCRIPTION = (LOAD_BALANCE=ON) (FAILOVER=ON) (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1522)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1523)) (LOAD_BALANCE = yes) ) (CONNECT_DATA = (SERVER=DEDICATED) (SERVICE_NAME = ora11g) ) ) --测试结果 start login database Tue May 1 17:51:45 CST 2012********* start login database Tue May 1 17:51:49 CST 2012********* start login database Tue May 1 17:51:51 CST 2012********* end login database Tue May 1 17:55:58 CST 2012********* end login database Tue May 1 17:56:06 CST 2012********* end login database Tue May 1 17:56:09 CST 2012********* --计算2000个会话登录/查询/推出时间 4:13 4:17 4:18
情况2:使用常驻连接池DRCP(11g新特性)
--启动默认DRCP SQL> exec dbms_connection_pool.start_pool(); PL/SQL procedure successfully completed. --tns配置 ORA11G_P = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1521)) ) (CONNECT_DATA = (SERVER=POOLED) --注意 (SERVICE_NAME = ora11g) ) ) --执行结果 start login database Tue May 1 18:19:58 CST 2012********* start login database Tue May 1 18:20:01 CST 2012********* start login database Tue May 1 18:20:03 CST 2012********* end login database Tue May 1 18:23:16 CST 2012********* end login database Tue May 1 18:23:19 CST 2012********* end login database Tue May 1 18:23:21 CST 2012********* --计算2000个会话登录/查询/推出时间 3:16 3:18 3:19
总结
如果在数据库短连接过程中发现监听是瓶颈的时候,可以考虑使用多个监听+tns 负载均衡,从一定程度上缓解监听瓶颈.如果是11g数据库可以考虑使用其心功能DRCP,从而很大程度上提高短连接过程中数据库的效率.因为DRCP还属于11g的新功能稳定性不知道如何?使用该功能前,请一定要做好相关测试工作.如有可能还是建议从应用层面尽可能的使用长连接,提高数据库会话效率.
建议继续学习:
- 各种浏览器审查、监听http头工具介绍 (阅读:6216)
- Js事件监听封装(支持匿名函数) (阅读:3578)
- 网络方面一些经验 (阅读:3156)
- 在 JavaScript 中监听 IME 键盘输入事件 (阅读:2364)
- 社会化媒体:监听和衡量 (阅读:1964)
- jRaiser揭秘――事件监听兼容处理 (阅读:1735)
- Oracle 启动监听命令 (阅读:1729)
- 入门基础:浅析Oracle监听器安装与配置 (阅读:1726)
QQ技术交流群:445447336,欢迎加入!
扫一扫订阅我的微信号:IT技术博客大学习
扫一扫订阅我的微信号:IT技术博客大学习
文章信息
- 作者:惜分飞 来源: 惜分飞
- 标签: 监听 短连接
- 发布时间:2012-05-12 22:28:38
建议继续学习
近3天十大热文
- [66] Oracle MTS模式下 进程地址与会话信
- [65] Go Reflect 性能
- [64] 如何拿下简短的域名
- [60] android 开发入门
- [59] 图书馆的世界纪录
- [59] 【社会化设计】自我(self)部分――欢迎区
- [58] IOS安全–浅谈关于IOS加固的几种方法
- [54] 视觉调整-设计师 vs. 逻辑
- [48] 读书笔记-壹百度:百度十年千倍的29条法则
- [47] 界面设计速成