This article discusses the implementation of the OpenReuse value and the ReuseOpenConnection value of the ConnectionType property in the BizTalk SAP adapter in a Microsoft BizTalk Server 2004 environment or in a BizTalk Server 2006 environment.
The SAP adapter for BizTalk Server provides functionality to make multiple Remote Function Call (RFC) calls or Business API (BAPI) calls by using the same connection object. This functionality provides transaction-like connections. This functionality is implemented by session sharing across multiple requests. This functionality also provides orchestration developers with the ability to structure the sequence of calls to SAP inside a set of transactional scopes. The orchestration developer can also execute Commit operations and Rollback operations based on the orchestration logic. The orchestration developer can then implement a sequence of SAP calls without any significant changes in the BAPI code.
The SAP adapter manages the session that is associated with the XLANG instance. The session is associated with the XLANG instance when you use the OpenReuse value of the ConnectionType property to request the connection. The connection object is a non-serializable handle to the physical connection that the .NET connector provides. BizTalk Server adds the connection object to an in-memory hash table. BizTalk Server reuses the connection object every time that BizTalk Server receives a ReuseOpenConnection request from the XLANG instance. BizTalk Server releases this object from the hash table only when the SAP adapter receives and completes a ReuseClose request.
The SAP adapter holds the connection object in reserve for that specific XLANG instance for an unspecified time. Because the SAP connection object is non-serializable, the SAP adapter does not release this connection, even if the orchestration instance has dehydrated. Therefore, the SAP adapter cannot persist the connection. The data flow in the orchestration design and the availability of the host process determine the lifetime of the connection. The SAP adapter connection also limits the scalability of the application to one host instance. The connection object is an in-memory object (hash table) in the process space of the host that initiated the connection. You cannot open a connection on Computer A and then reuse that connection from Computer B.
An update to the SAP adapter makes significant design changes to address some performance issues with the OpenReuse connection type:
Threading model: The threading model has been significantly modified with the update. Before you install this update, the SAP adapter starts a new thread for every incoming request, even if an existing connection is not available. For example, if you set the number of concurrent connections to 5, and then you start ten instances of XLANG that implement the OpenReuse connection type, the adapter tries to start 10 threads. The first five orchestrations establish a connection and continue to process. The remaining five orchestration instances remain active while their associated adapter threads try to obtain a connection. This exhausts significant CPU cycles.
After you install the update, the SAP adapter starts a new thread only when a connection is available. BizTalk Server still sends the message to the SAP adapter. The SAP adapter stores the message instance in an array until a connection is available.
Improved exception handling: Exception handling that is specific to connection errors has also been modified to address some limitations with high availability. The SAP adapter returns an exception when the SAP adapter cannot establish a connection to SAP or retrieve a connection for a Reuse request. For example, an orchestration that implements the OpenReuse connection type can open a connection on Computer A. The orchestration can rehydrate on Computer B. The SAP adapter returns an exception handle when the SAP adapter tries to access the connection object. The orchestration can subscribe to the error from the transport and handle the error inside an exception handler.
Before you implement the OpenReuse connection type in an orchestration or in SAP BAPIs, consider the potential effects of the following factors.
Note This is an incomplete list. The list is intended for base guidance only:
A business requirement of high throughput
High availability across multiple host instances (failover)
Long-running orchestration instances (instances in which a long time passes between the OpenReuse connection type and the ReuseClose connection type)
A limited number of concurrent connections to SAP
A larger number of messages per batch
BizTalk Server 2006
To resolve this problem, install the hotfix that is documented in Microsoft Knowledge Base (KB) article 976622:
976622 FIX: An orchestration instance is dehydrated, and messages are not sent to the SAP server when you use Microsoft BizTalk Adapter 2.0 for mySAP Business Suite
BizTalk Server 2004
A supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing this specific problem.
If the hotfix is available for download, there is a "Hotfix download available" section at the top of this Knowledge Base article. If this section does not appear, submit a request to Microsoft Customer Service and Support to obtain the hotfix.
Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft Web site:
Note The "Hotfix download available" form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language.
You must have BizTalk Server 2004 installed to apply this hotfix.
You do not have to restart your computer after you apply this hotfix.
Hotfix replacement information
This hotfix does not replace any other hotfixes.
The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.
Note Because of file dependencies, the most recent hotfix that contains these files may also contain additional files.
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
By default, the BatchSize value for the BizTalk SAP adapter is 20. The BizTalk SAP adapter properties may show a value as 1. However, the BatchSize value is actually 20. To set this value, manually set the correct value in the BizTalk SAP adapter properties, and then restart the host instance.
The change to the BatchSize value affects all instances of the adapter. The change is not port-specific.
For more information about the ConnectionType property for the BizTalk SAP Adapter, visit the following Microsoft Developer Network (MSDN) Web site:
Microsoft BizTalk Server 2006 Standard Edition, Microsoft BizTalk Server 2006 Enterprise Edition, Microsoft BizTalk Server 2006 Developer Edition, Microsoft BizTalk Server 2004 Standard Edition, Microsoft BizTalk Server 2004 Enterprise Edition, Microsoft BizTalk Server 2004 Developer Edition