We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30215
    • 79 Posts
    I just came across an interesting entry in FAQ. It says that "the caching system may run into size and performance limitations around 5,000 documents". I checked a database of my website and with current speed the number 5000 of documents will be reached within a year (right now there is almost 3000 documents). The web is visited by around 2000-3000 users every day.

    I haven’t noticed any performance issues so far, it’s acutally very fast and stable, but should I be afraid? Is anyone experienced with such a big website (or even bigger)? The site isn’t actually mine, I have just created it and I am responsible for keeping it working. I put quite a lot of effort in building it and I am really not looking forward to making it again from the scratch smiley

    (I know I should have read the FAQ before I started building it wink )
      -- sorry for my english, bad teacher smiley
      • 1343 ☆ A M B ☆
      • 2,213 Posts
      Hello,

      The "limit" is mainly related to how well your server handles reading the cache file. I believe the limit was pushed up to around 6000 with some tweaks in Evolution, but in either case the limit is based entirely on your server. Anything you can move into an external table will help, so if you have a list of business for example, instead of giving them each a page, put them in a database and then use one page to display them.

      If you are using Revolution, this changing the game and you can split things into different contexts. If I recall correctly there is 5-6000 document limit per context, but using items such as memcache can help.

      Once you hit 5-6000 pages you site will just start getting slower.

      AMDbuilder
        Patrick | Server Wrangler
        About Me: Website | Tweets |  MODX Hosting
        • 30215
        • 79 Posts
        Hi, thanks for the quick answer.

        If I understand it correctly, once the website hits 5-6000 pages, the cache file gets so big, that it will slow down the web. And how does it work? The more documents I have, the slower the web gets? Or is there an exact number (depending for example on some memory limits of my hosting), which when I exceed, the website become unusably slow?

        The mentioned website is a portal with news, so it’s important that the main page and around last 50 articles load fast, anything older is not so essential, but I guess it doesn’t change anything. In the worse case I could just delete the oldest documents or move them into some static archive, but I would like to avoid that.
          -- sorry for my english, bad teacher smiley
          • 1343 ☆ A M B ☆
          • 2,213 Posts
          Correct, once you hit 5-6000 pages the cache file is big enough it will slow down the site. Depending on the server it may not be noticeable, you will know better as you get closer to that point in time.

          If you are worried my suggestion would be to start planning to upgrade your site to Revolution which will help things some. Deleting or moving the older articles into an archive context in revolution would be my suggestion for the time being. The other option would be to disable the cache, but that’s not advisable.

          If you’re already on revolution you should be better off and it’s just a case of tweaking things. Another option would be to move pages out of MODx using static resources (again Revolution) to include the content. I don’t think the content will be included in the cache that way thus allowing for more pages before running into issues.

          AMDbuilder
            Patrick | Server Wrangler
            About Me: Website | Tweets |  MODX Hosting
            • 30215
            • 79 Posts
            I am sorry, I didn’t mention that I am using Evolution, unfortunately smiley

            As I said before, the web is not mine, it was a job and I got paid for it. The problem is, that the website is 5 months old and it was a huge redesing, first after 7 years I guess. So I can’t just go to the customer after a year and half and say to him, that it is time to upgrade and I want more money smiley So if the web really gets too slow, I will have to deal with it somehow and the complete upgrade would be very time consuming, so it is the last option.

            Yeah, from now on I will always read the FAQ first smiley
              -- sorry for my english, bad teacher smiley
              • 30215
              • 79 Posts
              Hey, it’s me again and I have few questions/suggestions and I would like to hear your opinion about it.

              When you are talking about cache file and its size, you have most probably file siteCache.idx on your mind. So I guess my goal is to reduce the size of this file as much as possible.

              My first idea is to disable SEO urls and delete all aliases from the database. I know, it’s not very SEO-frienldy, but it is better to have working SEO-hostile web than nothing smiley The document titles are on this particular web pretty long so this move would save approximately about 10-15% of space. Good thing is that it would also rapidly slow down the speed of growing of the cache file.

              The second idea is related to snippets. The snippet cache is also included in this file and currently takes about 30% of the size (guessing from the scrollbar). The problem is that almost every snippet includes a lot of redundant lines - comments. Sometimes there are more comments than normal php lines smiley So if I removed comments before saving to the cache I would also spare a lot of space.

              The third idea is to move some content of this file to other files. Unfortunately I don’t know much about how MODx and generally php work from the inside, and what is really behind this limit of 5000 documents. But in the case that the slowdown was caused by long time of parsing such a big file, moving few parts of the cache file into other files could help. For instance I could store snippets separately, each in its own file in some subfolder, and load them to the script later or when possible, only when needed.

              I hope I don’t bother you much with my long messages, I would appreciate any tips or experience with this problem.
                -- sorry for my english, bad teacher smiley
                • 30215
                • 79 Posts
                I haven’t tried anything yet because I don’t have this problem yet. However as I wrote before the website will hit the limit within a year (or a little bit more) so I am trying to prepare for the situation which is going to happen at some point in the future. So we are definitely going to see a real-life comparison between these two ways unless the website is running on some superwebhosting which is most probably not smiley
                  -- sorry for my english, bad teacher smiley
                  • 26931
                  • 2,314 Posts
                  don’t know if this helps, but apparently there are some tweaks for caching available: http://modxcms.com/forums/index.php/topic,36714.msg277542.html#msg277542

                  *edit* ...the demo sites are offline
                    • 30215
                    • 79 Posts
                    Thanks! It really helped. I spend two hours by reading all posts about this issue and I found what I wanted. I used following hack: http://modxcms.com/forums/index.php/topic,28110.msg172533.html#msg172533. My siteCache.idx was mostly filled with seo aliases and this hack reduced this part of siteCache.idx by more than 50%! Theoretically it means that if the limit was about 5000 docs, it is more than 10000 now. At this point (about 3000 docs) I have noticed only a small speed improvement - a cached page takes about 150ms to load and it used to take about 170ms - but I didn’t expected it. Good thing is that I don’t have to worry (much) about the future right now.

                    The question is why was that so simple. Instead of this...

                    $d['zpravy/kutna-hora/politici-predstavili-duvody-vzniku-petice-za-vysokoskolska-studia-v-kutne-hore'] = 7026;
                    $a[7026] = array('id' => 7026, 'alias' => 'politici-predstavili-duvody-vzniku-petice-za-vysokoskolska-studia-v-kutne-hore', 'path' => 'zpravy/kutna-hora');
                    $m[] = array('10' => '7026');


                    ...I have now this, in my siteCace.idx:

                    $d['zpravy/kutna-hora/politici-predstavili-duvody-vzniku-petice-za-vysokoskolska-studia-v-kutne-hore'] = 7026;
                    $m[] = array('10' => '7026');


                    And the functionality seems to be the same. Why is not this hack a part of the official MODx? When you really look at the code of the cache you can see that there is the same information stored twice. What is the reason that it is written this way? I am asking mainly because I am scared I broke something and I just don’t know it yet smiley However the author of this hack seems to be using this without any problems...
                      -- sorry for my english, bad teacher smiley
                      • 33337
                      • 3,975 Posts
                      There is something "experimental" on the horizon as well, please see http://bugs.modx.com/issues/915
                        Zaigham R - MODX Professional | Skype | Email | Twitter

                        Digging the interwebs for #MODX gems and bringing it to you. modx.link