8.2 Load Balancing

Team-Fly    

 
Oracle Net8 Configuration and Troubleshooting
By Jonathan  Gennick , Hugo Toledo
Table of Contents
Chapter 8.  Net8 Failover and Load Balancing


Load balancing refers to the practice of distributing a workload over multiple resources. Its specific application in an Oracle environment is with respect to Oracle Parallel Server. When OPS is used, you have multiple instances running on multiple nodes all accessing the same physical database. This situation is illustrated in Figure 8.7.

Figure 8.7. A load-balanced OPS environment
figs/n8c_0807.gif

This figure illustrates an environment where the client connections have been distributed evenly among the various nodes. Assuming that each client represents a similar amount of work, this even distribution is ideal. You don't want to have one machine sitting idle while another is overloaded.

8.2.1 Client Load Balancing

Load balancing can be done at either the client or the server level. Net8 supports client load balancing, which is achieved by giving each client a list of possible nodes for a given Net8 connection. When the client attempts a connection, the Net8 software on the client randomly chooses from that list.

Client node balancing is configured at the net service name level. It is similar to a failover configuration in that it makes use of multiple addresses in an address list, or of multiple descriptions in a description list. The major difference is that when load balancing is done, Net8 tries addresses or descriptions in random order rather than in sequential order.

When client load balancing is used, the best that can be hoped for is a random distribution of clients to nodes. Only with server load balancing can you take into account the actual workload on each node when you distribute new connections.

8.2.1.1 Load balancing with multiple listener addresses

One way to configure client load balancing is to supply multiple listener addresses in one address list. Load balancing is not on by default, so you also must specify (LOAD_BALANCE = true) in order to enable that feature. For example:

 prod.gennick.org =   (DESCRIPTION =     (ADDRESS_LIST =       (LOAD_BALANCE = true)       (FAILOVER = true)       (ADDRESS = (PROTOCOL = TCP)(HOST = prod01.gennick.org)(PORT = 1521))       (ADDRESS = (PROTOCOL = TCP)(HOST = prod02.gennick.org)(PORT = 1521))       (ADDRESS = (PROTOCOL = TCP)(HOST = prod03.gennick.org)(PORT = 1521))     )     (CONNECT_DATA =       (SERVICE_NAME = prod.gennick.org)     )   ) 

Because load balancing has been enabled, Net8 will randomly choose one of the three addresses to use in connecting to an instance. If two clients connect, odds are good that they will connect to two different instances, thus distributing the workload.

Because failover has also been enabled, Net8 will try another address if the first one fails. By changing the failover setting to false, you can configure Net8 to try just one address selected at random. If a connection cannot then be made to that one address, Net8 will stop trying and will return an error to the client. This is not a particularly useful option. Most of the time when you enable load balancing, you'll want to enable failover as well.

8.2.1.2 Load balancing with multiple descriptions

Load balancing may also be accomplished using multiple descriptions in a description list. This allows you to use different CONNECT_DATA settings for each possible connection path .

When multiple descriptions are used for a net service name, load balancing is enabled by default.

The following example causes load balancing and failover to occur between the two nodes prod01.gennick.org and prod02.gennick.org :

 prod.gennick.org =   (DESCRIPTION_LIST =     (FAILOVER = true)     (LOAD_BALANCE = true)     (DESCRIPTION =       (ADDRESS_LIST =         (ADDRESS = (PROTOCOL = TCP)(HOST = prod01.gennick.org)(PORT = 1521))       )       (CONNECT_DATA =         (SERVICE_NAME = prod.gennick.org)       )     )     (DESCRIPTION =       (ADDRESS_LIST =         (ADDRESS = (PROTOCOL = TCP)(HOST = prod02.gennick.org)(PORT = 1521))       )       (CONNECT_DATA =         (SERVICE_NAME = prod.gennick.org)       )     )   ) 

The default setting for load balancing is reversed when a description list is used. Normally, load balancing is off by default, but when a description list is used, load balancing is on by default. The purpose of this seeming inconsistency is to provide compatibility with previous releases of Net8.

