13.2.1 Example of Connection Load Balancing for Shared Server Configuration

Figure 13-1 shows an Oracle RAC shared server database with two instances, sales1 and sales2, of the same service, sales.us.example.com. The instances sales1 and sales2 reside on computers sales1-server and sales2-server, respectively. Instance sales1 has one dispatcher and instance sales2 has two dispatchers. Listeners named listener run on nodes 1 and 2. The listener attribute in the DISPATCHERS parameter has been configured to allow for service registration of information to both listeners.

Figure 13-1 Load Balancing Environment for a Shared Server Configuration

Description of Figure 13-1 follows
Description of "Figure 13-1 Load Balancing Environment for a Shared Server Configuration"

In this example, sales2-server is the least loaded node, sales2 is the least loaded instance, and dispatcher2 is the least loaded dispatcher. The following load information is registered.

  • The one minute load average for each instance is 600 for sales1 and 400 for sales2. This can happen if more processing is required on sales1-server.

  • The number of connections to each instance is 200 for sales1 and 300 for sales2.

  • The number of dispatcher connections to each instance is 200 for dispatcher1, 100 for dispatcher2, and 200 for dispatcher3.

  • The number of connections to sales1 (200) is the same as that of its only dispatcher, dispatcher1.

  • The number of connections on sales2 (300) is the sum of the connections on its two dispatchers, dispatcher2 (100) and dispatcher3 (200).

The listeners_sales value in (LISTENER=listeners_sales) is resolved through a local tnsnames.ora file on both servers as follows:

listeners_sales= 
 (DESCRIPTION= 
   (ADDRESS_LIST=
     (ADDRESS=(PROTOCOL=tcp)(HOST=sales1-server)(PORT=1521))
     (ADDRESS=(PROTOCOL=tcp)(HOST=sales2-server)(PORT=1521))))

Based on the environment, the following actions occur. The numbered actions correspond to the arrows shown in Figure 13-2:

  1. LREG processes for instances sales1 and sales2 register with both listeners. The listeners are updated dynamically on the load of the instances and dispatchers.

  2. The client sends a connect request. A connect descriptor is configured to try each protocol address randomly until one succeeds:

    sales.us.example.com= 
     (DESCRIPTION= 
      (LOAD_BALANCE=on)
      (FAILOVER=on)
      (ADDRESS=(PROTOCOL=tcp)(HOST=sales1-server)(PORT=1521))
      (ADDRESS=(PROTOCOL=tcp)(HOST=sales2-server)(PORT=1521))
      (CONNECT_DATA=(SERVICE_NAME=sales.us.example.com)))
    

    The listener on sales1-server was randomly chosen to receive the client connect request.

    The listener on sales1-server compares the load of the instances sales1 and sales2. The comparison takes into account the load on nodes sales1-server and sales2-server, respectively. Because sales2-server is less loaded than sales1-server, the listener selects sales2-server over sales1-server.

  3. The listener compares the load on dispatchers dispatcher2 and dispatcher3. Because dispatcher2 is less loaded than dispatcher3, the listener redirects the client connect request to dispatcher2.

  4. The client connects directly to dispatcher2.

Figure 13-2 Load Balancing Example for a Shared Server Configuration

Description of Figure 13-2 follows
Description of "Figure 13-2 Load Balancing Example for a Shared Server Configuration"