Dynamic CRM ON Promise 性能问题的一次排查记录
客户项目是Dynamic CRM On Promise的 ,并且由于 预算关系,是ALL in One的
在一个项目中遇到的一个情况,项目上线的时候都很正常,运行一段时间后,系统能正常登陆,
但是打开默认的仪表板页面 和 列表页 非常慢,慢的令人发指,大概需要几分钟的时间,哪怕列表页只有不到10条数据,还有就是一开始正常运行的流程,现在也开始报错
对于CRM的性能调优也没什么经验,不过好在之前有听过几次关于调优的讲座,
从几个方面入手,
1.基础网络
2.应用层面
3.数据库层面
1--> 先从客户的网络入手,排除掉了网络问题
2-->应用层面: 一开始从前端开始排查 页面的TTFB 能到达 1分钟 ,甚至更长,还想着找到最长的那个TTFB的请求
找到的都是 CRM系统原生的一些请求,这些请求也没法改动,网上翻了一些帖子,也基本没有什么收货
3-->数据库层面: 之前知道一些 数据库 调优的一些工具,例如: sqlprofile ,计数器 这些,也是试图 用这些工具 做了一些监控,由于对
这些工具使用较少,也翻了一些文档,没有什么收货
后来换了一种思路,数据库调优 一般会从 索引 入手,就从这方面去翻了一些资料,果然有收获
对于Dynamic CRM 数据库,微软内置了 一大批 存储过程,其中就会有 重新生成索引的 存储过程,并且会有一些job 在跑这些存储过程
找到了一个 重新生成全部 索引的 存储过程,根据 博客的一些介绍,重新跑一下完事后在访问系统就基本恢复正常了
对于客户来说,到这里基本问题得到解决,到底 为什么会这样,后来也没有时间深究。
我猜想 可能一下几个方面会有一些影响
1.也许跟客户的服务器环境 和 设置有关系,ALL in One的 系统,
2.每天会有跟SAP的接口程序,有大量数据的同步,删除和重新生成数据操作
有哪些大神有一些思路了 ,希望可以批评指正。
下边是一篇关于 CRM 性能调优且有关 重新生成索引的一些介绍
引用地址:http://soluciones-microsoft.blogspot.com/2018/07/how-to-improve-microsoft-dynamics-365.html
How to Improve Microsoft Dynamics 365 CRM Performance
https://github.com/pfedynamics/dynamicsperf
The following 5 items provided the biggest performance boost to their Dynamics CRM instance.
1.) Reorganizing / Rebuilding SQL Indexes
When you install Microsoft CRM, several System jobs are set up to keep your database running smoothly. These routines include rebuilding fragmented indexes and cleaning up tables that contain data that is no longer needed. These jobs work great when your database is of moderate size, however if your database grows over 40 GB, these jobs may begin to fail. When this happens your database will begin to grow rapidly, and your indexes will quickly become fragmented. (My client had over 100 indexes fragmented at more than 80%, and a few tables that contained over 20 million unnecessary records.)These issues can lead to extremely slow performance and eventual SQL timeouts.Are You Experiencing These Symptoms?
If so, you should turn off the out-of-the box index maintenance jobs and develop your own maintenance plan. You can get the CRM Job Editor tool from CodePlex to change the time that the maintenance plans run. (If you go this route, you’ll want to set the “Reindex All” and “Indexing Management” jobs to run sometime in the distant future, such as 12/31/2099.)
Once you have disabled these jobs, you will need to set up your own index maintenance jobs. I recommend using the SQL Server Maintenance Plan Wizard ( http://msdn.microsoft.com/en-us/library/ms191002.aspx ). Alternatively, you can create a SQL job to run the CRM 2011 index maintenance procedure p_ReindexAll, leaving the MaxRunTime variable null to ensure the job will complete. The procedure variables are as follows:
Order | Variable name | Default | Description |
1 | AllIndexTypes | 0 | 0:Clustered Index only, 1: Clustered and Non Clustered indexes |
2 | MaxRunTime | Null | Maximum allowed running time (in seconds) |
3 | FragRebuildPct | 30 | Percentage of fragmentation at which indexes are rebuilt |
4 | MinPages | 25 | do not touch tables less than xx pages |
5 | Verbose | 0 | 1: Print progress messages and detailed results |
EXEC p_ReindexAll 1,null,1,1,0
2.) Deletion of Completed Workflows
Similar to the CRM re-indexing job, the CRM system jobs designed to keep CRM tables cleaned up may start failing if your database becomes too large. When this happens the AsyncOperationsBase and PricipalObjectAccess tables can grow extremely large (tens of millions of records) within a few months. There are a few methods you can employ to keep these tables in check.If you want to delete all completed workflows immediately after they are completed, simply check the “Automatically delete completed workflow jobs” checkbox on each process.
However if you would like to remove completed workflows after some period of time (such as two weeks), you will need to create a SQL job to delete them in bulk. The Microsoft KB article 968520 contains the SQL required to do this.
3.) Delete Orphaned POA Records
BEGIN TRY
BEGIN TRAN t1
— delete PrincipalObjectAccess records in batches
exec(@deletestatement)
4.) Enabling Compression & SSL
Compression Enabled on HTTP | Compression Enabled on HTTPS | ||
Bytes Sent | 105084 | 105084 (0% reduction) | 67586 (36% reduction) |
Bytes Received | 219102 | 149424 (32% reduction) | 25837 (88% reduction) |
5.) Define system wide Outlook Sync Filters