
Is there a way to limit the number of active instances of a given orchestration?
BizTalk Server 2004 has no built-in mechanism for controlling the number of instances of a given orchestration. The BizTalk Server engine does its own throttling to maximize system throughput.
If you need to control the number of active instances because of external resource constraints (for example, availability of database connections), then the orchestration must do its own access control. Typically you do this by implementing a singleton or a fixed number of resource-controller orchestrations that dispense access to the resource.
Perhaps the simplest example of instance control is as follows: You want to control the number of instances of orchestration A that are doing work. Orchestration B is the singleton resource dispenser. On activation, A sends a request to B. B reads the request, determines if this new A can execute now, and returns a reply: yes or no. A reads the reply. If the reply is no, A delays for a period of time and then requests again. If the reply is yes, A executes. At completion, A sends another message to B telling B that it is finished.
As stated above, this is a simple example. In practice, you might need something more complex. More abstractly, you need to control the rate at which messages are activated to better match the rate that activated instances can complete their processing.
Additionally, if your resource-controller orchestrations are long running on BizTalk Server 2004, you need to have the following hotfix installed: http://go.microsoft.com/fwlink/?LinkId=65331.