We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 48390
    • 27 Posts
    I have just set up my first site in MODX Revolution 2.3.1 www.bountifulbotanicals.com and it appears to be very very slow. The loading time is over 7s with the browser's cache cleared. I've used approx. 35 TV's, there are no snippets and the site only has one page.

    Any suggestions how to bring the site's loading time down?

    Thanks.
      • 3749
      • 24,544 Posts
      One thing that slows down the site a lot is using a getResources call that references a lot of TVs, especially if it is searching by TV values. TVs are very slow for a number of reasons.

      Of course there are other causes of slow page loads, like an overburdened shared server, lots of large images, and bad caching strategies.

      If the TVs are the main problem, though, using ClassExtender to extend modResource can help a lot. It allows you to get rid of the TVs and put the data in a custom DB table, which makes things *way* faster. You can often get what you need with a single database query instead of having getResources make dozens of them.

      See this for more info.: http://bobsguides.com/blog.html/2014/06/02/why-extend-modresource/

      TVs are fine for storing page-specific data if you don't have very many of them and don't use them in getResources. They are not good at all, however, for storing often-used data that you need for searching and sorting.
        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
        • 42046
        • 436 Posts
        You could also try pdoResources and pdoMenu from pdoTools instead of getResources and Wayfinder, it's way faster. And be sure to pay attention to including and processing TVs only where necessary.
          • 48390
          • 27 Posts
          I am actually not using getResources at all, just a lot of TVs.

          Images are small sized and besides them, just a couple JS plugins..
            • 42046
            • 436 Posts
            You could try enabling compression in htaccess and browser caching through script and css versioning

            There's 2 bad links which are causing 404's:

            http://www.bountifulbotanicals.com/.../jquery.nailthumb.1.1.min.css
            http://www.bountifulbotanicals.com/assets/images/bgimg.jpg

            Are all the images specified through separate TVs? If so try a MIGX gallery to reduce the number of individual TVs.

            Also stick your javascript at the end before the body tag

            edit: Pagespeed is also reporting that you could save 1.2mb in load by compressing the images a bit more. [ed. note: absent42 last edited this post 12 years, 1 month ago.]
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Keep in mind that every image that isn't found will trigger a load of MODX, which will have to generate the "not-found" page for it.

              I like to use a variation on BobRay's LogPageNotFound, to use the snippet in a Dashboard widget so that you can see at a quick glance every MODX not-found event.

              Not only does this help you with getting your images and other internal links fixed, it can also let you know when somebody is hammering your site trying to break in, so you can see about banning their IP address.
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 48390
                • 27 Posts
                Thanks everyone for your suggestions. I am going to try them all. The thing about the image compression, browser caching, css minification...etc is that the site loaded in no time before it was converted into MODX. So I didn't think it would have any significant effect.
                  • 40706
                  • 128 Posts
                  Its very hard to say why an page is slow. I have had optimized many page loading times of our Webpages and its often very complex. There are lots of things that could gone wrong. An usual way for me is looking into the MODX Resource Cache ( /core/cache/resource/web/resources/*documentId*.cache.php ), locate the _content Block and read through and on every [[ ]] tag, ask yourself: Is it really needed that this is parsed on every single page call?

                  Everything that only changes if resources change should always be called cached. When an resource is saved, the resource cache is cleared for default. So this cache refreshes, when it changes.

                  A great Problem are also unresolved placeholders. When using an [[+placeholder]] inside an deep innerTpl, with an unused / unnamed placeholder. MODX will try lots and lots of times through all Parses before finally giving up in the last general Parse. We had an Page that has 2 false Placeholders. The output looked good, but was extremely slow. Looking though i found out that this 2 placeholders are found 4480 times by the MODX parser before they were removed from the output. This alone slowing the website by about 5 sec.

                  So its just very hard to say why your installation slows. But I had also some problems with Gallery before switching to another Gallery solution.