We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28673
    • 178 Posts
    Hi!

    http://reghellin.unbit.it/ferrarese/index.php?id=4

    The product pages are really slow to load. Sure, there are a lot of images. But I’m not too sure it’s only that.

    Is/are there any way/s to gain loading speed?

    The site is runnin under:

    MODx 2.0.8
    Apache 2.2 FastCGI
    System Linux cable 2.6.34.8-unbit
    mysql 5.5.9, utf-8
    pdo: ok
    no accelerators

    Thank you for any suggestions!



      • 28673
      • 178 Posts
      Ps.

      firebug says that it hangs 6-7 seconds before really starting to load the page.

      Also, it seems it does about 100 requests to this object, without finding it:

      /accounts/reghellin/www/reghellin.unbit.it/ferrarese/core/model/modx/mysql/xpdoobject.map.inc.php

      So what’s going on?
        • 33337
        • 3,975 Posts
        try Executioner Snippet to see whats causing the delay, as well try putting in the timing tags.

        http://www.jasoncoward.com/technology/2010/10/the-executioner-snippet.html

        [^qt^] - Query time
        [^q^] - Query count
        [^p^] - Parse time
        [^t^] - Total time
        [^s^] - Source
          Zaigham R - MODX Professional | Skype | Email | Twitter

          Digging the interwebs for #MODX gems and bringing it to you. modx.link
          • 33968
          • 863 Posts
          Your server is definitely taking it’s time before sending the page!

          Start with zi’s suggestion - add
          <!-- MySQL: [^qt^] s, [^q^] request(s), PHP: [^p^] s, total: [^t^] s, document retrieved from [^s^]. -->

          to your template and view source to see where your issues are likely to be.

          Are you calling all your snippets cached?
            • 28673
            • 178 Posts
            Hi you all!

            During the weekend happend an even more strange thing: the manager stopped to work. So we are now trying to solve this problem too by restoring a backup.
            So sorry, first I’ll solve this issue, then I’ll come back and follow you and let you know about results..

            Thank you
              • 28673
              • 178 Posts
              OK I’m back. I’ve isolated a particular chunk that is the one is causing the hang. It uses getResources to retrieve the list of products you can see on top of the page, the ones in the scrollable filmstrip. getResources is called twice: one for the main product families, and once for the products of each family, this way:

              [[getResources? &parents=`4` &tpl=`filmstrip-ul-li-tpl` &tplFirst=`filmstrip-ul-li-first-tpl` &showHidden=`true` &depth=`0` &sortby=`menuindex` &sortdir=`ASC` &limit=`15`]]

              AND in filmstrip-ul-li-tpl:

              [[getResources? &parents=`[[+idd]]` &tpl=`filmstrip-ul-li-ul-li-tpl` &tplFirst=`filmstrip-ul-li-ul-li-first-tpl` &includeTVs=`1` &showHidden=`true` &sortby=`menuindex` &sortdir=`ASC` ]]

              AND then, inside the filmstrip-ul-li-ul-li-tpl, there is this code:

              <li[[!If? &subject=`[[*id]]` &operand=`[[+id]]` &then=` class="active"`]]><h4>[[+tv.etichetta]] - <span class="orange">[[+pagetitle]]</span></h4><a href="[[~[[+id]]]]"><img src="[[+tv.img_confezione]]" alt="[[+pagetitle]]" border="0" width="[[!getImageWidth? &imagefile=`[[+tv.img_confezione]]`]]" height="[[!getImageHeight? &imagefile=`[[+tv.img_confezione]]`]]" /></a></li>​

              -----

              THE TRACES:

              From the same page I get this:

              <!-- MySQL: 0.0000 s s, 0 request(s), PHP: 2.2749 s s, total: 2.2749 s s, document retrieved from cache. -->

              AND (from Executioner, on the first getResources):

              [2011-03-29 12:08:04] (ERROR @ /ferrarese/index.php) modSnippet: getResources executed in 5.6554 s

              So isn’t it quite strange? And what could I do to solve the hang?











                • 33968
                • 863 Posts
                Bit of nesting going on there! From experience that’s not always the best way to get things done and tends to impact on performance.

                But first - does it make any difference if you call ’If’ and ’getImageWidth’ cached? Do you even need ’getImageWidth’? It seems the images are a fixed size, could you hard-code them?

                Going by your product structure I wonder if you could use Wayfinder instead to recreate the nested lists without having snippets inside snippets... with getResourceField to pull in the images.


                Also, and this is nothing to do with performance: I couldn’t understand where all the other products were on your page. I could only see five ’Casericci’. Took me a few minutes before I realised the red bar below the images was actually a scrollbar! You might want to make that more apparent by contrasting the slider and buttons.

                Or you could solve all of your problems by featuring only the product families on this page and showing the individual products on a child page.

                The site does look nice and the product images look great by the way smiley
                  • 21838
                  • 284 Posts
                  What if you call the if snippet cached? Did you updated to getResources 1.30pl?
                    MODX Free Template Base: MODX-Boilerplate | my blog (lots of MODX stuff) | my gitHub (translations) | MODX User Groups Germany (Facebook)
                    • 28673
                    • 178 Posts
                    @lucas and @smooth-graphics

                    Thank you! A lot of good suggestions here smiley

                    Well, I then cache if and getImageWidth, but saw no performance improvements. And yes, I need getImageWidth.

                    I’ll take in account the possibility of using wayfinder, yes. I also think you’re right saying that then nesting thing is bad.

                    As for the design/colours, well.. I know, but I’m not the designer here: I’m programming this site for a graphic agency.. If it was me.. Well, I wouldn’t do the product slider too, I think it’s not usable at all and also adds about 1.5 Mb to the total page size... Bleah! wink

                    Thank you, I’ll let you know if I found a way to optimize this page. So someone with the same problem can read.

                      • 3186 ☆ A M B ☆
                      • 279 Posts
                      Quote from: zi at Mar 26, 2011, 07:32 AM

                      try Executioner Snippet to see whats causing the delay, as well try putting in the timing tags.

                      http://www.jasoncoward.com/technology/2010/10/the-executioner-snippet.html

                      [^qt^] - Query time
                      [^q^] - Query count
                      [^p^] - Parse time
                      [^t^] - Total time
                      [^s^] - Source

                      Thanks for the usefull snippet! I wasn’t aware of this one... I found a big problem in one of my own snippets, wich retrieves the toplevel resources for viewing the main menu. Here some code parts from the small snippet... When I comment this out, the snippet runs in 0,01x seconds, instead of 3.25x

                      foreach($resources as $resource) {
                            
                            $placeholders = array(
                              'id' => $resource->get('id'),
                              'pagetitle' => $resource->get('pagetitle'),
                              'alias' => $resource->get('alias'),
                              'idx' => $idx,
                            );
                      
                            $output .= $modx->getChunk($tpl, $placeholders);
                            
                            $idx++;
                      }


                      Inside the chunk also a new snippet is called for loading subs of the parent, with some filter on a tv to seperate the pages for left view or right view.

                      Also printed the html output like this; it’s telling me that he’s loading a lot...

                      <!-- MySQL: 0.0000 s s, 0 request(s), PHP: 10.5269 s s, total: 10.5269 s s, document retrieved from database. -->
                        MODX Ambassador (NL) & Professional MODX developer
                        Follow me on Twitter | Visit my page on Facebook | View my code on Github | View my script posts
                        MODX e-commerce solution SimpleCart