8.2.1.3 Load balancing and Net8 Assistant

If you're using Net8 Assistant, load balancing is configured from the same Address List Options dialog you use to configure failover. You access this dialog by clicking the Advanced button near the address tabs for a net service name, as shown in Figure 8.8. The annotations in the figure describe the load balancing options.

Figure 8.8. Using Net8 Assistant to configure load balancing
figs/n8c_0808.gif

Also see Figure 8.4 earlier in this chapter for a description of the failover options.

8.2.1.4 TAF with client load balancing

TAF can be defined for a net service name when load balancing is used in much the same way it's defined when failover is being used. See Section 8.1.2.6 earlier in this chapter .

8.2.2 Listener Load Balancing

In OPS environments where multi-threaded server (MTS) is used, the Net8 listener performs listener load balancing . Listener load balancing refers to the distribution of new connections to different instances by the Net8 listener. Because the listener runs on the server, it can take into account the current load on available instances and dispatchers. New connections are not distributed randomly. Instead, they are routed to dispatchers in such a way as to balance the load across all instances. Figure 8.9 provides an illustration.

8.2.2.1 Prerequisites for listener load balancing

To take advantage of listener load balancing in an OPS environment, you need to do the following:

  • Use multi-threaded server.

  • Make sure that each listener is aware of all MTS dispatchers.

  • Use the INSTANCE_NAME initialization parameter to specify an instance name for each instance.

  • Use the SERVICE_NAMES initialization parameter to specify the service name (or names ) for each instance.

Listener load balancing depends heavily on dynamic service registration. In an OPS environment, you might have several instances supporting the same service (this is shown in Figure 8.9). When a client connects, it must do so by specifying the name of a service. The listener can then connect the client to any instance supporting the requested service.

Clients connect to a service when the SERVICE_NAME attribute is defined in the CONNECT_DATA entry for a net service name. For example:

 (CONNECT_DATA =   (SERVICE_NAME = donna.gennick.org) ) 

Older releases of Oracle required the use of a SID name in the CONNECT_DATA entry to identify the target instance, and it's still not unusual to see CONNECT_DATA entries that specify a SID name. Connections made to a specific SID cannot be load balanced by the listener. The listener can only load balance connections to a service.

To ensure that each listener in your OPS environment is aware of all dispatchers on all nodes, you can list each listener address following the LOCAL_LISTENER parameter in your database parameter file. In the following example, two listener addresses are specified for LOCAL_LISTENER:

 LOCAL_LISTENER = "(ADDRESS_LIST= \ (ADDRESS=(PROTOCOL=TCP)(HOST=prod01.gennick.org)(PORT=1521)) \ (ADDRESS=(PROTOCOL=TCP)(HOST=prod02.gennick.org)(PORT=1521)) \ )" 

When the instance starts, it will register the services that it supports with each of these listeners. As each MTS dispatcher for the instance is started, it also registers itself with each listener in the list. Once this is done, each listener knows about the services and dispatchers available, and listener load balancing occurs automatically.

As an alternative to using the LOCAL_LISTENER parameter, you can use the LISTENER attribute of the MTS_LISTENER parameter. See Chapter 5, for details on specifying that attribute.

8.2.2.2 Listener and client load balancing combined

Listener load balancing is a good feature, but it doesn't totally replace client load balancing. Even if you're depending on listener load balancing to distribute connections to multiple dispatchers, you can still use client load balancing to distribute the load of handling new connections over more than one listener. Figure 8.9 shows conceptually how this can work.

Figure 8.9. Listener and client load balancing combined
figs/n8c_0809.gif

Combine client load balancing with failover, and you can insulate your clients from the failure of any one listener. Should one listener be down, client failover will cause Net8 to choose another address from the list of listener addresses provided for the net service name being used.


Team-Fly    
Top


Oracle Net8 Configuration and Troubleshooting
Oracle Net8 Configuration and Troubleshooting
ISBN: 1565927532
EAN: 2147483647
Year: 2000
Pages: 120

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net