Pool Size and Actor Pool Size
The choice of Actor Pool Size for the production, and Pool Size for each business host, determines how many jobs are available to perform which types of work for the production. These numbers are an essential part of the production design and are unlikely to need adjustment once the production is deployed live. Larger numbers are not necessarily helpful; most pool sizes are best set to either 0 or 1, and there can be serious consequences when sizes are set to a number greater than 1.
Private Pool Size for Business Hosts
Each business service, business process, or business operation can have its own, private pool of allocated jobs. You can configure the size of this pool in the Management Portal. If in testing your production, you find that you need more than 100 jobs per business host, it may indicate some other kind of problem, such as a bottleneck or deadlock that you should address. If it is a computational bottleneck, then there is no point in having the pool size larger than the number of CPUs.
Ensemble uses a Pool Size of 0 for an adapterless business service. This is a business service that is invoked directly from outside Ensemble, rather than receiving its requests in the usual way, via an inbound adapter. An adapterless business service may be invoked via Caché language bindings, CSP pages, SOAP, or a routine invoked from the operating system level. For details, see “Invoking a Business Service Directly” in Developing Ensemble Productions.
If you set a business operation to run in process as opposed to queued, Ensemble does not create a background job or message queue for the business operation. Instead, whenever a request is sent to this business operation, Ensemble instantiates the business operation within the caller’s job, and invokes its methods within that job, as well. Consequently, no job pool is necessary, and you must set the business operation Pool Size to 0.
For all other types of business service or business operations, if you set the Pool Size to 0, the business host does not run.
Production Actor Pool Size for Business Processes
Unlike other types of business host, a business process has the option of sharing jobs from a public pool; this pool is called the actor pool or Ens.Actor. You can configure the Actor Pool Size for the production. Actors in the production-wide actor pool have no affiliation with or knowledge of a specific business process. Any business process that has a private Pool Size of 0 can use jobs from the public actor pool.
The choice as to whether or not a business process should use its own private pool or the public pool depends on the needs of the production. Any nonzero value for a private Pool Size ensures that the business process only uses jobs from its private pool. If you want any business process to use jobs from the actor pool, its private Pool Size must be 0. The default Ensemble configuration allows 1 job in the private pool for each business host, and 2 jobs in the production-wide actor pool. This means that if you want business processes to share the actor pool it does not happen automatically; you must set their individual Pool Size settings to 0.
When you disable a business process, the result depends on the private Pool Size configuration setting:
Business process Pool Size > 0:
The business process only uses jobs from its private pool; you can disable just this process by clearing the Enabled check box on the configuration page of the business process.
Business process Pool Size = 0:
The portal will set the pool size of the business process to 1 before disabling it. Typically, the portal displays a message warning you about this action before taking this action. If a business process with a pool size of 0 is disabled, it stops all business processes using the shared actor pool, which is why the portal does not allow this change. If you do want to stop all business processes using the shared actor pool, set the Actor Pool Size to 0 in the production settings tab.
First-In First-Out (FIFO) for Healthcare
A private Pool Size of 1 makes first-in, first-out (FIFO) processing possible. If all the business hosts in the production have only one job available, only one message can be processed at a time by each host. This gives each message from a given source only one possible path through the production, so each message is guaranteed to arrive at its configured destination in the same order in which it was sent. Without guaranteed FIFO, a message from a particular source could skip over other messages from the same source by using a faster, parallel job to arrive at its destination sooner.
For this reason, InterSystems recommends that every business service, business process, and business operation in a message routing production for healthcare has its Pool Size setting configured to 1, with the Actor Pool Size for the production at 0.
To guarantee FIFO for a business process, in addition to setting its Pool Size to 1, either
Make calls using a <code> SendRequestSync() call
Do not make calls from conditional branches of your business process logic and only make calls to elements that are themselves FIFO.
FIFO is essential for healthcare applications. Suppose a patient enters a hospital and requires care. System A sends out an admit event, followed by a treatment order, but System B receives the order first. System B cannot process the order without an admit, so upon receiving the order, it produces an error. This may delay patient care or require the information system to execute complex logic to associate admit with the order after the admit finally arrives at System B.
Considerations and Trade-offs
In situations other than healthcare, private pools of a size 1 or greater can be useful for fast-running business processes in a production that also includes slow-running business processes. A fast-running business process can have a private pool to ensure that its requests never get stuck in the public actor queue behind accumulated requests for the slow-running business processes.
If every business process in your production has a private pool, then the Actor Pool Size for the production can be 0. On the other hand, if your production includes many business processes that use the public actor pool, you can raise the Actor Pool Size for the production from the default of 2 to prevent bottlenecks when many business processes are running. InterSystems recommends that, as a maximum, you set the Actor Pool Size equal to the number of CPUs in your Ensemble server machine. You could set the number higher, but at any one time there are only as many jobs available as there are CPUs.