RAC中LB实现

LoadBalance实现方式
1、Connection Balancing(技术解决方案)
客户端均衡
客户端tnsnames.ora文件中增加"load_balance=yes"

oracle11gr2特性:
增加connect_timeout和retry_count两个参数,单位为秒,示例:
(CONNECT_TIMEOUT=10)(RETRY_COUNT=3)
Oracle Net waits for 10 seconds to receive a response, after which it assumes a failure. Oracle Net goes through the address list three times before it returns a failure to the client.

服务端均衡
pmon进程收集各节点的负载信息,不仅包括local_listener,也包括remote_listener,然后注册到listener中。
当收到客户端请求时,listener会把连接转向负载最小的节点。这个节点有可能是listener自己所在的节点,也有可能是其它节点。
需要配置remote_listener参数,需要在listener.ora中配置tnsname名称。
注意:在listener.ora配置tnsname名称时,需要去掉sid_list_listener_name条目,这样才能保证listener全部为动态注册的。

2、通过service分散负载(业务解决方案)
把应用按功能模块划分成service,进而把每个service固定在某些rac节点上,从而从根本上解决系统性能问题。

3、11gr2增强
提出了一个Load Balancing Advisory、 Load Balancing Advisory  FAN Events概念。配置完毕Advisory后,数据库会向客户端发布响应的FAN Events,客户端再根据接受到Events进行自定义处理。这部分内容,目前只了解了一些概念,后续再进行细化。
Load Balancing Advisory
By using the Load Balancing Advisory or runtime connection load balancing goals, feedback is built in to the system.
You can configure your environment to use the load balancing advisory by defining service-level goals for each service for which you want to enable load balancing. Configuring a service-level goal enables the load balancing advisory and the publishing of FAN load balancing events for that service.
There are two types of service-level goals for runtime connection load balancing:
■ SERVICE_TIME: Attempts to direct work requests to instances according to response time. Load balancing advisory data is based on elapsed time for work done in the service plus available bandwidth to the service.
#srvctl modify service -d db_unique_name -s online -B SERVICE_TIME -j SHORT
■ THROUGHPUT: Attempts to direct work requests according to throughput. The load balancing advisory is based on the rate that work is completed in the service plus available bandwidth to the service.
#srvctl modify service -d db_unique_name -s sjob -B THROUGHPUT -j LONG

Setting the runtime connection load balancing goal to NONE disables load balancing for the service. You can see the goal settings for a service in the data dictionary by querying the DBA_SERVICES, V$SERVICES, and V$ACTIVE_SERVICES views. You
can also review the load balancing settings for a service using Oracle Enterprise Manager.

Load Balancing Advisory FAN Events
The load balancing advisory FAN events provide metrics for load balancing algorithms. The easiest way to take advantage of these events is to use the runtime connection load balancing feature of an Oracle integrated client such as JDBC,ODP.NET, or Oracle Call Interface. Other client applications can take advantage of FAN programatically by using the Oracle Notification Service application programming interface (ONS API) to subscribe to FAN events and execute event-handling actions upon receipt.

Oracle Clients That Are Integrated with Fast Application Notification
Oracle has integrated FAN with many of the common client application environments that are used to connect to Oracle RAC databases. Therefore, the easiest way to use FAN is to use an integrated Oracle Client.

Enabling JDBC Clients for Fast Connection Failover

Enabling JDBC Clients for Runtime Connection Load Balancing
Runtime connection load balancing requires that FCF is enabled and configured properly.

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

转载于:http://blog.itpub.net/95233/viewspace-764632/

你可能感兴趣的:(RAC中LB实现)