Optimizing and Maitaining the Peformance of a CRM 2011 Infrastructure – Part 2

Second part of the series: the Application tier.


  • 2.1 Optimizing and Maintaining Microsoft Windows Server
  • 2.2 Optimizing and Maintaining the Microsoft .NET Framework and Microsoft .NET Applications
  • 2.3 Optimizing and Maintaining Internet Information Services
  • 2.4 Optimizing the Performance of Microsoft Dynamics CRM Server 2011
  • 2.5 Optimizing Microsoft Dynamics CRM Reporting Services
  • 2.6 Optimizing Report Performance
  • 2.7 Best Practices for Optimizing Workflow


2. Optimizing and Maintaining the Application Tier

2.1 Optimizing and Maintaining Microsoft Windows Server

    • See the Performance Tuning Guidelines for Windows Server 2008 R2
    • Increasing the Ephemeral TCP Port Limit:
      • In some situations, you may want to reserve a range of ports so that a program or process that requests a random port will not be assigned a port that is in the reserved range. The ports in that range are called ephemeral ports. In rare cases there may be no free ephemeral ports available, which will cause the connection open to fail or time out.
      • To view the current range of ephemeral ports: netsh int <ipv4|ipv6> show dynamicport <tcp|udp>
      • To change the current range of ephemeral ports: netsh int <ipv4|ipv6> set dynamic <tcp|udp> start=number num=range
      • To increase the maximum number of ephemeral TCP ports: navigate to HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParameters.Create a registry entry by using the following information:
        Value Name: MaxUserPort
        Value Type: DWORD
        Value data: 65534
        Valid Range: 5000-65534 (decimal)
        Default: 0x1388 (5000 decimal)
        Description: Controls the maximum port number used when a program requests any available user port from the system. Typically, ephemeral (short-lived) ports are allocated between the values of 1024 and 5000, inclusive.
    • Monitoring the Performance of Microsoft Windows Server: Microsoft Windows Server provides performance counters that you can use to help identify potential performance bottlenecks associated with memory and the cache, processors (and multi-processor computers), physical disks, and the network infrastructure. Remember to monitor each disk and processor used by the operating system. Check the TechNet article Performance and Reliability Monitoring Step-by-Step Guide for Windows Server 2008.


2.2 Optimizing and Maintaining the Microsoft .NET Framework and Microsoft .NET Applications

      • Optimizing the Performance of the Microsoft .NET Framework: Configuring the .NET Framework for optimal performance involves tuning the common language runtime (CLR) and then, depending on the nature of any specific application, tuning the associated .NET Framework technology, for example ASP.NET-connected applications, Web services, Enterprise Services, and ADO.NET code. Consider the potential issues: (see here for more information)
Potential issue Description
Memory misuse Creating too many objects, or failing to properly release resources, pre-allocate memory, or explicitly force garbage collection can prevent the CLR from efficiently managing memory, which can lead to an increased working set size.
Resource cleanup Implementing finalizers unnecessarily, failing to suppress finalization in the Dispose method, or failing to release unmanaged resources can lead to unnecessary delays in reclaiming resources and can potentially create resource leaks.
Improper use of threads Creating threads on a per-request basis and not sharing threads using thread pools can cause performance and scalability bottlenecks for server applications.
Abusing shared resources Creating resources per request can lead to resource pressure, and failing to properly release shared resources can cause delays in reclaiming them.
Type conversions Implicit type conversions and mixing value and reference types leads to excessive boxing and unboxing operations.
Misuse of collections Each collection type in the .NET Framework class library is designed to meet specific storage and access requirements; they may not perform optimally outside of those requirements.
Inefficient loops Looping magnifies even the slightest coding inefficiency, and loops that access an object’s properties are a common culprit of performance bottlenecks, particularly if the object is remote or the property getter performs significant work.


2.3 Optimizing and Maintaining Internet Information Services

      • Optimizing the Performance of Internet Information Services: Optimizing the performance of Microsoft Internet Information Services (IIS) within a Microsoft Dynamics CRM 2011 implementation benefits not only the overall system, but also any custom applications, plug-ins, or add-ins that have been developed by using the Microsoft Dynamics CRM 2011 SDK.
      • Optimizing the Performance of Integrated Windows Authentication and Kerberos Authentication
        • In Internet Explorer, ensure that “Enable Integrated Windows Authentication” is set to enable use of Kerberos for integrated authentication.
        • There is a known issue where users are members of too many groups to be communicated in a UDP packet. It is possible to get Kerberos to use TCP rather than UDP, which enables larger packets of information.
        • To determine whether users are connecting via Kerberos, in the registry, enable Kerberos logging. If necessary, to help diagnose whether the user can obtain and use a Kerberos ticket, use applications such as Kerbtray
      • On IIS, tracing and debugging, while disabled by default, may cause performance issues if enabled.
      • Optimizing Microsoft .NET ThreadPool Settings: if each .aspx page makes a Web service call to a single IP address, it is recommended to adjust these parameters as shown in the following table.
