none
Customer Portal is very slow

    Question

  • Hi,

     

    I have deployed two separate instances of the Customer Portal for CRM 2011. I have followed the documentation for the deployment and authentication using ACS and the portals are up and running. However both portals are very slow. Navigating through the pages of the portal it takes 15-20 seconds for each new page to open.

    The website is hosted using windows Azure hosted service and the portal is connecting to a Dynamics CRM online application.

    Has anyone else encountered this behaviour?

    Best Regards

    Henrik

    Monday, January 09, 2012 9:52 PM

Answers

  • It sounds like you have taken the steps to make it work, but one little thing could make it not work.  The symptoms you say where the site is fast at the start, then a few minutes later it is slow is DEFINATELY related to the WIF-in-GAC issue.  I recommend RDPing to your Azure server and confirming that the assembly is actually in the GAC after all your startup tasks are done.  For our scripts, we usually put the WIF SDK in our Azure package and install it with a startup script, but have done it with just a GACUTIL command.  Here is my startup script for one Azure site that is running stable:

    %windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.processModel.loadUserProfile:true

    %windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.processModel.idleTimeout:00:00:00

    gacutil /nologo /i .\Microsoft.IdentityModel.dll

    exit /b 0


    Shan McArthur www.shanmcarthur.net Check out the commercial edition of xRM portals @ www.adxstudio.com
    • Marked as answer by a_Henrik Saturday, February 11, 2012 10:26 AM
    Wednesday, January 25, 2012 8:50 PM
    Moderator

