Showing posts with label performance. Show all posts
Showing posts with label performance. Show all posts

Friday, October 30, 2009

Improving Microsoft Dynamics CRM Performance and Securing Data with Microsoft SQL Server 2008

Microsoft SQL Server® 2008 contains a variety of features that, when implemented properly, can improve the performance of a Microsoft Dynamics® CRM 4.0 implementation and secure the data within that deployment. These Microsoft SQL Server 2008 features include: - Compression - Sparse Columns - Transparent Data Encryption - Backup Compression The MS CRM E2 team, working in conjunction with the Microsoft SQL Server team, recently completed a project that was designed to: 1. Evaluate the new scenarios that these Microsoft SQL Server 2008 features expose 2. Measure the performance impact of implementing these features, both singly and in selected combinations This paper provides an overview of these Microsoft SQL Server 2008 features, together with benchmark results and recommendations for implementation.

 

Click here

Friday, February 27, 2009

White Paper: SAMPLE - Performance and Scalability Assessment of Customer Implementation

 

Overview

Working closely with contacts in a variety of technical, support, and field roles, the MS CRM Engineering for Enterprise (E2) team receives documentation and resources from which the broader CRM community can benefit. This paper provides a sample final report on the results, conclusions, and recommendations from a performance and scalability assessment of a customer's implementation of Microsoft Dynamics CRM. The document provides details of the testing methodology and environment, as well as benchmark testing results. This sample report is intended to serve as a point of reference for other groups or teams that are or plan to perform similar performance and scalability assessments on customer implementations of Microsoft Dynamics CRM.

Download here

Thursday, February 12, 2009

Improving Microsoft Dynamics CRM Performance and Securing Data with Microsoft SQL Server 2008

Microsoft SQL Server® 2008 contains a variety of features that, when implemented properly, can improve the performance of a Microsoft Dynamics® CRM 4.0 implementation and secure the data within that deployment. These Microsoft SQL Server 2008 features include: - Compression - Filtered Indexes - Sparse Columns - Transparent Data Encryption - Backup Compression The MS CRM E2 team, working in conjunction with the Microsoft SQL Server team, recently completed a project that was designed to: 1. Evaluate the new scenarios that these Microsoft SQL Server 2008 features expose 2. Measure the performance impact of implementing these features, both singly and in selected combinations This paper provides an overview of these Microsoft SQL Server 2008 features, together with benchmark results and recommendations for implementation.

 

Click Here to Download

Tuesday, January 20, 2009

CRM WebService Error: Only one usage of each socket address (protocol/network address/port) is normally permitted

by Luke Simpson 01.15.09


When performing a data integration or migration into CRM, it is very common to create a .Net application that transforms the data, then pushes the records into CRM using the WebServices.  At times, however, the load of data being pushed to IIS can be more than is acceptable to the default settings in an IIS implementation.  At these high load times, the server might post an error stating "Only one usage of each socket address (protocol/network address/port) is normally permitted (typically under load)."

What is happening, is that connections are being repeatedly opened and closed on the webserver.  When a connection is closed, the connection goes into a TIME_WAIT state for 240 seconds.  This is the default setting.  In this case, the IP being used is typically fixed, which means that the variable is the local port.  By default ports 1024-5000 are available to be used, which means that using default setting you have approximately 4000 ports to be used during a 4 minute span (240 seconds).  So if your code is making more than 16 webservice calls per second, you will exhaust all of the available ports!

To fix this problem, you can make 2 different registry changes on the CRM Application Server.

  1. Increase the dynamic port range.  As stated above, the default is 5000 but this can be raised up to 65534.

    • Using Regedit, navigate to  HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters\MaxUserPort (if this key does not exist, create it as DWORD value)

    • Set the value to 65534, or a value of your choice

  2. Reduce the amount of time that the connection is in a TIME_WAIT state.

    • Using Regedit, navigate to  HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters\TCPTimedWaitDelay (if this key does not exist, create it as DWORD value)

    • Set the value to 30

By performing the actions above, you are allowing the server to use a far larger number of available ports, and you also allow the server to recycle them faster.  Problem solved!

Tuesday, October 7, 2008

Blog Move: Speed Racer - Call CRM at speeds that would impress even Trixie

posted at: 9:37 AM by Aaron Elder


It's been a year since Invoke Systems and Ascentium merged and we finally took down the old clunk server that was hosting the old Invoke Systems blog.  This blog is of course still getting lots of hits and due to popular demand, I am going to migrate a few choice posts on our current blog.  Note these posts are all related to Microsoft CRM 3.0.  Here is the first.

