We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37984
    • 215 Posts
    I'm in the process of building a fairly complex site for a client, and the site looks fantastic. The issue is that it is running EXTREMELY slow. We're talking occasional 20 second page load times.

    My question here is that currently, I'm using a fairly complex template for almost all of my resources, and this template has a pretty significant use of output filters/modifiers to modify the content on the fly instead of relying on a large number of different templates. Will this bog down a budget server (Bluehost) to the point that I'm seeing, or should I look elsewhere for the source of the slowdown?

    On a parallel topic, should I consider switching to a dedicated server to allow for more resources to render the pages, or would this make no difference in page load speed at all?
      Jesse Couch
      MODX Aficionado, Front-End Designer & Developer
      http://www.designcouch.com
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      That will indeed slow things down. I, too, used to make it a matter of pride to use as few templates as possible. These days I find it's much better to use a reasonable number of templates (with chunks to handle the common bits like the main menu and logo and footer areas) to avoid too much processing.

      Another thing to look at is your "looping" snippets like getResources and Wayfinder. Whenever possible, these should be called cached. You also might want to look into a plugin I recall reading about recently that will re-load the whole set of page caches automatically when it's cleared, so that editing and saving one resource won't cause every page in the site to have to be re-generated on first request, which if you are busy in the Manager can cause your site to slow to a crawl.
        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
        • 3749
        • 24,544 Posts
        I released an extra called RefreshCache that refreshes the whole site cache by crawling the site with cURL, but it isn't very practical because it takes forever to run.
          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
          • 5430
          • 247 Posts
          I do the same thing with many sites. One thing that will absolutely kill your load times is if you're using getResources and the template chunk your pushing things through has a bogus image URL. For some reason getResources absolutely chokes on bad image paths.
            • 39501
            • 163 Posts
            @designcouch - great question - have been thinking the same recently.

            On a recent project, I think I broke a new personal record of 3 templates (homepage, grid and text template).

            All templates used output modifiers and IF calls using the IF call addon. I've noticed no performance drop, but this may be because i'm using MODX Cloud.

            Like @sottwell said, it is almost pride (from my perspective convenience to have a smaller number of templates to maintain), but I have found myself creating duplicate templates and un-doing work to get around Revo Form Customization bugs (contraint fields don't work) which seems a great shame considering the bug has been around for almost a year or so.

            My portfolio site was very very slow (uses lots of complex calls and if statements which I'm sure could of been optimised better)...

            I used http://tools.pingdom.com/fpt/ to help analise the performance of my portfolio site (was really really slow) and eventually moved it across to modxcloud.com and integrated it with cloudflare.com CDN. The result was my site loading up almost 4 times quicker than before.

            Cloudflare.com is certainly worth a look. [ed. note: jonleverrier last edited this post 13 years, 8 months ago.]
              • 37984
              • 215 Posts
              thanks jonleverrier - great stuff. Are you aware that IF is no longer necessary? Output Filters and Modifiers add that functionality into the core of MODX.

              I've used Pingdom's tools for a while now - they're quite handy!

              Definitely a fan of CDNs in general, as they make thinks nice and snappy.

              On the note of my own personal issue, it appears that Bluehost is throttling MySQL due to some slow queries. I'll most likely be starting a new thread for that, but before I do, has anyone run up against anything like this?
                Jesse Couch
                MODX Aficionado, Front-End Designer & Developer
                http://www.designcouch.com
                • 3749
                • 24,544 Posts
                @designcouch: In Revo, the If snippet was added because it's faster and less resource-intensive than output modifiers.
                  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
                  • 39501
                  • 163 Posts
                  @bobray - good to know, I removed some IF statements in favour of inbuilt output modifiers. Might just change them back now smiley Am I right in thinking, that there are some things output modifiers simply cannot do, that IF statements can?
                    • 37984
                    • 215 Posts
                    @bobray - had no clue that was the case. I'm in the same situation as @jonlevierrier; I removed a lot of If statements in favor of using the core functionality. Perhaps a re-thinking is in order!
                      Jesse Couch
                      MODX Aficionado, Front-End Designer & Developer
                      http://www.designcouch.com
                      • 39501
                      • 163 Posts
                      1st win for IF statements, is you can nest them inside snippet calls. For example:

                      [[!getImageList? 
                        &tpl=`plug.tpl.news.item` 
                        &tvname=`tv.migx.news`
                        &sort=`[{"sortby":"date","sortdir":"DESC"}]`
                        [[!If?
                          &subject=`[[!getUrlParam? &name=`tag` &int=`0`]]`
                          &operator=`notempty`
                          &then=`&where =`{"tags:snippet:filterbytag":"[[!getUrlParam? &name=`tag` &int=`0`]]"}``
                          &else=``
                        ]]
                      ]]