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.
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.