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

    we are working on migrating our modx Evolution-powered sites to modx Revolution. Our sites have tens of thousands of documents, and the performance with modx Evolution has been fine. However, we have run into some serious performance issues with the manager in modx Revolution.

    Every time the cache is cleared, it tries to rebuild the entire document tree in the left document pane. This results in about 30,000 queries similar to the following being run:

    SELECT `r`.`id`, `r`.`alias`, `r`.`parent`, `r`.`isfolder`, `r`.`content_type` FROM `modx_site_content` `r` WHERE `r`.`id` = '7' AND `r`.`id` != `r`.`parent` LIMIT 1


    This causes the entire site to slow down and become unresponsive, even in a local testing environment (as these queries take about 5 minutes to complete). As we add more an more documents into the manager, and have more manager users in a live environment, this problem will only grow much worse.

    I was wondering if:

    * There are plans to optimize the load speed of the document pane
    * There is a way to prevent the entire manager cache from being cleared when "clear cache" is selected. We just need the front-end, snippet, chunk caches to be cleared. (I looked at the clearCache() method of the modCacheManager class, but I could not figure out where the calling code is triggers the cache to deleted when the user selects "clear cache" in the manager.)

    In order to optimize the load time of the file pane, I would suggest the following:

    Use "lazy loading" to only load (and cache) the first-level folders, and then use ajax to load (and cache) whichever sub-folders are requested. This seems to be how Evolution does it, so I’m not sure why Revolution has done things differently.

    Thanks in advance!
      • 11155
      • 74 Posts
      I’m just starting with my first site with modx but all this tree refreshing is already boring me, I can’t imagine what it looks like on your site ! It’s definitively something that needs to be improved. A lot.
        • 28215
        • 4,149 Posts
        I’m not sure why you’re getting that many queries, but a setting has been added in 2.0.5 that determines whether or not the trees refresh after a cache clear. It defaults to No.

        https://github.com/modxcms/revolution/commit/1a17f34a5cd1442e4e8f8986f3a9d95ef60ad9e7
          shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
          • 14915
          • 43 Posts
          Thanks for your reply, Shaun. 2.5 has not been released yet, right?
          Could I just comment out the following line in manager/assets/modext/core/modx.js to turn this off?

          Ext.getCmp('modx-layout').refreshTrees();
            • 14915
            • 43 Posts
            On another note, it seems to be the same set of 3 or 4 queries repeated again and again. E.g.:

            SELECT `r`.`id`, `r`.`alias`, `r`.`parent`, `r`.`isfolder`, `r`.`content_type` FROM `modx_site_content` `r` WHERE `r`.`id` = '7' AND `r`.`id` != `r`.`parent` LIMIT 1
            
            SELECT `r`.`id`, `r`.`alias`, `r`.`parent`, `r`.`isfolder`, `r`.`content_type` FROM `modx_site_content` `r` WHERE `r`.`id` = '739' AND `r`.`id` != `r`.`parent` LIMIT 1
            
            SELECT `r`.`id`, `r`.`alias`, `r`.`parent`, `r`.`isfolder`, `r`.`content_type` FROM `modx_site_content` `r` WHERE `r`.`id` = '731' AND `r`.`id` != `r`.`parent` LIMIT 1



            SELECT `r`.`id`, `r`.`alias`, `r`.`parent`, `r`.`isfolder`, `r`.`content_type` FROM `modx_site_content` `r` WHERE `r`.`id` = '7' AND `r`.`id` != `r`.`parent` LIMIT 1
            
            SELECT `r`.`id`, `r`.`alias`, `r`.`parent`, `r`.`isfolder`, `r`.`content_type` FROM `modx_site_content` `r` WHERE `r`.`id` = '739' AND `r`.`id` != `r`.`parent` LIMIT 1
            
            SELECT `r`.`id`, `r`.`alias`, `r`.`parent`, `r`.`isfolder`, `r`.`content_type` FROM `modx_site_content` `r` WHERE `r`.`id` = '731' AND `r`.`id` != `r`.`parent` LIMIT 1


            I tried comment out just that one line in modx.js, but it did not seem to help.
              • 28215
              • 4,149 Posts
              Yes, 2.0.5 has not been released yet, although it will be soon. And yes, you can comment out that line.
                shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                • 28215
                • 4,149 Posts
                Yes, if you want to modify the JS - you’ll have to turn off compress_js and concat_js in the System settings, or edit the code directly in the compressed JS in manager/assets/modext/modext.js.
                  shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                  • 14915
                  • 43 Posts
                  Thanks, Shaun! That did the trick.
                    • 14915
                    • 43 Posts
                    Hi,

                    the document tree is also reloaded after a document save. This takes a few minutes on my local machine, as it runs all these queries again.
                    Is there a way to make it only reload the changed tree elements, or only perform a reload if a resource has been added or deleted?

                    If you could point me in the right direction (in terms of the JS / PHP code that builds the tree), I could take a look at myself too.

                    Thanks.
                      • 28215
                      • 4,149 Posts
                      Something is definitely off on your environment - mine only reloads the affected node. And it definitely doesn’t take a "few minutes." You might want to check your apache logs to look for segfaults.
                        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com