We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36517
    • 14 Posts
    I'm running a ModX site and I'd like to get some advice on best ways to optimize it. Right now our TTFB is sometimes up to 13 seconds. I am trying to cache as well as I can and working on taking too much processing out of IFs.

    It's the website of a theatre company, so I'm pulling information about shows to various pages all the time. Right now I have a page for each show and all of the information about the show - dates, directors, etc - is stored in template variables for each resource. I'm wondering if when I call specific pieces of information for several shows - like in the season listing, or on our homepage - I think I've called the entire object if I'm using getCollection, when I really need specific fields only. Is there a way I can restrict the query to return certain fields only, instead of whole objects?

    I am certainly not an optimization expert, so if I have massively misunderstood how this is working and what might be a way to reduce load, my apologies.

    Thanks in advance!
      • 34084 ☆ A M B ☆
      • 756 Posts
      More than likely your performance hit is going to be from the template building logic you have. Very rarely have I found a query response object to be at the root cause for such long load times. Here are a few questions to help dive into this more:


      1. What System caching mechanism are you using? (file, memcache, apc)
      2. How big are site menus? (depth, count, etc.)
      3. Are your menus using any output modifiers in the chunks?
      4. How much system memory is allocated for your server?
      5. Have you verified that the caching mechanism is functioning properly? (if using default make sure you have object in your /core/cache/ folder)
      6. Have you used a browser tool or third party performance tool to help diagnose? (Pingdom, Google Page Speed, or other)
      7. Check in your browser developer console Network tab to see if any third party external domain request and causing the delay

      Those are some starting points.

      Cheers
        Evo Revo // Ubuntu, CentOS, Win // Apache 2x, Lighttp (Lighty)
        Visit CharlesMx.com for latest news and status updates.
        • 33969
        • 60 Posts
        Some of the biggest problems we have found on slow websites have nothing to do with Modx. Before I started digging into Modx I would make a static copy of a page and see how fast it loads. If it is slow, the problem isn't in Modx and you might want to start looking at the following:

        - Check that all your images have been pre-scaled to fit the screen size.
        - Use a sprite sheet instead of a lot of small icons
        - Make sure external embedded objects like G+ and Facebook icons are running asyncrosously ( Facebook can be particularly slow. )
        - Make sure your Javascript isn't blocking the page load
          Michael Regan
          TIMR Web Services
          Phone: 250.218.5284
          Eamil: [email protected]
          Website: timr.ca
          • 32699 ☆ A M B ☆
          • 427 Posts
          I typically build "heavy sites" though you wouldn't know it when you visit them.

          The original posters question is broad and has many possible combinations of answers.

          Hardware, memory, bandwidth, networks, router issues, ISP throttling, etc., all all examples of hardware related issues.

          As was already mentioned, graphics, scripts, and other page content can be a culprit. Also linking from third-party sites such as Youtube and others can slow down your page, unless you implement localized solutions such as placeholder images for their content.

          My book discusses how to implement minify for css and JavaScript, and I recently wrote an article on how to implement cloudflare on a MODX Revolution site (even if it is https): http://www.shawnwilkerson.com/modx-revolution/2013/03/30/using-cloudflare-cdn-with-modx-revolution-and-still-have-ssl-pages/

          I took over a project which was loading in 22 seconds on a hybrid of open source projects. I deleted the sites (there was no point to keep them) and rebuilt the sites under MODX Revolution.

          MODX render time: 0.2026 s
          First View 	2.349s 	0.596s 	1.647s 	1850 	295 	2.349s 	18 	863 KB 	2.418s 	19 863 KB
          Repeat View 	0.634s 	0.438s 	0.707s 	728 	295 	0.634s 	2 	12 KB 	0.938s 	5   13 KB


          These are without a cloud handling the static assets as we had to turn it off for the build and test stage.

          I hope these give you some ideas on where to start. Web Site Optimization is an art form in and of itself and it is a huge topic. Provide us with a URL or something to allow us to give you better insight.
            Get your copy of MODX Revolution Building the Web Your Way http://www.sanitypress.com/books/modx-revolution-building-the-web-your-way.html

            Check out my MODX || xPDO resources here: http://www.shawnwilkerson.com