Thought of getting a rough idea on how much performance improvement we can gain if we are using Parallel.For and ExecuteMultiple.
Took a very simple scenario i.e. creating 10000 account records.
|Normal For Loop||3242061 milliseconds à 54 minutes à 185 records per minute|
|Parallel.For||2160337 milliseconds à 36 minutes à 277 records per minute|
|ExecuteMultiple (single request with batch size of 1000)||494663 milliseconds à 8 minutes à 1250 records per minute|
This clearly tells ExecuteMultiple far better.
The sample code that I used for Parallel.For
Hope it helps..
5 thoughts on “Parallel.For vs ExecuteMultiple in Dynamics 365”
I’m using exact the same code above inside an Execute method of a plugin in a CRM online org, but I’m getting always the same errror: “ISV code aborted the operation.”
Is it possible to use Parallel.For inside a plugin execution?
I also tried ExecuteMultiple. It does all the requests (actually it’s just a few updates in my test) but plugin always throw a time out exception (2 min – Crm Online, non-production org (sandbox)).
i am try to create custom entity using ExecuteMultipleRequest class but it will take long time(Approx. 6-7 min for 40 attribute). For performance i take 10 attribute as a batch for ExecuteMultipleRequest then i try to work with parallel.foreach but there is some problems occur like: Generic SQL Server Error, object dispose etc and it take to much time to create attribute. Do you have any solution so that i can enhance my performance to create Custom Entities. I am using trail version. If you have any idea please help me.
Can we Use Parallel For and Execute multiple together.
Did you ever find a Solutoion for Parallel for and execute multiple?
I am getting Timeouts