solidDB Help : Samples : Load-balancing (HotStandby) sample
  
Load-balancing (HotStandby) sample
This sample C application demonstrates the solidDB load-balancing functionality with the HotStandby (HSB) component.
The files for the sample are located in the soliddb-installdir\samples\cluster directory. For general information about running the samples, see Samples.
Load balancing, a feature of Transparent Connectivity (TC), is a method of distributing the load between a pair of HSB servers so that a percentage of the read-only transactions are executed on the secondary server. For more information, see Load balancing in Transparent Connectivity.
The sample consists of an application that you can use to make an ODBC connection to a pair of HSB servers and complete the following steps:
Create a table in the database, and populate the table with data.
Send read and write transactions to the HSB pair, by using a connection that does (and then does not) use load balancing, and use pmon counters to show the load on each HSB server as a result of the activity.
By default the application is configured to connect to the two servers that are supplied with the sample, and uses in-memory tables (M-tables). However, in the makefile for the application, you can amend the connect string in order to connect to other servers or add dbe as a command line parameter in order to use disk-based tables (D-tables).
Running the sample
Run the runme script (runme.bat in Windows), which performs the following actions:
1 Compile the application.
2 Start a pair of HSB servers, and ensure that they are active.
3 Create and populate a table with data, and list the pmon diff output from a number of database counters for both servers.
4 Connect to the HSB pair by using a transparent connection that uses load balancing, execute a number of read and write transactions (with 80/20 read/write distribution), and list the pmon diff output from a number of database counters for both servers.
5 Connect to the HSB pair by using a transparent connection that does not use load balancing, execute a number of read and write transactions (with 80/20 read/write distribution), and list the pmon diff output from a number of database counters for both servers.
Note Between steps 3, 4, and 5, you must press a key to continue the script. You should wait a couple of minutes between each step in order to distinguish between the columns that correspond to each step in the pmon diff output.
The following screen shows an example of the typical output you might get after the final step. The columns that relate to the performance counters that were collected during the test are indicated by the step number.
---------------------------------------------------------------------------
Server A - PRIMARY ACTIVE
              -----3-----         -----4-----       ------5------
Time (sec)      60     60    60     61     60    60     60     4    Total
SQL execute: 574.7  425.6   0.0  687.2  304.6   0.0 1413.3 1867.0   497.6
DBE insert : 576.2  258.8   0.0    0.0    0.0   0.0    0.0    0.0   123.6
DBE update :   0.0   34.4   0.0  232.8  102.4   1.3  287.6  383.2    96.7
DBE fetch  :   1.6    0.0   0.0    5.5    0.0   1.4    0.5    0.0     6.6
-------------------------------------------------------------------------
Server B - SECONDARY ACTIVE
                     --3--        -----4-----           ----5----
Time (sec)             61    60     60     61    60     60     3    Total
SQL execute:          0.1   0.0  473.9  187.0    0.0    0.2   0.6    93.5
DBE insert :          0.0   0.0    0.0    0.0    0.0    0.0   0.0     6.3
DBE update :          0.0   0.0    0.0    0.0    1.3    0.0   0.0     0.2
DBE fetch  :          1.2   0.0    0.0    0.0    2.5    0.0   0.0    15.1
In the columns for step 4 (when the connection used load balancing), you should see a significant number of transactions being executed on the secondary server, whereas in the columns for step 5 (when the connection did not use load balancing), there should be very few transactions on the secondary server.
Go up to
Samples