All replies

  • Same problem here.


    Terry McCullagh
    Tuesday, January 10, 2012 10:44 PM
  • Same here with on prem and ACS.
    Friday, January 13, 2012 4:00 PM
  • Can someone from Microsoft provide their perspective?


    Terry McCullagh
    Friday, January 13, 2012 4:13 PM
  • It seems to be where the lists are bound to a CRM view.

    If I comment out this line in ViewCases.aspx.cs :

    CaseList.ColumnsGenerator = new CrmSavedQueryColumnsGenerator("Cases Web View");

    After the first load everything is nippy. Beyond than not sure where the slowness comes from.

    Marcus

     

    Tuesday, January 17, 2012 12:30 PM
  • If you are using the latest version of the portals, it is imperative that you install the WIF SDK in your GAC.  There is a bug in ASP.NET that breaks the ASP.NET cache after the first polling interval when using WIF.  The resolution is to install WIF in the GAC.


    Shan McArthur www.shanmcarthur.net Check out the commercial edition of xRM portals @ www.adxstudio.com
    Tuesday, January 17, 2012 11:28 PM
    Moderator
  • Thanks Sean - I will give this a try and let you know if the issue is resolved.
    Terry McCullagh
    Monday, January 23, 2012 12:30 PM
  • Hi Shan,

    Can you confirm how I can verify if the WIF is succesfully installed in the GAC. I beleive it is, but the portal is still running slow.

    Marcus

    Tuesday, January 24, 2012 6:37 PM
  • The portal caches everything and runs very quick.  As such, there must be something wrong with the configuration.  To check the GAC to rule out WIF being a problem, run this command on your web server (and developer workstation).

    C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>gacutil /l microsoft.iden
    titymodel
    Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.1
    Copyright (c) Microsoft Corporation.  All rights reserved.

    The Global Assembly Cache contains the following assemblies:
      microsoft.identitymodel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf
    3856ad364e35, processorArchitecture=MSIL
      microsoft.identitymodel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf
    3856ad364e35, processorArchitecture=MSIL

    Number of items = 2

    If you do validate that WIF is indeed in your CAG, please turn on asp.net tracing, go to the home page and refresh a couple of times, then send me a trace.axd output of the next home page request.  This will give me some timings to help validate the issue.  If the web page is running less than 50ms, then we should look for other errors.  This would mean using fiddler to capture a trace and seeing the response times for the entire page and all the dependencies to load.  If you want, you can send the trace files directly to me at firstname.lastname@adxstudio.com and then we will update this forum post with the end results.


    Shan McArthur www.shanmcarthur.net Check out the commercial edition of xRM portals @ www.adxstudio.com
    Tuesday, January 24, 2012 7:37 PM
    Moderator
  • Thanks. Had been silly and checked on my CRM server, rather than the portal web server!

    Seems much better, will see how it goes.

    Thanks,

    Marcus

    Tuesday, January 24, 2012 8:27 PM
  • I am having the same problem. I put the Microsoft.IdentityModel.dll in the GAC and it seemed to speed up subsequent pages on my development machine. I used this (http://blogs.infosupport.com/adding-assemblies-to-the-gac-in-windows-azure/) procedure to try to put the Microsoft.IdentityModel.dll in the GAC on azure.  This is my first azure application, so please be patient with me if I am missing something obvious. On the development machine the contact us page loads in < 2 seconds, from azure, it takes over 23 seconds (even if it is not the first page of the site loaded) so I am guessing that I did not do this right since I can’t imagine that this level of performance would satisfy anyone.

     

    My RegisterGAC.cmd file is a text file with this text

    gacutil /nologo /i .\Microsoft.IdentityModel.dll 

    exit /b 0

     

    I put the RegisterGAC.cmd and the gacutil.exe in the Customer Portal Web Project with copy always set to true. The Microsoft.IdentityModel.dll reference also has copy local set to true. The RegisterGAC.cmd and the gacutil.exe are copied to the bin as is Microsoft.IdentityModel.dll. folder I tried with the gacutil.exe in “C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools and as that didn’t work, I also tried with C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\x64”.

    I added this startup task to my webrole

      <WebRole name="CustomerPortal" vmsize="Small">

        <Startup>

          <Task commandLine="RegisterGAC.cmd" executionContext="elevated" taskType="simple" />

        </Startup>

     

    This did not seem to solve the load problem, so I also tried option 2. Wasn’t sure how to figure out which file was appropriate for azure so I tried both. Sometimes the first couple of minutes after deploying were very fast, but then very, very slow. Often the first click on a link caused the little spinning symbol next to cloudapp.net  to spin for a second or two and then just stop without finding the page. When it did find the page it was over 20 seconds, sometimes over 25 to get something like the contact us page up.

     

    Can anybody give me some insight on this? Does anyone have this hosted on azure with reasonable speed, and if so, how can you install and/or verify the Microsoft.IdentityModel.dll  in the GAC in azure.

     

    Thank you.

    Wednesday, January 25, 2012 8:04 PM
  • It sounds like you have taken the steps to make it work, but one little thing could make it not work.  The symptoms you say where the site is fast at the start, then a few minutes later it is slow is DEFINATELY related to the WIF-in-GAC issue.  I recommend RDPing to your Azure server and confirming that the assembly is actually in the GAC after all your startup tasks are done.  For our scripts, we usually put the WIF SDK in our Azure package and install it with a startup script, but have done it with just a GACUTIL command.  Here is my startup script for one Azure site that is running stable:

    %windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.processModel.loadUserProfile:true

    %windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.processModel.idleTimeout:00:00:00

    gacutil /nologo /i .\Microsoft.IdentityModel.dll

    exit /b 0


    Shan McArthur www.shanmcarthur.net Check out the commercial edition of xRM portals @ www.adxstudio.com
    • Marked as answer by a_Henrik Saturday, February 11, 2012 10:26 AM
    Wednesday, January 25, 2012 8:50 PM
    Moderator
  • This script worked! Thank you so much, Shan. It is such a relief to see the pages come right up.

     

    Friday, January 27, 2012 7:43 PM
  • The WIF dlls fixed the problem for me, thanks Shan. We have on-premise CRM 2011, the portal would be fine for a minute or two and then start to slow down with every page taking 10+ seconds to load, eventually experiencing a timeout and falling over. But it's fixed now!

    Tuesday, February 07, 2012 9:25 AM
  • Thank you Shan!

    Adding the WIF DLLs to the GAC solved the problems for me

    Saturday, February 11, 2012 10:26 AM
  • Is this apply for the on premise solution ?

    Thank you in advance.

    yoann

    Friday, February 24, 2012 1:29 PM
  • Yes, this is a bug in ASP.NET (which will be fixed in .Net 4.5).  It applies to all environments, on-prem, partner-hosted, and online (Azure/Amazon/Rackspace).

    Shan McArthur www.shanmcarthur.net Check out the commercial edition of xRM portals @ www.adxstudio.com

    Friday, February 24, 2012 2:56 PM
    Moderator
  • Shan's answer is definitely right.  Make sure you copy the gacutil.exe and gacutil.exe.config from \program files (x86)\microsoft sdks\windows\v7.0a\bin
    Thursday, May 03, 2012 2:11 AM
  • Hi Shan,

    We have excellent performance on the portal except for the first page which takes 30 seconds easily to load. If you open another browser session right after that, the first page loads just fine as do the other pages. I seem to recall reading about this when I was still using DotNetNuke as a CMS system. Something about recycling a worker process or something to that extent. Can you shed some light where we might need to make some adjustments to get the first page to load as fast as the others?

    Many thanks

    Aad

    Friday, May 11, 2012 8:31 PM
  • Aad,

    On the first page load, nothing is in cache, so the portal goes to CRM and queries for all of the data.  Look at how many different pieces are on the page - header, primary nav links, content, sidebar links, footer content, footer links, breadcrumbs, as well as how many different site settings that influence the CSS of the site.  I think there are around 50 or so different pieces.  The delay on the first page is simply the portal going to CRM to get the data.  The portal then caches everything it gets so that your second page is not 30 seconds too.  Once data is cached in the portal, the portal goes nice and fast. 

    At Adxstudio we have spent a considerable amount of time tuning our commercial edition of the portal, including addressing the problem with intermittent errors on the web when going from Azure to CRM Online.  We have spent some significant effort in pre-loading dictionaries in a single query to reduce the number of queries that have to go to CRM even on the first page.

    The bottom line is that if you are at all concerned about performance or reliability, the best option is to use the commercial edition from Adxstudio because they are continuing to invest in R&D on the portals and release new builds all the time, where the free Microsoft ones are just getting small bug fixes and are only updated about once per year.


    Shan McArthur www.shanmcarthur.net Check out the commercial edition of xRM portals @ www.adxstudio.com

    Friday, May 11, 2012 8:41 PM
    Moderator
  • Hi Shan,

    We have also recently deployed the CRM Customer portal using Windows Azure and an On-Premise Dynamics CRM Installation. The functionality of the portal seems fine, but the web page load times are very slow. When using the F12 option in IE, the "time to first byte" on the home page is 11.2 seconds.

    I appreciate this is a vaugue description of the issue,but wondered if you could help at all.

    One thing I have noticed is that if we use http://localhost on the web server for the portal, it seems to run fine after an initial load period. (Like it's caching the pages). However, when we use the external link to the azure plaform, it takes a very long time to load any of the pages, and doesn't seem to cache any of it.

    I've installed the WIF on both our web server and also the CRM database/web front end server. And also the .net update. Both Servers are totally up to date too.

    Any help you can give us would be greatly appreciated. The functionaloty of the portal seems excellent and just what we needed, but the speed issue is stopping us from deploying it to our clients.

    Thanks in advance.

    Tom

    Friday, May 18, 2012 9:32 AM
  • Hi

    I have what sounds like the same problem. After I login, the welcome page comes up quickly, but clicking on cases or doing a knowledge base search has a 60 second delay the first time I do it. It I logout and back in again, I get the same result. When I click cases, the web server is downloading lots of data, presumably from CRM (approx 1Mb/sec for the whole 60 secs).

    Confirmed that the WIF is in the GAC. Also, perhaps a co-incidence, but when I try to edit a page, I get an error immediately after clicking the edit link.

    Am using CRM Online and the Customer Portal is installed on an Azure Small instance.

    Any ideas?

    Cheers

    Matt

    Monday, May 21, 2012 12:02 AM
  • I shifted Matt's portal from "North Central US" to "West US" in windows azure and the portal now responds somewhat faster.  I suspect that i've just put a band-aid on the solution though by moving the azure portal instance closer to the CRM instance rather than fixing the root cause.

    FYI the 'latency/bandwidth" between the azure instance and crm went from 65ms & 315KB/sec, to 4ms & 30MB/sec, when we moved the Azure instance to the West US location.

    --

    Regan


    http://www.oasystems.co.nz | OA Systems Ltd | CRM Solution of the Year at the Microsoft NZ 2010 Partner Awards

    Monday, May 21, 2012 4:14 AM
  • Hi Shan,

    After much reading on how to get the Windows Identity Foundation to be installed on the Azure side of things using a starup script and packing that in with the Azure deployment, i gave up.

    Turn out the answer I needed was on the 2nd line in your post! I enabled Remote Desktop for our Azure deployment, connected up to it using the credentials I setup in the wizard, then installed WIF manually. Worked like a charm!

    Was a close call though as we had a meeting to demo the portal the morning after! Thankfully all was well.

    Thanks again for your advice, I've read most blogs/forums out there now on CRM and you always seem to be in the mix giving good solid advice.

    Cheers.

    Tom

    Friday, May 25, 2012 3:52 PM
  • yes this helped a lot.

    brief summary what I did.

    Create RegisterGAC.cmd (save in Studio as UTF-8 without signature)

    %windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.processModel.loadUserProfile:true
    %windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.processModel.idleTimeout:00:00:00
    gacutil /nologo /i .\Microsoft.IdentityModel.dll
    exit /b 

    Copy RegisterGAC.cmd  gacutil.exe C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin to CustomerPortal Project in VS 2010 just D&D [should be in a 7.0 folder but didn't have one]

    Set Copy Always for "Copy to Output Directory"

    Edit: ServiceConfiguration.cscfg change osFamily="2" and ServiceDefinition.csdef via VS 2010

    <Startup>
         <Task commandLine="RegisterGAC.cmd" executionContext=“elevated“ taskType=“simple“ />
       </Startup>

    Now Portal is very fast even on a small Azure VM :-) thanks for this thread, should be in the FAQ or sticky

    Friday, November 30, 2012 9:07 PM
  • You can also now use osversion=3 which is Windows 2012 Server and it no longer requires the registration of WIF in the GAC.

    Shan McArthur www.shanmcarthur.net Check out the commercial edition of xRM portals @ www.adxstudio.com

    Friday, November 30, 2012 9:20 PM
    Moderator
  • Hi Shaun/Tom, I rRDP  into WIndows Azure (win 2008 R2) but am not sure where to deploy the Microsoft.IdentifyModel.dll (if i understand this correctly). Appreciate if you could mention that. 

    I am installing  the latest azure sdk 1.8 that will allow for osFamily 3 then hopefully I don't need to install WIF. 

    Monday, April 15, 2013 6:08 AM
  • setting osFamily="3" in the ServiceConfiguration file fixes the problem when deploying to Azure.
    Wednesday, August 21, 2013 12:25 AM