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

    I have a sitecache.idx.php that is 6Mb.
    It causes memory issues (+-150 permanent visitors)on my server.

    Is there any way to split or reduce the memory for the sitecache?

      • 28042 ☆ A M B ☆
      • 24,524 Posts
      How many resources do you have? You can cut it down somewhat by using a single small snippet
      include $file;

      and use this snippet to include files containing the template and chunks, as well as other snippets:
      [[loadfile? &file=`assets/templates/mytemplate/template1.php`]]

      This way there is only one snippet in the cache file instead of all of your templates, chunks and snippets.

      However, several thousand resources will choke the cache file in any case, as each resource has an entry in three different arrays in the cache.
        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
        • 8813
        • 18 Posts
        I have 25000 ressources.
        The main problem is that I have more than 55000 lines of this type:
        $d['path/path1/pathN*'] = 19790;
        $a[19790] = array('id' => 19790, 'alias' => 'myalias', 'path' => 'aliaspath');
        $m[] = array('1076' => '19790');


        The chunks and snippets only takes 250ko.
          • 21257 MODX Staff
          • 730 Posts
          There’s no easy way to handle this, emetik. Evolution is designed to work with that alias/path data cached in that manner. It’s possible of course to modify how the caching and the resource aliases and paths work in the core, if you know enough about the core to hack it to your specific needs. This isn’t highly recommended as it breaks your upgrade path etc.
          There is also a very preliminary (experimental) branch of Evolution underway to explore a different technique for storing/retreiving this information (a closure table). It’s not even alpha yet, i.e. it’s not complete enough to give it a try.
          My recommendation here would be to port the site to Revolution. It was designed with a more flexible and partitioned caching system. Recent optimizations in the caching have decreased the size of the context cache files (Revo’s equivalent to the Evo sitecache, basically) significantly. We figure this size reduction is probably on the order of 60%. If you play with the cache_format, you can get the size down even more. Lastly, perhaps you can partition sections of your site’s Resources into different Contexts, spreading the caching load between them.
            Mike Schell
            Lead Developer, MODX Cloud
            Email: [email protected]
            GitHub: https://github.com/netProphET/
            Twitter: @mkschell
            • 8813
            • 18 Posts
            I also thougt revo could be a part of the answer.

            The only thing that scared me is perfoming the upgrade beacause table structures aren’t the same and I didn’t find any script that does it even just a part of it (content, tv, snippets,...)
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Do all of those resources need to be dynamic resources? If they are, for example, archived posts of some kind, you could move the content to a custom table or files and load them on demand with a snippet.
                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