Technical Blog Post
Abstract
50 DB2 Nuggets #4 : Tech Tip - Explaining Blocked Transaction on HADR Primary - Brewer's CAP Theorem
Body
- Consistency (all nodes see the same data at the same time)
- Availability (a guarantee that every request receives a response about whether it was successful or failed)
- Partition tolerance (the system continues to operate despite arbitrary message loss or failure of part of the system)
Figure 1. Venn Diagram above shows that there can be only 2 of Consistency(C), Availability (A) or Partition tolerance(P) at a given time
Consistency (C) | Data is the SAME on Primary and Standby |
Availability (A) | Clients are ALWAYS able to connect and get a response (i.e no blocking) |
Partition Tolerance (P) | Network/Communication failure (think of Network Latency or Not receiving an ACK from Standby where required) |
Sync Mode | Sync Mode Implication on Standby | Relation to CAP |
SYNC | logs have been written to disk on Standby as well | Highest C (Data guaranteed on Standby) |
NEARSYNC | Logs are received into memory on Standby | More C |
ASYNC | Logs sent to the Standby on the Network (Don't wait for ACK) | More A |
SUPERASYNC | Don't wait for Standby!! | Highest A (No guarantee) |
Figure 2: Shows the various sync modes
Config Parameter | Config Implication | Relation to CAP |
HADR_TIMEOUT | How long to wait before considering communication failure. Till we reach this time we are still considered PEER | More C |
HADR_PEER_WINDOW | In case of communication failure, how long to wait before actually breaking the connection | More C |
HADR_PEER_WAIT_LIMIT | How long to wait before disconnecting Primary and Standby if transaction are BLOCKED on the Primary | More A |
When both HADR_PEER_WINDOW and HADR_PEER_WAIT_LIMIT are set:
The maximum time before Primary disconnects from Standby = HADR_PEER_WINDOW + HADR_PEER_WAIT_LIMIT
Config Parameter | Parameter Implication |
DB2_HADR_BUF_SIZE | For increasing the HADR standby log receive buffer size |
DB2_HADR_SOSNDBUF | Maximizing TCP throughput |
DB2_HADR_SORCVBUF | Buffering for HADR log shipping |
References:
http://www.cs.berkeley.edu/~brewer/cs262b-2004/PODC-keynote.
http://berb.github.io/diploma-thesis/community/061_challenge.html
UID
ibm11141432