11g RAC LBA load balancing advisory
来源:互联网 发布:网络变声电话 编辑:程序博客网 时间:2024/04/28 01:26
关于LBA的使用可参考http://www.oracle.com/technetwork/cn/articles/database-performance/oracle-rac-connection-mgmt-1650424-zhs.html,本文主要验证部分参数的使用
1.实验环境
环境:
[oracle@Rac1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Tue Oct 13 15:17:52 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> select name from gv$database;
NAME
---------
RACDB
RACDB
SQL> select inst_id,instance_name,version from gv$instance;
INST_ID INSTANCE_NAME VERSION
---------- ---------------- -----------------
1 racdb1 11.2.0.1.0
2 racdb2 11.2.0.1.0
SQL>
service环境:使用默认的数据库名字相同的service
SQL> select name,goal,dtp,enabled,aq_ha_notifications,clb_goal
from dba_services a where a.NETWORK_NAME='racdb'; 2
NAME GOAL D ENA AQ_ CLB_G
---------- ------------ - --- --- -----
racdb NONE N NO NO SHORT
tnsnames:
RACDB_LB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = racscan)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = racdb)
)
)
测试脚本:
[oracle@ASM ~]$ more test.sh
#!/bin/sh
#Usage:test racdb 400
count=0
while [ $count -lt $2 ]
do
count=`expr $count + 1`
sqlplus -s panyc/panyc@$1 @./test.sql
#sleep 1
done
[oracle@ASM ~]$ more test.sql
select instance_name from v$instance;
exit
[oracle@ASM ~]$ more sess_count.sh
echo 'racdb1:' `grep racdb1 test.log|wc -l`
echo 'racdb2:' `grep racdb2 test.log|wc -l`
2.参数/字段说明
desc gv$servicemetric;
desc dba_services;
GOODNESS 表示这个节点成为 Server 端 Connect Time Load Balancing 的目标节点的可能性,这个值越高,可能性就越低。即这个 service 在某个节点上的 GOODNESS 的值越大,则表明这个节点的负载越重,这个节点成为 Server 端 Connect Time Load Balancing 的目标节点的可能性就越低。
DELTA 表示当节点增加了一个额外的 session 后对负载增加情况的估算。
FLAGS 是一个标志位,它的各个值的含义如下:
0 – all good
1 – blocked
2 – crossed threshold
4 – goodness unknown (usually when no sessions connected)
CLB_GOAL :每个 service 所对应的 CLB_GOAL 实际上表示 Client Load Balance Goal,它的值要么为 LONG,要么为 SHORT,默认值是 LONG。
LONG 和 SHORT 的区别是:LONG 是 CLB_GOAL 的缺省值,通常用于那些需要长时间保持的连接,比如一些第三方的连接池或者 SQL*Form 应用;而 SHORT 则通常用于那些连接持续时间较短的应用,如果使用了支持订阅 LBA(Load Balancing Advisory)的连接池,则应该把 CLB_GOAL 的值设为 SHORT。
当GLB_GOAL是LONG(默认值),表示适用于长连接的session,参数goodness=实际的连接session数,delta=1,表示每增加一个session,goodness加1
GOAL 所对应的三个值 THROUGHPUT、SERVICE_TIME 和 NONE 的区别是:
THROUGHPUT:表示判断负载的依据是吞吐量(THROUGHPUT),这通常用于那些并发的 transaction 具有相似的完成时间、相似的完成速率的系统,比如在线交易系统;
SERVICE_TIME:表示判断负载的依据是响应时间(response time),这通常用于那些并发的 transaction 具有不同的完成时间、不同的完成速率的系统,比如在线购物系统,不同的人完成一次在线购物,所购买的产品、所耗费的时间可能有很大差异;
NONE:表示不启用 LBA。
3.测试CLB_GOAL参数对负载均衡的影响
将clb_goal参数设置为long:
SQL> exec dbms_service.modify_service(service_name => 'racdb',clb_goal => dbms_service.clb_goal_short);
PL/SQL procedure successfully completed.
测试节点登陆情况
[oracle@ASM ~]$ ./test.sh racdb_lb 200 > test.log
[oracle@ASM ~]$ ./sess_count.sh
racdb1: 113
racdb2: 87
[oracle@ASM ~]$ ./test.sh racdb_lb 200 > test.log
[oracle@ASM ~]$ ./sess_count.sh
racdb1: 124
racdb2: 76
[oracle@ASM ~]$ ./test.sh racdb_lb 200 > test.log
[oracle@ASM ~]$ ./sess_count.sh
racdb1: 123
racdb2: 77
将clb_goal参数设置为short
SQL> exec dbms_service.modify_service(service_name => 'racdb',clb_goal => dbms_service.clb_goal_long);
PL/SQL procedure successfully completed.
测试节点登陆情况
[oracle@ASM ~]$ ./test.sh racdb_lb 200 > test.log
[oracle@ASM ~]$ ./sess_count.sh
racdb1: 185
racdb2: 15
[oracle@ASM ~]$ ./test.sh racdb_lb 200 > test.log
[oracle@ASM ~]$ ./sess_count.sh
racdb1: 195
racdb2: 5
[oracle@ASM ~]$ ./test.sh racdb_lb 200 > test.log
[oracle@ASM ~]$ ./sess_count.sh
racdb1: 192
racdb2: 8
4.结论
开启负载均衡只需要将CLB_GOAL参数设置为short,甚至long也可以有些许负载均衡。
开启LBA需要CLB_GOAL参数设置为short,并将GOAL设置为非none值,两个条件
暂时无法通过查询判断service是否已经开启了LBA,只能通过dba_service中的goal/clb_goal判断
暂时无法测试GOAL=service_time/throughout 对LBA,对负载均衡的影响
启用LBA的意义?(配合FAN事件实现runtime connection load balance)
0 0
- 11g RAC LBA load balancing advisory
- 10g & 11g Configuration of TAF(Transparent Application Failover) and Load Balancing [ID 453293.1]
- 10g & 11g Configuration of TAF(Transparent Application Failover) and Load Balancing
- 10g & 11g Configuration of TAF(Transparent Application Failover) and Load Balancing [ID 453293.1]
- 10g & 11g Configuration of TAF(Transparent Application Failover) and Load Balancing [ID 453293.1]
- All about TAF - 10g&11g :Configuration of TAF(Transparent Application Failover) and Load Balancing
- 10g & 11g :Configuration of TAF(Transparent Application Failover) and Load Balancing (文档 ID 453293.1
- Load Balancing
- load balancing
- Load Balancing
- Load Balancing
- Load Balancing Web Applications
- Server Load Balancing
- Apache + Tomcat + Load Balancing
- Load balancing (computing)
- Hbase Load Balancing
- hdu 2850 Load Balancing
- Runtime Connection Load Balancing
- OOM(out_of_memory) killer分析
- Android SDK国内镜像
- Myeclipse 全局搜索的时候报错problems encountered during text search
- vss简介
- [Android UI] graphics
- 11g RAC LBA load balancing advisory
- spring中注解的实现原理,帮助理解@autowired @resource区别
- Median of Two Sorted Arrays - Leetcode
- 深入理解Android之Gradle
- WIN 系统操作快捷键大全
- 高端内存永久映射分析
- Apache Traffic Server编译安装
- ubuntu源模板官方说明
- Unity中的特殊文件夹