Parallel.For vs ExecuteMultiple in Dynamics 365


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..

Author: Nishant Rana

I love working in and sharing everything about Microsoft.NET technology !

4 thoughts on “Parallel.For vs ExecuteMultiple in Dynamics 365”

  1. Hi there!

    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)).

    Any ideas?


  2. Hello,
    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.


Please share your thoughts

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.