HADR Calculator Command Line Options

This topic describes the command line options you can use with HADR calculator.

The HADR calculator is a perl script. On UNIX systems, run the calculator directly with "x" permission. On Windows, run the calculator as "perl hadrCalculator.pl <arguments>".

Run hadrCalculator.pl with no argument or with "-help" argument to get the following usage command syntax:

+----------------------------------------------------------------------------+
| IBM DB2 HADR Calculator V1.0 |
| Licensed Material, Property of IBM. |
| Copyright IBM Corp. 2013. All Rights Reserved. |
+----------------------------------------------------------------------------+
Usage: hadrCalculator.pl [options] <inputFile1> <inputFile2> ... <inputFileN>

The HADR calculator annotates the db2logscan output with a theoretical HADR data rate. When no input file is specified, stdin is read, and the output is written to stdout.

Note: The HADR calculator uses Perl library functions to parse the command line. Some Perl packages may require a leading 0 for decimals. For example, it may reject ".1", but accept "0.1". However, some packages accept both formats. If the value ".1" is invalid, try "0.1" instead.
When you provide the synchronization mode, network mode and log disk speed to the script, it will compute the logging rate in the specified synchronization modes. Both primary and standby log disks are assumed by the tool to have the same speed.
Note: You can choose to implement HADR using different hardware (ie. slower performing on the standby). So a full modelling should allow user to input different disk performances on primary vs standby.

The HADR calculator computes the logging rate of the peer state for SYNC,NEARSYNC, and ASYNCmodes, where log writing can be slowed down by log shipping.

For SUPERASYNC mode, the HADR calculator computes the logging rate of the remote catchup state, as HADR does not enter the peer state in this mode.

Command Line Options

Some command line options may include either string, integer, or float numbers as values. These values are represented as follows:

  • <s> indicates a string value
  • <n> indicates an integer value
  • <f> indicates a float number
Command Line Option Command Line Option Description
-sync mode <s> This option specifies one or more HADR synchronization mode.

Multiple modes can be specified as through a comma delimited list.

The default delimited list is "SYNC,NEARSYNC,ASYNC".

-network <f1> <f2> Specify primary-standby network speed as <f1> MBytes/sec with round trip time of <f2> second.
-disk <f1> <f2> Specify disk write speed as <f1> MBytes/sec with overhead of <f2> second per write.

Using HADR Calculator for Wide Area Network (WAN)

The following is a sample output from the HADR calculator used by a Wide Area Network. In this example:
  • The network speed is 10MB/second with a 100 millisecond round trip.
  • Medium to heavy impact to applications is predicted for both SYNC and NEARSYNC modes.
  • No impact is predicted for the ASYNC mode.
hadrCalculator.pl: Network speed 10 MB/s, .1 second round trip time
hadrCalculator.pl: Disk speed 200 MB/s, .001 second overhead per write
...

2013-02-09 01:25:38 1.469 MB/s, 8 sec, 8.3 pg/f, 0.022161 sec/f, 15.2 pg/tr, 0.061453 sec/tr, 0.044693 sec/cmt, nOpenTrans 2.9
actual 1.469 MB/s@ 8 pg/f 0.022161 s/f
SYNC ??? 1.424 MB/s@ 44 pg/f 0.120941 s/f, min 0.307 MB/s@ 8 pg/f 0.105566 s/f, max 1.424 MB/s@ 44 pg/f 0.120941 s/f
NEARSYNC ??? 1.469 MB/s@ 44 pg/f 0.117219 s/f, min 0.314 MB/s@ 8 pg/f 0.103242 s/f, max 1.469 MB/s@ 44 pg/f 0.117219 s/f
ASYNC 10.000 MB/s@ 8 pg/f 0.003242 s/f, min 10.000 MB/s@ 8 pg/f 0.003242 s/f, max 10.000 MB/s@ 44 pg/f 0.017219 s/f
...

