3

Sitecore 8.2 Update 1, hosted in Azure web apps. Noticed that, every first request is very slow to load. After 2nd request, the site loads pretty quick.

We use Glass Mapper map Sitecore templates on to strongly type in our solution.

Some examples on, how we retrieve item and items includes:

To get single item:

var myModel = _contentService.GetEntity<myModel>(renderingContextItem.ToString());

To get sub items:

_contentService.GetEntity<IMenuItem>(navigationRootItemId)

[SitecoreChildren(IsLazy = true)]
public virtual IEnumerable<IMenuItem> SubItems { get; set; }

Ants profiler shows that Glass Mapper GetModel as HOT path below: enter image description here

Would be get your thoughts on above implementation and why ANTS profiling is complaining about Glass Mapper.

Update:

Here's the code snippet :

 public partial class MenuItemEntity
 {
       /// <summary>
       /// Gets or sets the sub items for a menu item.
       /// </summary>
       [SitecoreChildren(IsLazy = true)]
       public virtual IEnumerable<IMenuItem> SubItems { get; set; }
 }


 public TModel GetEntity<TModel>(string identity) where TModel : class
 {
      return _context.GetItem<TModel>(identity);
 }
6
  • Can you post one of your models and the GetEntity<T> method? The reason could be also the item reads - sitecore.stackexchange.com/questions/4924/… Apr 28, 2017 at 7:38
  • @TamásTárnok, sure I've updated the question with code snippets.
    – Nil Pun
    Apr 28, 2017 at 11:01
  • Glass (depending on version) used to compile the views in order to determine what model is to be used and cache the result. During first load this can cause a delay. In later versions of Glass, this was changed.
    – Nat
    Apr 28, 2017 at 14:23
  • we are using glass mapper 4.2.188
    – Nil Pun
    Apr 28, 2017 at 23:02
  • Can you please post more of the ANTS call stack May 4, 2017 at 11:20

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.