Performance is always a great concern for any CRM implementation and there are few key things need to consider when analyzing performance improvement. I thought it would be helpful if I summarize the basic key checks to be done to improve the performance in Microsoft CRM On premise deployment.
1. Check – Principal Object Access table size
One of the key reasons for performance issue in Microsoft CRM is the improper maintenance of its database which results in the huge number of records in POA table.
Proper actions need to be taken to clear the POA table as well as to control the growth of this table to get the system working smoothly.
Query to find the table count:
–Get the total number of shared records grouped by Entity
SELECT EV.NAME AS [ENTITY NAME],COUNT(POA.OBJECTTYPECODE) AS [RECORDS COUNT]
FROM PRINCIPALOBJECTACCESS POA
INNER JOIN ENTITYLOGICALVIEW EV ON EV.OBJECTTYPECODE = POA.OBJECTTYPECODE
GROUP BY EV.NAME
ORDER BY 2 DESC
- Clean-up Principal Object Access
In order to clean-up this table, the following actions should be made:
- Schedule a Bulk Deletion Job which would delete all completed and cancelled ‘Workflow logs’
- Schedule a Bulk Deletion Job which would delete all completed and cancelled ‘Process Sessions’
- Execute Microsoft recommended SQL command to clear the records from AsyncOperationBase and POA tables https://support.microsoft.com/en-za/kb/968520
- Control records growth in POA table
- Set the option to delete workflow Log after the completion of Async plugins⁺ and in Workflows⁺
- Change the custom relationship behaviour from ‘Parent’ to ‘Referential’ or equivalent for the most affected relationships
3. Build and schedule a weekly maintenance job to clear the completed and cancelled workflow logs older than x months
2. Enable the ‘EnableRetrieveMultipleOptimization’ registry key
Please note that enabling this will cause the queries to make use of temp tables
3. AsyncOperationBase table maintenance
The workflows in the Dynamics CRM organization are configured to log every successful execution. If there is no business need to audit on successful executions, the data logged should be avoided. Having huge number of records in AsyncOperationBase table will have impact on performance.
In order to maintain this table the following activities will be implemented:
- Assess Workflow Job Retention option for all workflows
- Schedule the Clean up task for cleaning the asynchronous table
- Develop a query which looks for record count in the asynchronous table.
- Review the automatic schedule job timings for clean up and change if required.
4. Check if schedule maintenance jobs are failing and need to be monitored and rectified
Problem Statement: If CRM maintenance jobs are not running in the system, this results in DB having huge number of orphaned and obsolete records which would affect the performance of the system.
There are schedule jobs running in the CRM app server which can be scheduled to run during the off-business hours.
Also ensure that the below listed maintenance jobs are running effectively in the system.
- Deletion Service
- Indexing Management
- Reindex All
- Cleanup Workflows
5. CRM database – sharing memory resources with other databases on the SQL instance
When the Dynamics CRM database(s) share resources with other databases, the performance will be impacted. Monitoring for usage of the machine vitals
(memory, disk IO, network, CPU) will help in determining the impact it is having on the performance on Dynamics CRM.
To ensure predictability, the Dynamics CRM database should not share resources
with other applications, databases or servers.
There should be plans to move non-CRM Databases to a different DB instance
as per the best practices.
6. Enable “Auto update statistics” settings for query optimization
This setting will check for indexes that require statistics update and update automatically and thus improve the performance
7. Optimize CRM built-in maintenance jobs with Indexes
Check if proper indexes are added in AsyncOperationBase table. If the index is missing in this table clean up activity will be delayed/failed
8. To make use of “ExecuteMultiple” in bulk data update/create activities
ExecuteMultiple will work much faster compare to the “Execute” method as it will process requests in a batches [upto 1000 requests in 1 batch]
9. Check if the “Business Unit” structure is implemented appropriately
Ideally “Business Unit” in CRM should be the backbone of the security model and thus the focus on using CRM business unit should be on designing the proper security model rather than business’s Business model. Creating huge number of CRM Business Units would also create x times Security Roles. Which will have an impact.
For eg: if the security requirement doesn’t need to segregate information across mulple functional Bus within the organizations, it doesn’t necessarily need to create CRM Business Unit. A custom Business Unit entity can be used to serve the purpose and hence reduce the load in CRM Business Unit structure.
10. Check for Higher Index Fragmentation in CRM Database
Having more number of fragmented indexes with average fragmentation count higher than 20 will have huge impact on SQL Server performance
11. Settings to improve the AsyncService performance
Better usage of the AsyncService settings would improve the load on SQL Server as well as the Async Server
Eg: Setting lower values for AsyncItemsInMemoryHigh and AsyncItemsInMemoryLow
This blog has the settings in more details: