Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Stas 13 posts 63 karma points
    Jun 09, 2016 @ 13:07
    Stas
    0

    UmbracoHelper.TypedContentAtRoot() extremely slow when U have a lot of child nodes

    Hi Dear Everyone,

    Please help with UmbracoHelper performance.

    Short story:

    1. I have quite simple content structure: project->user->stuff
    2. While I have to identify project by some internal fields I did it like this:

      Umbraco.TypedContentAtRoot().Where(....

    3. Everything was perfect until the moment when in some project I got almost 2k child nodes (User type) and performance slowed almost to 100 times! (from ~100-200mc to 10-20seconds)

    I played with structure and figured out that initializing Children isn't lazy, and every time when I just need to get list of root nodes I'm getting the list of Initialized Children.

    I fixed it by getting root nodes from (as U said - very slow and not preferable way for getting content) "ContentService" - it's not that fast, but obviously faster what I have now.

    P.S. I'm open with any kind of suggestions regarding possible ways to solve it in right way (not just changing structure - cause for me it's normal situation when U have a lot of subNodes) or just ask Umbraco Core team to get Children lazy.

  • MarcC 49 posts 356 karma points
    Jun 09, 2016 @ 13:54
    MarcC
    0

    Hi StasN,

    Would love to help but I might need a bit more, I am not sure of another technique than the one you are using that would be faster, I am curious to know what the internal fields you are looking at are?

    Is it for example id and name checks or something more complex such as items with a particular node selected within a node picker property type?

    Atb,

    M

  • Stas 13 posts 63 karma points
    Jun 10, 2016 @ 09:02
    Stas
    0

    Hello MarcC,

    Thank U for your question.

    U are absolutely right, I was trying to filter my rootNodes by some custom fields, like this:

     _umbracoHelper.TypedContentAtRoot().Where(n => n.HasProperty(Defaults.PROJECTCODE_ALIAS) && n.HasValue(Defaults.PROJECTCODE_ALIAS) && (n.GetPropertyValue<string>(Defaults.PROJECTCODE_ALIAS) == _model.GetProjectCode())).FirstOrDefault();
    

    But! when I did like this:

    _umbracoHelper.TypedContentAtRoot().ToList()
    

    trying to materialize nodes and then filter them, I got exactly the same delay, I mean around 10-20 seconds on ToList() step just for 9 root elements! (only few of them, have 1k or 2k child nodes, all other not that big)

    P.S. I apologize that I haven't done it at first, here is some additional tech info regarding my project:

    • Umbraco 7.4.1 & 7.4.3 (I got exactly the same delay with ToList() withput any rule in each of them)
    • My umbraco.config file is only 1.5M
    • all other settings are default as for Nuget package
  • Alex Skrypnyk 6131 posts 23950 karma points MVP 7x admin c-trib
    Jul 18, 2016 @ 21:33
    Alex Skrypnyk
    0

    Hi Stas,

    Can you show all code of your view?

    By the way, did you try to use caching?

    Its really cool helper ChachedPartial, read more - https://our.umbraco.org/documentation/Reference/Templating/Mvc/partial-views

    Thanks,

    Alex

  • Stas 13 posts 63 karma points
    Sep 02, 2016 @ 14:56
    Stas
    0

    Hi Alex,

    Sorry for the late reply.... I missed notification somehow.

    So, the main point is - that it's pilot project where I decided to use Umbraco as "Content holder + Admin Panel" only, so I dont' have any template/view in my project. All clients just using REST.

    Yes, I agree that, cache may be used even in my case, but damn, there are up to 20 elements at root level :( ...

Please Sign in or register to post replies

Write your reply to:

Draft