2013-02-26 15:32:09 7.307 MB/s, 60 sec, 17.6 pg/f, 0.009435 sec/f, 15.9 pg/tr, 0.186589 sec/tr, 0.008580 sec/cmt, nOpenTrans 22.7
actual 7.307 MB/s@ 17 pg/f 0.009435 s/f
SYNC ??? 5.484 MB/s@ 360 pg/f 0.257087 s/f, min 0.627 MB/s@ 17 pg/f 0.109563 s/f, max 5.484 MB/s@ 360 pg/f 0.257087 s/f
NEARSYNC ??? 5.850 MB/s@ 360 pg/f 0.240988 s/f, min 0.643 MB/s@ 17 pg/f 0.106875 s/f, max 5.850 MB/s@ 360 pg/f 0.240988 s/f
ASYNC 10.000 MB/s@ 17 pg/f 0.006875 s/f, min 10.000 MB/s@ 17 pg/f 0.006875 s/f, max 10.000 MB/s@ 360 pg/f 0.140988 s/f
...

2013-02-26 15:36:09 1.363 MB/s, 60 sec, 3.5 pg/f, 0.010018 sec/f, 4.3 pg/tr, 0.102471 sec/tr, 0.012782 sec/cmt, nOpenTrans 32.4
actual 1.363 MB/s@ 3 pg/f 0.010018 s/f
SYNC ?? 1.373 MB/s@ 42 pg/f 0.120146 s/f, min 0.132 MB/s@ 3 pg/f 0.103504 s/f, max 3.362 MB/s@ 139 pg/f 0.161864 s/f
NEARSYNC ?? 1.370 MB/s@ 40 pg/f 0.115874 s/f, min 0.135 MB/s@ 3 pg/f 0.101367 s/f, max 3.524 MB/s@ 139 pg/f 0.154422 s/f
ASYNC 10.000 MB/s@ 3 pg/f 0.001367 s/f, min 10.000 MB/s@ 3 pg/f 0.001367 s/f, max 10.000 MB/s@ 139 pg/f 0.054422 s/f
...

2013-02-26 15:39:05 3.280 MB/s, 56 sec, 6.7 pg/f, 0.007984 sec/f, 15.1 pg/tr, 0.102178 sec/tr, 0.017937 sec/cmt, nOpenTrans 45.0
actual 3.280 MB/s@ 6 pg/f 0.007984 s/f
SYNC ?? 3.283 MB/s@ 134 pg/f 0.159649 s/f, min 0.250 MB/s@ 6 pg/f 0.104879 s/f, max 6.737 MB/s@ 679 pg/f 0.393973 s/f
NEARSYNC ?? 3.280 MB/s@ 124 pg/f 0.148815 s/f, min 0.255 MB/s@ 6 pg/f 0.102617 s/f, max 7.263 MB/s@ 679 pg/f 0.365430 s/f
ASYNC 10.000 MB/s@ 6 pg/f 0.002617 s/f, min 10.000 MB/s@ 6 pg/f 0.002617 s/f, max 10.000 MB/s@ 679 pg/f 0.265430 s/f
...

Distribution of log write rate (unit is MB/s):
Total 8 numbers, Sum 32.764, Min 1.362, Max 7.306, Avg 4.096
Average rate 4.096 MB/s
REMOTE CATCHUP 10.000 MB/s@ 16 pg/f 0.006250 s/f
Exactly 1.362 1 numbers 12%
Exactly 1.987 1 numbers 12%
...

SYNC Max flush size: predicted 360 pages, workload max 1126 pages
NEARSYNC Max flush size: predicted 360 pages, workload max 1126 pages
ASYNC Max flush size: predicted 17 pages, workload max 1126 pages

Network and Disk Speed

At the beginning, the calculator prints out network and disk speed as verification of command line arguments:

hadrCalculator.pl: Network speed 10 MB/s, .1 second round trip time
hadrCalculator.pl: Disk speed 200 MB/s, .001 second overhead per write

