Oracle RAC Load Balancing enables client-initiated connections to be efficiently allocated to instances with smaller listener loads. There are two ways to achieve client load balancing, one is by configuring the client's load_balance, one by configuring the server-side Remote_listener parameters. Both approaches have advantages and disadvantages, and they are not mutually exclusive, so they can be combined in two ways to achieve more efficient load balancing. This article describes the use of both combinations (Oralce 10g RAC).
For a separate test of client and server load Balancing, refer to:
Oracle RAC Client Connection Load balancer (load Balance)
Oracle RAC server-side Connection load balancing (load Balance)
The tests in this article will be combined with the script and sample used in the previous article, which is a summary of the first two Tests.
First, configuration requirements
[SQL]View PlainCopyprint?
- 1, server-side listener normal service, if the use of non-default 1521 port, please refer to the ORACLE RAC non-default port monitoring configuration (Listener.ora Tnsnames.ora)
- [Email protected]:~> more $ORACLE _home/network/admin/listener.ora
- # LISTENER.ORA.BO2DBP Network Configuration File:/U01/ORACLE/DB/NETWORK/ADMIN/LISTENER.ORA.BO2DBP
- # Generated by Oracle configuration tools.
- LISTENER_BO2DBP =
- (Description_list =
- (DESCRIPTION =
- (address = (PROTOCOL = TCP) (HOST = bo2dbp-vip.2gotrade.com) (PORT = 1521) (IP = First )
- (address = (PROTOCOL = TCP) (HOST = 192.168.7.51) (PORT = 1521) (IP = First )
- )
- )
- SID_LIST_LISTENER_BO2DBP =
- (Sid_list =
- (Sid_desc =
- (Sid_name = Plsextproc)
- (Oracle_home =/u01/oracle/db)
- (program = Extproc)
- )
- )
- [Email protected]:~> lsnrctl Status
- Service "GOBO4" has 2 instance (s).
- Instance "gobo4a", status ready, have 2 handler (s) for the This service ...
- Instance "gobo4b", status ready, have 1 handler (s) for the This service ...
- 2, the server side of the Remote_listener parameter settings
- The connection identifier that requires the Remote_listener parameter has a corresponding entry in the server-side Tnsnames.ora
- Sql> Show Parameter Listener
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- Local_listener string
- Remote_listener string Remote_lsnr_gobo4
- [Email protected]:~> more $ORACLE _home/network/admin/tnsnames.ora
- # Tnsnames.ora Network Configuration File:/u01/oracle/db/network/admin/tnsnames.ora
- # Generated by Oracle configuration tools.
- Remote_lsnr_gobo4 =
- (Address_list =
- (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.7.61) (PORT = 1521))
- (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.7.62) (PORT = 1521))
- )
- 3. Enable Load_balance in client Tnsnames.ora
- [Email protected]:~> tail-11 $ORACLE _home/network/admin/tnsnames.ora
- GOBO4 =
- (DESCRIPTION =
- (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.7.61) (PORT = 1521))
- (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.7.62) (PORT = 1521))
- (load_balance = yes)
- (Connect_data =
- (SERVER = dedicated)
- (service_name = GOBO4)
- )
- )
Second, test load Balance
[Python]View PlainCopyprint?
- #还是使用之前的脚步来进行测试
- #Author: Robinson
- #Blog: http://blog.csdn.net/robinson_0612
- [Email protected]:~> more load_balance.sh
- #!/bin/bash
- For I in {1 ... +}
- Do
- Echo $i
- Sqlplus-s System/[email protected] <<eof
- Select instance_name from v\ $instance;
- Eof
- Sleep 1
- Done
- Exit 0
- [Email protected]:~>./load_balance.sh >load_bal.log
- #查看日志
- [Email protected]:~> grep gobo4a Load_bal.log |wc-l
- 750
- [Email protected]:~> grep gobo4b Load_bal.log |wc-l
- 250
- #查看监听器的日志
- [Email protected]:/u01/oracle/db/network/log> grep Establish Listener_bo2dbp.log |wc-l
- 894
- [Email protected]:/u01/oracle/db/network/log> grep Instance_name=gobo4 Listener_bo2dbp.log |wc-l
- 415
- #从上面的查询中可以得知, the node BO2DBP received a total of 894 connection requests, and 415 connection requests were forwarded by Bo2dbs.
- #因此, actually the number of actual connection requests initiated from the client to BO2DBP is 894-415=479
- #下面来看在节点bo2dbs上的监听日志
- [Email protected]:/u01/oracle/db/network/log> grep Establish Listener_bo2dbs.log |wc-l
- 665
- [Email protected]:/u01/oracle/db/network/log> grep Instance_name=gobo4 Listener_bo2dbs.log |wc-l
- 144
- #从上面的查询中可知, the node Bo2dbs received a total of 665 connection requests, while 144 connection requests were forwarded by BO2DBP.
- #因此, actually the number of actual connection requests initiated from the client to Bo2dbs is 655-144=511
- #从上面的结果可知,
- #基于客户端的连接请求数为节点bo2dbp为479, node Bo2dbs is 511
- #监听器路由到本地实例数目为, node bo2dbp,479-144=335, node bo2dbs,511-415=96
- #远程监听器路由道本地实例的数据为, node BO2DPB is 415, node Bo2dbs is 144
- #监听器路由的概念是指基于服务器端的负载均衡
- #即服务器端的监听器根据自身以及远程监听器的负载情况来确定将当前的连接请求转发到本地或远程, this is the route.
- Ext.: http://blog.csdn.net/leshami/article/details/8072367
Oracle RAC load Balancing test (combined with server-side vs. client)