The other day I was doing a bit of testing to find the fastest way to make rapid calls to CRM Web Services.  The truth of the matter is that when you are calling CRM Web Services you are pretty much down to the metal; so the only places I found to make optimizations were at the .NET Web Service Request level and at the server level.  The good news is that with a few very easy tweaks you can improve rapid CRM calls by almost 50%!

The results are based on a test that involved performing 250 Account create operations in a single-threaded clean CRM 3.0 RTM environment.  Please note that this article is about improving performance for operations such as data imports and bulk operations.  The same user and CRM Service are re-used for all 250 calls.  Be warned that not all settings are "safe" to use in all scenarios... please read up on the suggestions prior to implementing them in a production system.

The results of this study are as follows.

Test

Results

Raw Dog

15402.1472

PreAuthenticate

14450.7792

PreAuthenticate & Unsafe

12638.1728

Just Unsafe

9633.8528

Unsafe + IIS Tweaks

8862.744

[IMAGE MISSING]

So what does all this mean?  The answers are below.  For simplicity of the code samples, I assume you have already declared and setup a CrmService, the credentials are set and the URL is configured.  I also assume there is a CRM Account called "acc" that is ready to go.  Something like this:

CrmService crm = new CrmService();
crm.Credentials = System.Net.CredentialCache.DefaultCredentials;
crm.Url = "
http://localhost/MSCRMServices/2006/CrmService.asmx";

account acc = new account();
acc.name = "Test";

"Raw Dog" - This is the most straightforward and basic way of calling the CRM service, the code looks something like this:

crm.Create(acc);

PreAuthenticate - This is the first optimization that people seem to use and it does indeed provide a small benefit (~7%) over the default settings.  The code looks like this:

crm.PreAuthenticate = true;
crm.Create(acc);

So why does this work?  Reading the documentation suggests that this simply saves a round-trip required by NTLM's challenge-response authentication system.  MSDN: "With the exception of the first request, the PreAuthenticate property indicates whether to send authentication information with subsequent requests without waiting to be challenged by the server. When PreAuthenticate is false, the WebRequest waits for an authentication challenge before sending authentication information." - Of course since most systems have "Keep Alives" enabled and my scenario is using the same connection over and over, the savings are minimal.

PreAuthenticate & Unsafe - This attempt adds the "UnsafeAuthenticatedConnectionSharing" option to the mix and we get yet another boost in performance (~12% over our last test and ~18% for our first test).  The code looks like this:

crm.PreAuthenticate = true;
crm.UnsafeAuthenticatedConnectionSharing = true;
crm.Create(acc);

So why does this help?  When used in conjunction with "Keep Alives" this option keeps an authenticated connection open to the server.  MSDN: "The default value for this property is false, which causes the current connection to be closed after a request is completed. Your application must go through the authentication sequence every time it issues a new request.  If this property is set to true, the connection used to retrieve the response remains open after the authentication has been performed. In this case, other requests that have this property set to true may use the connection without re-authenticating. In other words, if a connection has been authenticated for user A, user B may reuse A's connection; user B's request is fulfilled based on the credentials of user A."

This option is very powerful and before using it be sure to read up on it here.  Since the connection is authenticated and shared, you need to make sure that two different users don't come in on the same connection.  If they do, the server will thing the user is the first user that opened the connection and allow the 2nd user to do whatever the 1st user could and to do it as if they were the same person.  There is a way around this using the property "ConnectionGroupName" property.  For my scenario of a bulk import, the only user that will be using this connection is the migration user and it will be the same user from start to end, so we are ok.

Unsafe - Now something curious happens when we keep PreAuthenticate off, but leave UnsafeAuthenticatedConnectionSharing on.  This is where things get a bit odd, this is faster than have both options on; a full 38% faster than the original test as a matter of fact!  The code looks like this:

crm.UnsafeAuthenticatedConnectionSharing = true;
crm.Create(acc);

Why does this work?  Well the answer is I don't know and I have talked to people on the CRM team and the .NET team and nobody has a really good answer.  The good new is that it does, perhaps it is best to leave it at that.

Tweaks - Finally, if you follow all the recommended steps for configuring a high-performance ASP.NET application (disable logging, enable ISAPI caching, make sure ASP.Net is tweaked) you can get a final little nip of performance.  Basically do what this article says and we get another 9% bump in performance.

 

Disclaimer:
This posting is provided "AS IS" with no warranties, and confers no rights.