Message Sizes

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.

There are formulas you can use to calculate message sizes in bytes for table updates, inserts, and deletes, for functions, and for begin/commit pairs.

Table Updates

For a rough estimate of the upper limit of message size, use:
InboundMsgSizeupdate = InboundMsgOverhead +
  ColOverhead + (RowWidth*2)
OutboundMsgSizeupdate = OutboundMsgOverhead +
  (RowWidth*2) + (NumSites*8)
For a more precise estimate, use the RowWidthChanged figure in the calculation:
InboundMsgSizeupdate = InboundMsgOverhead +
  ColOverhead + RowWidth + RowWidthChanged
OutboundMsgSizeupdate = OutboundMsgOverhead +
  RowWidth + RowWidthChanged + (NumSites*8)
If you use the minimal columns feature, calculate message size using:
InboundMsgSizeupdate = InboundMsgOverhead +
  ColOverhead + (RowWidthChanged*2) +
  PrimaryKeyWidth
OutboundMsgSizeupdate = OutboundMsgOverhead +
  (RowWidthChanged*2) + PrimaryKeyWidth +
  (NumSites*8)

Table Inserts

Calculate the 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)

Table Deletes

If you do not use minimal columns, calculate message size in table deletes using :
InboundMsgSizeinsert = InboundMsgOverhead +
  ColOverhead + RowWidth
OutboundMsgSizeinsert = OutboundMsgOverhead +
  RowWidth + (NumSites*8)
If you use minimal columns, calculate table deletes using:
InboundMsgSizedelete = InboundMsgOverhead +
  ColOverhead + PrimaryKeyWidth
OutboundMsgSizedelete = OutboundMsgOverhead +
  PrimaryKeyWidth + (NumSites*8)

Functions

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.

Begin and Commit Pairs

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.

Formula Components

Component definitions for calculating data volume.
  • 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:

    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 before and after images of 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 a message is sent to. This matters only when small messages are distributed to many site and may be insignificant if you do not have many sites. You might want to omit the number of sites factor from the formulas that use it. In the formula, each site ID is 8 bytes in length, so Numsites is multiplied by 8.

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

Related reference
Table Update Calculations