We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27210
    • 158 Posts
    Local Environment:
    - MODx Revo 2.0.8-pl
    - XAMPP for Windows Version 1.7.3
    - Windows 7
    - Server: localhost via TCP/IP
    - Server version: 5.1.41
    - Protocol version: 10
    - User: root@localhost
    - MySQL charset: UTF-8 Unicode (utf8)
    - Web Server
    - Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1
    - MySQL client version: 5.1.41

    I’m having performance issues. This page http://www.seaville-suzuki.com/motorcycles-2011-models/ and other similar aggregator pages are very slow to load. Basically what the page does is call getResources to pull out 15 records from the database.

    I’m new to the MySQL / php world so i’m probably doing many things wrong but i was wondering if you could see any glaring errors in what i’m doing.

    I did compress my main css file which is quite large (24k) and i know that my class names are long (i’m old and crs) but this all seems insignificant in the total page size.

    So is my problem in the database access portion? How can i debug this?

    Any suggestions would be greatly appreciated.

    Thanks,
    Steve

    edited to add: I did optimize the mysql tables.

    Also, here is my call to getResources:
    [[!getResources? &parents=`4` &tpl=`ProductListingBoxTpl-even` &includeTVs=`1` &processTVs=`1` &sortby=`menuindex` &sortdir=`ASC` &limit=`0` &hideContainers=`1` &resources=`-32,-27` ]]

    edited to add:
    crud - removed the call to getResources, problem still exists - now the page is hardly loading anything...



      • 33968
      • 863 Posts
      Hi there, it looks like something is going on in the back end (database/server) that is causing the long wait.

      You can follow the suggestions in this post to try and narrow down the issue: http://modxcms.com/forums/index.php/topic,62687.msg355676.html#msg355676

      Add the tags I suggested to your template and you’ll see if the wait is happening in the database, php or perhaps a server issue.

      Do you need to call getResources uncached? Once cached, it should speed things up (although I can’t see why it is so slow for just 15 resources).

      Also, if it’s possible, move all your external .js files to the end of your html (just before the </html> tag). Otherwise your visitors will have to wait for all your javascript files to download before the browser will begin rendering the page.
        • 25663 MODX Staff
        • 12,272 Posts
        Call it cached and turn off TV processing if at all possible. Don’t include TVs at all unless they’re absolutely needed in fact.
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
          • 27210
          • 158 Posts
          Thanks for the answers guys!

          I changed to call i not cached (which made subsequent calls much faster of course) but unfortunately i use tvs to populate the data.

          Right now i’m trying to get Wayfinder to work instead.
            • 33968
            • 863 Posts
            Seeing that the performance issue is still there even when getResources has been removed I think you should try to work out where the problem is first.

            I’ve used it with tv processing on for many more than 15 resources - not ideal but I haven’t noticed a performance hit.
              • 27210
              • 158 Posts
              I replaced the getResources with Wayfinder and the load time is about 70% better.

              Lucas - I’m not sure why i was seeing problems when i commented out the call to getResources - i must have screwed something up.

                • 33968
                • 863 Posts
                Ah, using html comment tags around a snippet will hide the output but the snippet will still be parsed by modx. Better to remove it completely or add some random characters to the snippet tag (such as getResourcesXX) so it will be ignored.

                Glad Wayfinder is working for you there!

                If you want to see what else might be slowing your page, use Firebug or this great online performance tool: GTmetrix.com

                A few things I noticed (to get you started):

                • Ensure you are calling Wayfinder cached if you are not already
                • Optimise/compress your images
                • Use the minified version of jQuery which is about 80% smaller in file size than the development version you are using
                • Place scripts at the end of your html if you can to allow the html and css to load first (feels much quicker for the visitor)
                • Some of your linked css and js files return 404s which are wasted requests on the server; remove those
                • Try to combine some of your css or js files to cut down on requests to the server. You have 8 external scripts and 7 css files- that’s really a lot. The Minify script will do most of this for you and it’s easy to set up smiley
                  • 27210
                  • 158 Posts
                  Lucas - thank you so much for the great info!

                  I’m slowly learning the finer points of web development. I worked for a guy for 2 years that used nothing but tables. Having come from a programming background i knew there had to be a better way and then i discovered web 2.0, MODx, etc.

                  I’m still completely in the dark on most debugging methods for web work although i have discovered firebug which is terriric.

                  I will do all of the things you mentioned above.

                  One question - how did you determine that some of your linked css and js files return 404s.

                  Thanks again,
                  Steve
                    • 3749
                    • 24,544 Posts
                    Do a "View Source" in FireFox and click on the highlighted file links. The ones that don’t come up are not at those locations.
                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting
                      • 27210
                      • 158 Posts
                      Thanks BobRay!