편집

다음을 통해 공유


How to 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 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 may 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 the latest information about ExecuteMultiple, see Execute multiple requests using the Organization service. For recommendations and guidance, see Don't use batch request types in plug-ins and workflow activities.

Apply limits for concurrent requests

There are several constraints related to the use of the ExecuteMultipleRequest. One limit that applies only to an on-premises deployment is described below and the other two (no recursion, and maximum batch size) are documented in (Dataverse) Run-time limitations.

Throttling of concurrent calls – for Dynamics 365 for Customer Engagement it's possible to set a limit on the number of concurrent ExecuteMultipleRequest executions per organization. This helps prevent one app from monopolizing the server resources. If that limit is exceeded, a "Server Busy" fault is thrown before the first request is ever executed. This isn't enabled by default. The deployment setting for this limit is ExecuteMultiplePerOrgMaxConnectionsPerServer.

Tip

For any Customer Engagement deployment, a deployment administrator can set or change the throttling limit.

See also

Read and Write Data and Metadata using the IOrganizationService Web Service
Microsoft.Xrm.Sdk Messages
IOrganizationService.Execute
OrganizationRequest
OrganizationResponse
Microsoft.Crm.Sdk Messages
Import data