Help Q Replication and Event Publishing

Synchronizing Q Apply across multiple receive queues

When you use multiple receive queues to replicate a workload, you can synchronize the apply process across receive queues to ensure that a time-consistent point can be restored, even if data is lost for one of the queues, before switching the workload to a standby site for unplanned outages.

This function is useful only for disaster recovery and only if you use more than one receive queue to replicate the tables that need to be recovered.

At the highest level, synchronizing one or more Q Apply programs across multiple receive queues involves two concepts:

consistency groups
All tables that are replicated by using the same replication queue map. The Q Apply program maintains transactional consistency for this set of tables by applying dependent transactions in the source commit order and applying other transactions in parallel. A Q Apply program preserves consistency per receive queue.
multiple consistency group
A set of consistency groups that are used for replicating a workload. Replication for all consistency groups can be synchronized to ensure that data loss for any consistency group does not prevent restoring transaction consistency on a common timestamp before a failover.

You define a multiple consistency group name and assign the group to a set of queue maps by using the ASNCLP command-line program. When the queue maps share a common multiple consistency group name, you can enable synchronized apply across the receive queues. The synchronization can be dynamically turned on and off.

When you enable synchronized apply, you can:

IBM® GDPS® active/active continuous availability supports multiple consistency groups for a workload and exploits the synchronized apply function that is provided by Q Replication. All GDPS operations on a workload are carried out for each consistency group that is processing the workload. For example, a STOP REPLICATION command for a workload operates on all replication queue maps (consistency groups) that are used for replicating the tables that are modified by the workload.

The following sections provide more detail about synchronized apply processing:

How the apply process is synchronized

Messages from the Q Capture program that contain replicated data also include the log sequence number (LSN) of the DB2® commit at the source expressed in UTC (Universal Time Coordinate, also referred to as GMT or Greenwich Mean Time). The Q Apply browser thread, which processes messages from a receive queue, reads ahead transactions until its memory fills. The browser thread then reports the maximum DB2 commit LSN that is available in the receive queue to all other Q Apply programs that participate in the multiple consistency group.

The maximum commit point for each consistency group is stored in the ASN.IBMQREP_MCGSYNC control table. One such table exists per data-sharing group. Each Q Apply program in a group then uses the ASN.IBMQREP_MCGSYNC table to determine if data can safely be applied.

Each Q Apply program applies transactions up to the DB2 source commit LSN that is available for all consistency groups. Meanwhile, the Q Apply programs continue to read ahead to find the next maximum commit LSN that is available.

When no changes are available to replicate from the source for the tables in a consistency group, the Q Capture program sends a heartbeat message that contains the last commit LSN that was detected in the DB2 log or the current time if Q Capture reached the end of the log. Heartbeat messages must be enabled in Q Capture to use apply synchronization; otherwise replication would be suspended when there are no transactions to replicate for any of the consistency groups.

By using this method, all Q Apply programs in a multiple consistency group are synchronized on a common source commit LSN sequence. Data is not applied unless timestamps are received on all receive queues for all Q Apply programs. Data is transaction-consistent on a common timestamp across all consistency groups for failover.

Synchronization modes

When you create a multiple consistency group, you can select between two modes of Q Apply synchronization:

Unbridled
The default mode, this option instructs Q Apply programs to apply the data as soon as it has been received for all consistency groups up to a common maximum commit timestamp, even if one Q Apply is behind (for example waiting on a database lock). Data consistency still can be established before failover when all Q Apply programs are done processing their receive queues. This mode allows for more variation in data currency between consistency groups until all Q Apply programs catch up.
In step
Q Apply programs do not apply transactions if the oldest commit point for one consistency group is more than n milliseconds behind any other consistency group. A slow Q Apply slows all Q Apply programs even if data has been received for all Q Applys. This mode reduces the effect of replication latency differences between consistency groups.

Administering apply synchronization across receive queues

You can set up apply synchronization by using the ASNCLP command-line program. You can use the MODIFY command to start and stop synchronization of the group and to purge messages from a receive queue after a disaster or for cleaning up your environment after testing a new replication configuration.

ASNCLP command-line program
You use the CREATE MULTIPLE CONSISTENCY GROUP, ALTER MULTIPLE CONSISTENCY GROUP, and DROP MULTIPLE CONSISTENCY GROUP commands in the ASNCLP program to create, set options for, or remove multiple consistency groups.

Defining a multiple consistency group name adds a row to the IBMQREP_MCGPARMS control table, where the synchronization mode and synchronization interval are also stored.

After you define a multiple consistency group, you assign a name to each individual consistency groups (each represented by a replication queue map) by using the ADD TO MCG keywords in the CREATE REPLQMAP command or ALTER REPLQMAP command. Adding a consistency group inserts a row into the IBMQREP_MCGSYNC table, sets the consistency group state to N (new), and adds the value for MCGNAME to the IBMQREP_SENDQUEUES and IBMQREP_RECVQUEUES tables, which store options for replication queue maps.

MODIFY command
After you have defined the consistency group, you start synchronization by using the mcgsyncon command or by issuing a startq command.

You can use the mcgsyncoff command to stop synchronization for an individual consistency group.

Another MODIFY subcommand, purgeq, can be used for purging stranded messages from a receive queue after a disaster, or for cleaning up a test environment.

Monitoring the status of Q Apply synchronization

A new control table, IBMQREP_MCGMON, records a history of synchronization delays and status for the individual consistency groups. Each Q Apply program has its own IBMQREP_MCGMON table and updates it at an interval that is specified by the Q Apply monitor_interval parameter (this same parameter controls the update interval for the IBMQREP_APPLYMON table).

In addition, columns are added to the IBMQREP_APPLYMON table to help identify the cause of any delays for a single consistency group. For example, you can determine whether the group is delayed because it is waiting for data from other consistency groups to arrive at the target while running in synchronized mode, or because of DB2 performance issues at the target that might be caused by I/O or CPU delay, lock contention, or other factors.

The new columns help you break down Q Apply latency into multiple elements, which add up to the overall latency statistic, as the following formula shows:

APPLY_LATENCY = DEPENDENCY_DELAY + MCGSYNC_DELAY + WORKQ_WAIT_TIME + 	RETRY_TIME + DBMS_TIME

You can use the Q Replication Dashboard to view the breakdown of Q Apply latency from the Queues tab. You can also view performance statistics in IBMQREP_MCGMON and IBMQREP_APPLYMON from the Control Tables and SQL tab, and use the statistics to generate performance graphs.

Enabling Q Replication for GDPS active-active with multiple consistency group workloads

To use a Q Replication configuration that includes multiple consistency groups with GDPS active/active continuous availability, follow these guidelines:



Send your feedback | Information roadmap | The Q+SQL Replication Forum

Update icon Last updated: 2013-10-25