We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24812
    • 7 Posts
    patch, I’ve had similar problem.

    Add &depth=`1` to your all getResources calls where you list only one level of resources. gR by default has depth set to 10 and checks all children if they have another children and so on.

    Then install getPage snippet, find declaration of $properties[’cachePageKey’] and modify it to this (around line 30):
    ...
    if ($properties['cache']) {
        $properties['cachePageKey'] = $modx->context->get('key') . '/elements/'. $properties['element'] .'/' . $properties['page'] . '/' . md5(implode('',$scriptProperties).implode('', $modx->request->getParameters()));
    ...
    


    and change getResources calls to:
    [[!getPage?
    &element=`getResources`
    &elementClass=`modSnippet`
    &cache=`true`
    
    ... (rest of getResources parameters) ...
    ]]
    


    This will not speed up first page view after clearing the cache, but will improve rendering times for uncached pages that use common getResources calls. That’s why the modification is needed (by default getPage caches snippet output per document, not global).

    Also, use as little chunks as possible - they take time to load when there’s no cache.

    After all this (I do not remember now if I did something else) rendering time dropped from 10s to 4s for uncached, for uncached that use common snippet calls 2s. When cached 0.15 to 0.6 most of the time.

    All done on this site http://www.iqfm.eu which has very time consuming tabs on right of the screen. The site is on good, but shared server.

    Hope this helps. ;-)
      • 22303 MODX Staff
      • 10,725 Posts
      @remek: That would be a great feature request to getPage at GitHub. Any chance you could open a ticket for providing an option to have it be able to get data from global cache entries vs. Resource specific?
        • 24812
        • 7 Posts
        OpenGeek. Yes, no problem... as soon as I’ll understand how GitHub works grin

        Actually I use getPage to call almost all snippets (wayfinder, custom). Pages are served much faster after clearing cache.

        And to all you developers. Great job!

        BTW OpenGeek, can you have a look at this? I had to hack manager/index.php as temp solution http://modxcms.com/forums/index.php/topic,54275.msg319937.html#msg319937
          • 8168
          • 1,118 Posts
          Does anyone know if 1.2.1-pl of getResources addresses this load lag? I am also noticing it quite a bit on the site I am developing and would love it to load quicker if possible!

          I will go through and add the &depth=1 to all calls as well, but would rather not hack the core if at all possible here...


          Cheers,

          dubbs.
            • 25663 MODX Staff
            • 12,272 Posts
            dubbs you need to provide more information about your call, caching, other snippets, plugins, number of resources, server, etc., in order to be able to offer advice.
              Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
              • 8168
              • 1,118 Posts
              Thanks Ryan, have posted some details on a similar thread here - http://modxcms.com/forums/index.php/topic,55739.0.html

              RE: Caching, I have not changed anything from the default settings



              Cheers,

              dubbs.
                • 23702
                • 6 Posts
                Hi remek

                Patch and I wanted to thank you as thev Add &depth fix seems to have resolved the issue. Now we can all sleep a little bit better knowing we’re not the interactive studio who’s website takes 12 secs to load wink