Microsoft KB Archive/917379

= Message fragmentation in BizTalk Server 2004 =

Article ID: 917379

Article Last Modified on 4/3/2006

-

APPLIES TO


 * Microsoft BizTalk Server 2004 Standard Edition
 * Microsoft BizTalk Server 2004 Developer Edition
 * Microsoft BizTalk Server 2004 Enterprise Edition
 * Microsoft BizTalk Server 2004 Partner Edition

-





SUMMARY
''This article describes message fragmentation in Microsoft BizTalk Server 2004. Message fragmentation lets BizTalk Server 2004 handle large messages and optimize runtime performance. This article also describes how to correctly configure message fragmentation settings in BizTalk Server 2004.''



INTRODUCTION
BizTalk Server 2004 supports message fragmentation when large messages are stored in and retrieved from the BizTalkMsgBoxDb database. Message fragmentation lets BizTalk Server 2004 handle large messages and optimize runtime performance. For example, BizTalk Server 2004 can process files up to 1 gigabyte (GB) with little or no decrease in server performance.

To configure message fragmentation settings in BizTalk Server 2004, follow these steps:
 * 1) Start the BizTalk Administration console.
 * 2) Right-click the BizTalk Server 2004 group that you want, and then click Properties.
 * 3) On the Large Message tab, type the value in bytes that you want in the Threshold box.
 * 4) On the Large Message tab, type the value in bytes that you want in the Fragment size box, and then click OK.



Large message threshold
When the size of a message is equal to or larger than the value in the Threshold box, BizTalk Server 2004 fragments the message. The default value for the large message threshold is 102,400 bytes.

When a message batch is processed, the in-memory size of the message batch may reach the number of bytes that is specified for the large message threshold. If this occurs, the part of the message batch that has been processed is written to the MessageBox database before the rest of the message batch is processed. BizTalk Server 2004 performs the database write under the context of a Microsoft Distributed Transaction Coordinator (MS DTC) transaction as follows:
 * If the message batch is being published under the context of an existing MS DTC transaction, the existing transaction is used to write the processed part of the message batch to the MessageBox database. For example, if the incoming message batch is being published by a transactional adapter that is configured to require transactions, the existing transaction is used to write the processed part of the message batch to the MessageBox database.
 * If the message batch is not being published under the context of an existing MS DTC transaction, a new MS DTC transaction is created to write the processed part of the message batch to the MessageBox database. The MS DTC transaction is used to guarantee that all the parts of a given message batch are successfully written to the MessageBox database.

The large message threshold applies to a message batch. However, because a message batch can be set to a value of one, the large message threshold also applies indirectly to individual messages. For example, when a message batch of one message exceeds the specified large message threshold, the large message threshold applies to the single message in the message batch.

You can configure the large message threshold to reduce the number of MS DTC transactions that are created to allocate message batches to the MessageBox database. You should do this because the excessive use of MS DTC transactions may decrease server performance. You can use the following calculation to determine what the minimum value for the large message threshold should be to avoid creating MS DTC transactions unnecessarily:

Batch size * Average size in bytes of each message in the batch after the receive pipeline processes the message < Large message threshold

As long as the total size in bytes of the message batch does not exceed the specified large message threshold, BizTalk Server 2004 does not have to create an MS DTC transaction to allocate a message batch to the MessageBox database.

Large message fragment size
When the in-memory size of a received message exceeds the number of bytes that is specified in the Fragment size box, BizTalk Server 2004 splits the message into fragments of the specified size. The fragments are written to the MessageBox database under the context of an MS DTC transaction as follows:
 * If the incoming message is being published under the context of an existing MS DTC transaction, the existing transaction is used to write the message fragments to the MessageBox database. For example, if the incoming message is being published by a transactional adapter that is configured to require transactions, the existing transaction is used to write the message fragments to the MessageBox database.
 * If the incoming message is not being published under the context of an existing MS DTC transaction, a new MS DTC transaction is created to write the message fragments to the MessageBox database.

You can increase the large message fragment size to reduce the frequency with which large messages are fragmented and to reduce the number of MS DTC transactions that are created. This may increase performance. However, increasing the large message fragment size may also increase the amount of available memory that is used.

If it takes longer than the maximum MS DTC transaction time-out value of 60 minutes to write a message to the MessageBox database, the transaction times out, and an error occurs. Additionally, the attempt to write the message fails and is rolled back. You should increase the large message fragment size enough to avoid this problem when you process very large messages. Depending on the available memory, you should increase the large message fragment size to a value between 1 megabyte (MB) and 10 MB. Therefore, you should set the large message fragment size to a value between 1,048,576 bytes and 10,485,760 bytes.