Computed Logging Rate

HADR calculator annotates the logging rate lines from db2logscan with computed rate of various HADR sync modes (other input lines are printed as is). For example:

actual           1.363 MB/s@   3 pg/f 0.010018 s/f
SYNC       ??    1.373 MB/s@  42 pg/f 0.120146 s/f, min   0.132 MB/s@   3 pg/f 0.103504 s/f, max   3.362 MB/s@ 139 pg/f 0.161864 s/f
Note: The "actual" line reprints selected fields from the input, for easy comparison to the logging rate of the SYNC mode.

Target Rate Group, Min Rate Group, and Max Rate Group

Each synchronization mode consists of three groups of numbers, known as the target rate group, the min rate group, and the max rate group. Each group has the following information:
  • data rate (MB/s)
  • flush size (pg/f)
  • flush duration (s/f)

In the above example of the group, this would mean that you get the data rate of 3.283MB/s at the flush size of 134pg/f, and that each flush takes 0.159649 s/f:

 3.283 MB/s@ 134 pg/f 0.159649 s/f

The numbers within the target rate group attempt to produce the same logging rate as the actual rate, therefore minimizing impact to applications. However, even when the actual rate can be produced, flush size and duration may be different from the actual rate and there may be some impact to application behavior.

The numbers within the min group describe the minimum logging rate that any synchronization mode can produce, and it is calculated using the actual flush size. If the logging rate is higher than actual (flush duration is shorter than actual), then this synchronization mode will not have impact to applications. If the rate is lower than actual (flush duration is longer than actual), then there may still be some impact even if the target rate group can match actual logging rate.

The numbers within the max group describe the maximum logging rate that the synchronization mode can produce, and it is calculated using the maximum flush size of "transaction_size * nOpenTrans". If the actual rate is higher than this rate, the system will hit performance cap in this mode.

Max Flush Size

At the end of calculator output, max flush size of the "target" group (shown as "predicted") and "max" group (shown as "workload max") over all annotated logging rate lines are printed.

Sample output:
SYNC       Max flush size: predicted 360 pages, workload max 1126 pages
The max flush size values should be considered for the logbufsz database configuration parameter as well as the DB2_HADR_SOSNDBUF and DB2_HADR_SORCVBUF register variables. These configurations should be set to at least the "predicted" flush size, and ideally set to the "workload max" flush size.

Remote Catchup Speed

In a remote catchup state, the primary database log write thread writes logs without waiting for replication to the standby database. The primary database HADR thread reads log data from log files and sends it to the standby database.

Distribution of log write rate (unit is in MB/s):
Total 8 numbers, Sum 32.764, Min 1.362, Max 7.306, Avg 4.096
Average rate 4.096 MB/s
REMOTE CATCHUP ?? 5.000 MB/s@ 16 pg/f 0.012500 s/f
Exactly 1.362      1 number   12%
Exactly 1.987      1 number   12%

The average rate within a distribution section displays the average logging rate of the application - the average speed of the log data produced by the primary database.

The REMOTE CATCHUP value displays the projected speed of shipping logs from the primary database to the standby database when in remote catchup state. These two lines allows you to assess the time it takes for HADR to complete the log catchup phase, in order to reach the PEER state.

The HADR calculator alerts you when it detects the remote catchup log shipping rate is slower than the average log producing rate, by the use of "?" marker, using the following for different levels of alert:
  • No "?" - no alert indicates that the average log shipping rate is lower than 50% of the remote catchup rate.
  • "?" - this alert indicates that the average log shipping rate is between 50% and 75% of the remote catchup rate. This indicates that the catchup may be slow.
  • "??" - this alert indicates that the average log shipping rate is between 75% and 100% of the remote catchup rate. This indicates that catchup will be slow.
  • "???" - this alert indicates that the average log shipping rate is higher than the remote catchup rate. This indicates that catchup will be slow or unreachable..