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

 
Performance Analyzer for Microsoft Dynamics (DynamicsPerf 2.0) is a toolset developed by Microsoft Premier Field Engineering. This toolset is a set of SQL scripts to collect SQL Server DMV data and Microsoft Dynamics specific product data persisted into a singular database called DynamicsPerf. This allows for quick resolution of performance issues on Microsoft Dynamics products (CRM, AX, GP, NAV, SL)

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
Sample Procedure Call
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.
5 Ways To Improve Microsoft Dynamics CRM Performance
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

If you were using CRM 2011 prior to Rollup 6 (or if your CRM database is over 40 GB), there is a good chance your database has a large number of orphaned records in the PrincipalObjectAccess table. This table can grow to be tens of millions of records and can have large performance impacts, especially if you are sharing records among teams. My client had over 15 million orphaned records in the table that we were able to remove. However, after deleting these records, they returned in just 3 months, so we’ve now set up a recurring job to delete these orphaned records each night.

The Microsoft KB Article 2664150 explains the problem and provides a script to safely clean this table. I recommend setting this up as a nightly or weekly job to keep this table clean. Be aware that this script will cause your transaction log to grow, and you’ll need ample disk space for the script to complete. To avoid this, I move the “BEGIN TRAN” statement to just above the batch delete statements.

BEGIN TRY

BEGIN TRAN t1

— delete PrincipalObjectAccess records in batches

exec(@deletestatement)
 

4.) Enabling Compression & SSL

The Outlook Client can provide a seamless and user friendly interface to your customer interactions. Tracking emails and automatically syncing contacts, appointments and tasks can be a great productivity gain for your users. While powerful, this tool is known to be a chatty, continuously sending a lot of data across your network. If not tuned properly, it can consume an excessive amount of your networks bandwidth, crippling other business critical applications and your team’s ability to function!
The chart below from the Optimizing and Maintaining a Microsoft Dynamics CRM 2011 Server Infrastructure whitepaper shows that enabling Compression and SSL can reduce the Outlook Client network traffic by 88 percent! We were a little skeptical that this would be the case, however after deploying, our heaviest individual users Outlook Client bandwidth consumption dropped from GBs to MBs per day.
 
    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)
 
 
To manually configure IIS dynamic compression:
 
a.) In Internet Information Services Manager, click the <Server name>, scroll down in the Features View to the Management section, and then start the Configuration Editor.
 
b.) In the Configuration Editor, in the Section: address box, type system.webServer/httpCompression, click dynamicTypes, and then in the value cell, click the ellipses . . . (three dots).
 
c.) In the Collection Editor, click Add and verify that Enabled is set to True and the inclusion of an entry for mimeType of application/soap+xml; charset=utf-8. Note that the appearance here is different than it was when using the appcmd command, which has URL encoded the plus symbol.
 
d.) Click one of the Items: collection cells, and then close the Collection Editor.
 
e.) In the Configuration Editor, under Actions, click Apply to add configure the new setting httpCompression mimeType.
 
f.) Run an IISReset to ensure that the compression setting is enabled for the new mimeType.

5.) Define system wide Outlook Sync Filters

By default, the Outlook Client filters are set to synchronize all contacts and activities owned by the user. This configuration works well for many clients, but in many cases it will make sense to narrow the scope of the synchronization further. The most common need for this is to pre-program the Contacts synchronization filter so that it will not automatically pull all CRM Contacts into a new user’s Outlook Contacts folder. Modifying this default filter will allows the users to selectively set up synchronization so that they don’t accidentally download hundreds of new records to their Outlook Contacts.
 
Unfortunately, there is no “supported” way reset these filters after the Outlook Client has been deployed. However, the default and user filters are stored in SQL tables and can be manipulated.

 

posted @ 2020-03-27 16:14  木子易  Views(538)  Comments(0Edit  收藏  举报