Use Multiple Threads
Add threading support to your application to break the work up across multiple CPU’s. This assumes that you are running the code on a multi-processor system.
For more information see the NET Framework Developer’s Guide article on Managed Threading at msdn2.microsoft.com/en-us/library/3e8s7xdd.aspx.
Use NTLM Authentication
For more information see Designing Distributed Applications with Visual Studio .NET, IIS Authentication at msdn.microsoft.com/library/en-us/vsent7/html/vxconIISAuthentication.asp.
Use Connection Sharing
This is also called unsafe connection sharing. Connection sharing is safe when you are running an application as a single user. For example, if you write a program to do bulk import for a custom entity. If your application will have multiple users, you can create a separate application pool for the program to run in to increase the measure of safety when using connection sharing.
// Create the service.
CrmService _localService = new CrmService();
_localService.Credentials = _crmService.Credentials;
_localService.Url = _crmService.Url;
// Turn on unsafe connection sharing.
_localService.UnsafeAuthenticatedConnectionSharing = true;
// For a program with multiple users, create a new application pool
// rather than using the default.
_localService.ConnectionGroupName = "default";
For more information see the documentation for the .NET Framework Class Library HttpWebRequest.UnsafeAuthenticatedConnectionSharing property at msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemNetHttpWebRequestClassUnsafeAuthenticatedConnectionSharingTopic.asp.
Use Common Methods
The CrmService common methods are faster than using the CrmService.Execute method with the corresponding message. For example use the Update method rather than the Execute method with the Update message.
Use Strong Types
The DynamicEntity class is useful for when your code needs to work on entities and attributes that are not known at the time the code is written. However, this flexibility comes at a price. If your entities are already defined at code time, you should use the strong types provided for you in the WSDL.
If possible, disable all registered callouts before running your application.
Limit Data Retrieved
When using the methods that retrieve data from the server, only retrieve the minimum amount of data needed by your application. This is done by specifying the column set, which is the set of entity attributes to retrieve.
When using the Retrieve method, use the columnSet parameter to specify the attributes you need.
When using the RetrieveMultiple method, specify the attributes to retrieve in the query using the QueryBase.ColumnSet field.
When using any message that uses a QueryExpression to specify the query criteria, use the QueryBase.ColumnSet field.
Limit Operations that Cascade to Related Entities
When using Update, don’t set the ownerid attribute on an entity instance unless the owner has actually changed. Setting this attribute often requires changes to cascade to related entities, increasing the amount of time required for the update operation.