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

    We are having some real issues with an active modx site that one of my colleagues has built. The site gets a lot of traffic and this is causing us a issue with the site speed and server load.

    Our hosts have said:

    Upon checking your server it looks like the load on the server is high for the CPU's your server has as the load should not be higher than 4 for a 2 core server and it was at 10 when I viewed the server. It looks like there's a lot of scripts running on the website which causes the server to run slowly so it appears this is the website rather than the server.

    I feel that this is due to many resources being loaded, but if anyone could help us out that would be great.

    We have MODX Revolution 2.2.6-pl running on PHP 5.3.3 using MySQL 5.1.69 on a Linux VPS

    We need to fix this ASAP improving this. We are up against the client wanting to use another CMS when we love Modx and know its up to the job!

    The website is: wccc.co.uk

    Please shout if you can help or need any more info.

    This question has been answered by opengeek. See the first response.

      Linux, PHP 5.2, MySQL 5.0, Revo 2.2.0-pl2
      • 28000 ☆ A M B ☆
      • 397 Posts
      Hi!
      The best bet is to see if your snippets are using MODX's caching. If your snippet calls are showing an exclamation point before their name, then they are not. [[!snippetnamehere]].

      You also should use the addon "getCache" http://modx.com/extras/package/getcache
      This will allow you to control how long a snippet should be cached. This is good for twitter feeds for example.

      I would also recommend that you upgrade your site to 2.2.8 for security reasons.

      Kind regards
        Benjamin Davis: American web designer living in Munich, Germany and a MODX Ambassador. I am also co-founder of SEDA.digital, a MODX Agency.
        • 14167
        • 55 Posts
        Quote from: sonicpunk at Aug 19, 2013, 09:20 AM
        Hi!
        The best bet is to see if your snippets are using MODX's caching. If your snippet calls are showing an exclamation point before their name, then they are not. [[!snippetnamehere]].

        You also should use the addon "getCache" http://modx.com/extras/package/getcache
        This will allow you to control how long a snippet should be cached. This is good for twitter feeds for example.

        I would also recommend that you upgrade your site to 2.2.8 for security reasons.

        Kind regards

        Thanks for the quick reply sonicpunk, I will check what they have done, but I think we did do this already as much as we could.
        Would this cause the massive server load issues?
          Linux, PHP 5.2, MySQL 5.0, Revo 2.2.0-pl2
          • 34084 ☆ A M B ☆
          • 756 Posts
          Also, if you are using output modifiers they are a big performance hit. So if you have a lot of snippet/chunk/placeholder tags using conditional statements those will significantly reduce the performance of the site and cause higher CPU loads.

          Example Conditional:
          [[+myplaceholder:is=`match-me`:then=`output good`:else=``]]


          The items after the colons are the modifiers and where possible should be avoided if at all possible.

          Cheers
            Evo Revo // Ubuntu, CentOS, Win // Apache 2x, Lighttp (Lighty)
            Visit CharlesMx.com for latest news and status updates.
            • 14167
            • 55 Posts
            Quote from: charless at Aug 19, 2013, 10:12 AM
            Also, if you are using output modifiers they are a big performance hit. So if you have a lot of snippet/chunk/placeholder tags using conditional statements those will significantly reduce the performance of the site and cause higher CPU loads.

            Example Conditional:
            [[+myplaceholder:is=`match-me`:then=`output good`:else=``]]

            The items after the colons are the modifiers and where possible should be avoided if at all possible.

            Cheers

            Hi charless, we did have a problem with these, using If (http://rtfm.modx.com/extras/revo/if) seemed to help, but we do have a lot running, as we are using a few template variables to giving the client control over content. For example:

            [[If? &subject=`[[!*memAccess]]` &operator=`EQ` &operand=`Yes` &then=`[[!memInsert]]` ]]


            [[If? &subject=`[[!*greenBG]]` &operator=`EQ` &operand=`Yes` &then=`style="background: url(/assets/templates/default/images/wccc-website-background.jpg); background-size: 100% auto;"`]]

              Linux, PHP 5.2, MySQL 5.0, Revo 2.2.0-pl2
            • discuss.answer
              • 22303 MODX Staff
              • 10,725 Posts
              You should read this.

              Your first example:
              [[If? &subject=`[[!*memAccess]]` &operator=`EQ` &operand=`Yes` &then=`[[!memInsert]]` ]]

              is always executing the memInsert snippet, regardless of the conditional result. This would be much better, only executing memInsert if the conditional expression evaluates to true:
              [[[[If? &subject=`[[!*memAccess]]` &operator=`EQ` &operand=`Yes` &then=`!memInsert` &else=`-`]]]]
                • 14167
                • 55 Posts
                Quote from: opengeek at Aug 19, 2013, 11:17 AM
                You should read this.

                Your first example:
                [[If? &subject=`[[!*memAccess]]` &operator=`EQ` &operand=`Yes` &then=`[[!memInsert]]` ]]

                is always executing the memInsert snippet, regardless of the conditional result. This would be much better, only executing memInsert if the conditional expression evaluates to true:
                [[[[If? &subject=`[[!*memAccess]]` &operator=`EQ` &operand=`Yes` &then=`!memInsert` &else=`-`]]]]

                AHHHHH... so we have been running a lot of snippets when we haven't needed to.
                I guess on our code if we have snippets in the then and the else both will run and just one output?
                  Linux, PHP 5.2, MySQL 5.0, Revo 2.2.0-pl2
                  • 42967
                  • 143 Posts
                  Check out xfpc: http://rtfm.modx.com/extras/revo/xfpc

                  Basically creates a static version of your site, you might have to use the ajax feature if you have random dynamic content.

                  Also if you are using getResources add &depth='1' where possible and only load the tv's you need with includeTVList.

                  Edit, use output modifiers instead of the IF snippet, as it can be slow.
                    Eighth day design
                    Design agency with offices in Edinburgh and Brighton
                    • 9207 ☆ A M B ☆
                    • 2,475 Posts
                    OpenGeek says conditionals are like mosquitoes... I say they're more like crack or meth: they make you feel really good, but they are horribly addictive and destroy your site. Unfortunately, most templates/designs rely on them. I've had to rescue several sites that overly-relied on conditionals (PHx being a class one drug here). If your templates and views have too much logic in them, you'd be better off just using straight PHP in your templates -- at least that loads quickly. But that defeats the purpose of having a clean and sensible architecture...

                    There are some fixes like the xfpc or caching layers, but really the most scalable and thorough solution is to design the site to avoid the need for those from the beginning. (Easier said than done).