Hi Suresh,
You can try object caching on block levels with the help of the ISynchronizedObjectInstanceCache
interface.
Thanks,
Sanjay Kumar
Hi Suresh,
One thing that slows down the initial (first request) calls is the view compilations as the views need to be compiled (in Episerver we can't use the precompile views optiosn, because it will not work in Episerver projects because Episerver adds programmatically VirtualPathProviders see the answer by Johan).
Without actually knowing what happens in your views - you could be calling tens of other views or the view might be a bad boy and call some services and do heavy work, which could be the slowness issue here. One thing that really can make a difference during view compilation is a slow traditional HDD VS SSD. Real world case of an Azure App Service using traditional HDD the warm up request took 70 seconds, the App Service plan was changed to one that uses SSD with the same CPU power and initial call dropped to 35 seconds!
So in what kind of environment is this happening if the slowness issue is not in your code?
Hi Antti,
Currenlty application is hosted in Episerver DXC. This issue is happening in all three environments(Integration, preproduction & production).
This performance issue is occuring for very simple partal actions as well. Below is one of sample partial action method causing the issue(here I am doing ajax call to load the one of episerver page content using IContentRepository)
public ActionResult UserAcknowlegdePolicy(UserAcknowledgementType userAcknowledgementType)
{
var privacypage = (userAcknowledgementType == UserAcknowledgementType.PrivacyPolicy) ?
_contentRepository.Get<StandardPage>(_siteSettings.SettingsPage.PrivacyPolicy)
: _contentRepository.Get<StandardPage>(_siteSettings.SettingsPage.TermsAndConditions);
UserAcknowledgementViewModel model = new UserAcknowledgementViewModel();
if (privacypage != null)
{
model.MainBody = privacypage.MainBody;
model.Header = privacypage.PageTitle;
}
return PartialView("~/Views/Shared/_UserAcknolegdePolicy.cshtml", model);
}
@model UserAcknowledgementViewModel
<div class="modal-header">
<h5 class="modal-title">@Model.Header</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body bg-light">
<div class="row">
<div class="col-12">
@Html.Raw(Model.MainBody)
</div>
</div>
</div>
Thanks,
Suresh B
I weould proceed with profiler. Work together with Episerver support to get trave files for the 1st requests. Then you can analyze and see where exactly time is spent. It could zillions of root causes - starting with IO (and as Antti mentioned - access to hard disks) or ending with custom http modules that could be plugged into your request pipeline.
I have requested to enable profiler but unfortunately it is not tracking those kind of requests. Sometimes noticed below message for few requests
"50% of this request was spent in waiting. Wait for a resource to be available" but i am not able to dig into more details about this waiting.
For testing, I have created very simple partial request(i.e just return partialview()) and hosted in Episerver integration environment and this request also taking min 10seconds to load for initial request. This issue is happending mutiple times in a day (but not everytime).
Is there any settings which can override compilation debug settings in Episerver DXC? In MVC views renderpath will be cached to improve the render performance. So just thinking this is causing any issue.
And also i have requested epi team to provide report on application recycle so may be my application is recyling multiple times in a day.
What i confused about my issue is, i have custom webpage and it has 10 partial views(i.e. will load on demand) so here sometimes(i.e. may be 2 or 3 times) these 10 requests initial request taking 10+ seconds and subsequenct requests are fine.
Can any one provide suggestions on this to resolve my issue?
Thanks,
Suresh B
Hi Team,
I am facing lot of performance issues with Partial views in CMS across the application. This issue is happending only for first request and subsequent requests are very quick. Very simple partial action method also taking min 10+ seconds to load for the first time.
First request issue is for all partial views. Lets say, i have two partial views in two different pages so in every page facing this performance issue.
This issue is happening mutiple times in a day.
Below is one sample examples in controller & views to return the partail view:
return PartialView("~/Views/IndustryPage/_Survey.cshtml", model);
Html.RenderPartial("~/Views/Shared/PagePartials/_Questions.cshtml", Model.Questions);
Below is the custom view engine configured in my application for episerver blocks.
/// <summary>
/// Extends the Razor view engine to include the folders ~/Views/Shared/Blocks/ and ~/Views/Shared/PagePartials/
/// when looking for partial views.
/// </summary>
public class SiteViewEngine : RazorViewEngine
{
private static readonly string[] AdditionalPartialViewFormats = new[] { TemplateCoordinator.BlockFolder + "{0}.cshtml" };
/// <summary>
/// Initializes a new instance of the <see cref="SiteViewEngine"/> class.
/// </summary>
public SiteViewEngine()
{
PartialViewLocationFormats = PartialViewLocationFormats.Union(AdditionalPartialViewFormats).ToArray();
}
}
Can any one help to to fix this issue? This issue is effecting entire application performance.
Thanks,
Suresh B