Parameter Value
maxWorkerThreads 100
maxIoThreads 100
maxconnection 12*n (where n is the number of CPUs)
minFreeThreads 88*n
minLocalRequestFreeThreads 76*n
minWorkerThreads 50 (manually add this parameter and value to the file)
    • Monitoring the Performance of Internet Information Services: One of the key counters to monitor and measure against a baseline is the %Process Time for the inetinfo (IIS).


2.4 Optimizing the Performance of Microsoft Dynamics CRM Server 2011

      • Disable platform tracing
      • Verify that the computers meet the hardware and software requirements
      • Enhancing Performance by Distributing Server Roles on Multiple Servers
      • Throttling Client Synchronization Processes
      • Limiting the Number of Records Returned by Aggregate Queries
      • Applying RetrieveMultiple Query Optimizations for large data sets
      • Setting the Default View to a smaller view to limit the records that are displayed
      • Customizing Quick Find Views by Limiting Search Columns
      • Leveraging teams instead of an excessively complex business hierarchy because teams will provide better performance with a lower penalty for security checks
      • Use Field Level Security (FLS) wisely, since there is a performance impact associated with using FLS
      • When changing the order of records returned by a saved query, consider adding an index based on the new ordering to improve the performance of the query
      • Use an iterative process to determine which index best optimizes query performance
      • Disabling Auto-Complete on Lookups
      • To optimize the performance of queries on custom entities, ensure that all columns on the ORDER BY clause derive from a single table, and build an index that satisfies the ORDER BY requirements and as much of the query’s
      • A specific recommendation for any custom application is to limit any columns and rows retrieved to those required to achieve the application’s business goals.WHERE clause selection criteria as possible.


2.5 Optimizing Microsoft Dynamics CRM Reporting Services

  • Report processing and rendering are memory intensive operations, so ensure that the computer hosting the report server includes ample memory.
  • Host the report server and the report server database on separate computers rather than hosting both on a single high-end computer.
  • If all reports are processing slowly, consider a scale-out deployment with multiple report server instances. For best results, use load balancing software and hardware to distribute requests evenly across multiple report servers in the deployment. If load balancing is used, it is advisable to use client affinity to avoid loading the session cache in memory on multiple servers.
  • If a single report is processing slowly, tune the query if the report must run on demand. You might also consider caching the report or running it as a snapshot.
  • If all reports process slowly in a specific format (for example, while rendering to PDF), consider file share delivery, adding more memory, or using another format.


2.6 Optimizing Report Performance

  • Guidelines
    • Configure reports to display data from a specified time frame, for example the previous 90 days, rather than displaying all records in the Microsoft Dynamics CRM database.
    • Reports with a large dataset or a complex SQL query should not be available to all users on-demand. Instead, schedule a snapshot in Report Manager during a period when the system is lightly loaded.
    • Deploy reports through Microsoft Dynamics CRM, and then use Report Manager to run the reports and have the results posted at a scheduled time.
    • Reports should access the fewest datasets possible to meet business requirements.
    • When possible, use fetch based reports, which are much more efficient than SQL-based reports, to run against Filtered Views.
    • Consider using subreports. Show aggregated information in a report initially, and then use subreports for drilling down on aggregates to show non-aggregated values. Using this technique will prevent Report Server aggregations and improve performance.
    • Use explicit paging for reports that require bringing large amounts of data to the Reporting Services middle tier. Build reports so that they show only a page of the total records at one time and have explicit clickable links to bring in data for further pages. Although Report Viewer control shows paging control on reports, all the data needed for the full report has already been pulled from the middle tier.
  • Techniques
    • Use SQL “Group By”: This helps to prevent the computer running Microsoft SQL Server from being overtaxed with gathering, transmitting, and then processing large volumes of data. Instead, it uses the natural indexing and grouping ability of SQL Server to massively reduce this overhead.
    • Making Reports Pre-Filterable (CRMAF_)
    • Using Dynamic Excel or Filtered View Queries: make reports restrictive, verify that a non-clustered index exists on fields in the where clause
    • Throttling Resources used for Reports and Data Visualizations: If a query is sent for reporting purposes, it is tagged with MSCRMReportsGroup. If it is sent for data visualization, it is tagged with MSCRMVisualizationsGroup. See Managing SQL Server Workloads with Resource Governor.

2.7 Best Practices for Optimizing Workflow

  • Determine the appropriate security/permissions model for workflow.
  • Use the Scope property judiciously.
  • Review workflow logic carefully.
  • To improve performance in large deployments, scale out as necessary
  • Monitor the Microsoft Dynamics CRM 2011 database for excess workflow log records.

Leave a Reply

Your email address will not be published. Required fields are marked *