Use ExecuteMultiple to improve performance for bulk data load
You can use the ExecuteMultipleRequest message to support higher throughput bulk message passing scenarios in Dynamics 365 for Customer Engagement , particularly in the case of Dynamics 365 for Customer Engagement apps where Internet latency can be the largest limiting factor. ExecuteMultipleRequest accepts an input collection of message Requests, executes each of the message requests in the order they appear in the input collection, and optionally returns a collection of Responses containing each message’s response or the error that occurred. Each message request in the input collection is processed in a separate database transaction. ExecuteMultipleRequest is executed by using the IOrganizationService.Execute method.
In general, ExecuteMultipleRequest behaves the same as if you executed each message request in the input request collection separately, except with better performance. Use of the CallerId parameter of the service proxy is honored and will apply to the execution of every message in the input request collection. Plug-ins and workflow activities are executed as you would expect for each message processed.
Custom code in the form of plug-ins and custom workflow activities can even execute ExecuteMultipleRequest. However, there are a few key points to keep in mind. An exception thrown by a synchronous registered plug-in is returned in the response collection item Fault parameter. If a plug-in executes within a database transaction, the plug-in executes ExecuteMultipleRequest, and a transaction rollback is initiated, the rollback includes any data changes resulting from requests executed by ExecuteMultipleRequest.
For more detailed information about ExecuteMultiple, see Execute multiple requests using the Organization service.
On-premise run-time limitations
There are several constraints related to the use of the ExecuteMultipleRequest as described in the following list.
Maximum batch size – there is a limit to how many requests can be added to a request collection. If that limit is exceeded, a fault is thrown before the first request is ever executed. A limit of 1000 requests is typical though this maximum amount can be set for the Dynamics 365 for Customer Engagement apps deployment. The deployment setting for this limit is BatchSize.
Throttling of concurrent calls – for Dynamics 365 for Customer Engagement apps there is a limit of 2 concurrent ExecuteMultipleRequest executions per organization. If that limit is exceeded, a “Server Busy” fault is thrown before the first request is ever executed. For an on-premises deployment, throttling is not enabled by default. The deployment setting for this limit is ExecuteMultiplePerOrgMaxConnectionsPerServer.
For any Customer Engagement apps deployment, a deployment administrator can set or change the throttling limit.
Read and Write Data and Metadata using the IOrganizationService Web Service