A Replication Server distributes database modifications using messages in ASCII format. Most replication system messages correspond to the delete, insert, update, and function execution operations.
Each table has one message size for inserts or deletes and another for updates. Each function has its own message size. Message sizes are expressed in bytes.
Message sizes for the same type of modification (insert, delete, or update) may vary depending on whether the message is in the inbound or outbound queue.
You can calculate message sizes in bytes for table updates, inserts, and deletes, for functions, and for begin/commit pairs using the formulas presented below. See “Formula components” for a description of the components.
This formula will give you a rough estimate of the upper limit of message size:
InboundMsgSizeupdate = InboundMsgOverhead + ColOverhead + (RowWidth*2)
OutboundMsgSizeupdate = OutboundMsgOverhead + (RowWidth*2) + (NumSites*8)
To get a more precise estimate, use the RowWidthChanged figure in the calculation, as follows:
InboundMsgSizeupdate = InboundMsgOverhead + ColOverhead + RowWidth + RowWidthChanged
OutboundMsgSizeupdate = OutboundMsgOverhead + RowWidth + RowWidthChanged + (NumSites*8)
If you use the minimal columns feature, use this formula to calculate message size:
InboundMsgSizeupdate = InboundMsgOverhead + ColOverhead + (RowWidthChanged*2) + PrimaryKeyWidth
OutboundMsgSizeupdate = OutboundMsgOverhead + (RowWidthChanged*2) + PrimaryKeyWidth + (NumSites*8)
See “Table update calculations” for examples of these calculations.
Use the following formula to calculate message size for table inserts. (This formula also applies if you use the minimal columns feature.)
InboundMsgSizeinsert = InboundMsgOverhead + ColOverhead + RowWidth
OutboundMsgSizeinsert = OutboundMsgOverhead + RowWidth + (NumSites*8)
If you do not use minimal columns, use this formula to calculate message size in table deletes:
InboundMsgSizeinsert = InboundMsgOverhead + ColOverhead + RowWidth
OutboundMsgSizeinsert = OutboundMsgOverhead + RowWidth + (NumSites*8)
If you use minimal columns, use this formula to calculate table deletes:
InboundMsgSizedelete = InboundMsgOverhead + ColOverhead + PrimaryKeyWidth
OutboundMsgSizedelete = OutboundMsgOverhead + PrimaryKeyWidth + (NumSites*8)
Use these formulas to calculate message size for functions:
InboundMsgSizefunction = InboundMsgOverhead + ParameterWidth +(RowWidth*2)
OutboundMsgSizefunction = OutboundMsgOverhead + ParameterWidth + (NumSites*8)
In the formula for inbound message size, RowWidth does not apply to the replicated functions feature because before and after images of replicated functions are not sent to the inbound queue.
Use these formulas to calculate message sizes for begins and commits:
InboundMsgSizebegin = OutboundMsgSizebegin = 250
InboundMsgSizecommit = OutboundMsgSizecommit = 200
The total size of a begin/commit pair is 450 bytes. If typical transactions have many modifications, omit the begin or commit message sizes from your calculations. Their contribution to overall message size is negligible.
In the preceding formulas:
InboundMsgOverhead equals 380 bytes. Each message includes a transaction ID, duplicate detection sequence numbers, and so on.
OutboundMsgOverhead equals 200 bytes. Each message includes a transaction ID, duplicate detection sequence numbers, and so on.
ColOverhead, which applies to the inbound queue only, equals 30 bytes of overhead per column, as follows:
For an update operation without minimal columns:
(NumColumns+NumColumnsChanged) * 30
For an update operation with minimal columns:
((NumColumnsChanged*2)+NumPrimaryKeyColumns) * 30
For an insert operation (with or without minimal columns):
NumColumns * 30
For a delete operation without minimal columns:
NumColumns * 30
For a delete operation with minimal columns:
NumPrimaryKeyColumns * 30
RowWidth is the size of the ASCII representation of the table columns. For example: a char(10) column uses 10 bytes, a binary(10) column uses 22 bytes.
For table updates, the RowWidth is multiplied by 2 because both the before and after images of the row are distributed to the replicate sites.
RowWidthChanged is the width of the changed columns in the row. For example, you have 10 columns with a total RowWidth of 200 bytes. Half of the columns in the row change, giving you a RowWidthChanged measurement of approximately 100 bytes.
NumSites is the number of sites that a message will go to. This matters only when small messages are distributed to many sites and may be insignificant if you do not have many sites. If small, you might want to omit the number of sites factor from the formulas that use it.
ParameterWidth is the size of the ASCII representation of the function parameters.
Begin/Commit Pair is the combined size of the begin message header and the commit trailer, which equals 450 bytes.