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

    First at all, sorry for my bad english.

    I’m using modx (v0.9.6.1p2) for a big website with many functionnalities :

    - 2500 documents
    - 500 different ressources (templates, TVs, snippets, chunks...)

    Modx is running on an restricted environnement, on witch I do have a very limited access (no ssh/ftp).

    The main limit is (was) the 8Mo memory allocated to each php instance.

    I have had a strange problem :

    Some people duplicated a few documents (4-5), and from this point, every modx pages, *including manager*, were displaying the following error :

    Allowed memory size of 8388608 bytes exhausted (tried to allocate 6291456 bytes)

    The error was located on line 14987 of assets/cache/siteCache.idx.php

    The code area of my siteCache.idx.php was :

    14984 : //Include a custom config file if specified
    14985 : 
    14986 : $config = (isset($config)) ? "{$wayfinder_base}configs/{$config}.config.php" : "{$wayfinder_base}configs/default.config.php";
    14987 : 
    14988 : if (file_exists($config)) {
    14989 : 
    14990 : 	include_once("$config");
    14991 : 
    14992 : }
    


    For info, my siteCache.idx.php is 692 Ko.

    Here is what i tried to solve the problem :

    - I tried to run the site on my local developpement server, using the same memoty limitation (8Mo), + the same database + the same sitecache.idx file. And I added log lines to check memory_usage everywhere in documentparser.inc.php. It was each time 3-5Mo.

    - I put on the production server an old version of sitecache.idx. Then I was able to access to the manager. But when I was refreshed the site, same memory error.

    - I tried to delete some parts of documentparser to see the area where a file inclusion could break php/memory limit. It had random results...

    The error disappeared when the memory limit was raised to 16 Mo (8Mo before the incident)

    Questions :

    1) How is it possible, how can it happen ?

    2) Is it a php or a modx problem ?

    3) Is there a way to solve this problem, without having to raise the memory limit ?

    4) Is there a way to monitor the memory used ?

    5) Ok, the error was reported to me by someone else, so I’m not 100% sure the error was on this line. Could it come from somewhere else? (remember the whole site was broken)

    6) I heard about a new version of modx, 0.9.7, solving cache problems. Is it still in project ? If yes, when is it planned ? Or is it about the evolution/revolution project ?

    Thanks by avance !
      • 22303 MODX Staff
      • 10,725 Posts
      Basic rule of thumb, the smaller the memory_limit, the smaller the site you’ll be able to deploy with MODx. With a site that large, I’d invest a little more to have access to a configuration with more memory available. Revolution will improve some cache issues, but it will not be able to solve the limitations of the physical environment you are running MODx in.
        • 28629
        • 5 Posts
        Thank you for your answer OpenGeek.

        I’m aware the smaller the memory limit, the smaller the site... As I said, I do not have access to the production server. I asked to raise the memory limit to 16Mo, but I know that with the number of documents/ressources growing, this limit will be reached once more in a few month. And I can’t tell my client he’ll have to raise memory limit every 6 month in order to have modx work properly.

        Is there a way to reduce the memory used by the cache ?

        I thought about only having files includes in snippets, to reduce the amount of code in sitecache. But I’m not sure how efficient it will be.

        Is there any other way to reduce it ?

        Or to disable the modx cache functionnality. Processor usage is not a problem on the machines. Only the amount of memory used. I installed a extern cache system (quickache), so once a page is in cache, modx is not longer executed. I just don’t want modx to "crash" if/when a page is generated at the first time.

        Modx is really a great tool, I do a lot of thing with. This cache limitation is really the only thing I’ld really like to see rewamped..

        ------

        Talking about Revolution, I can’t migrate to Revolution. My site has very specific functionnalities, witch involved some modx core modification, in manager, document parser and major snippets (ditto, wayfinder, etc).

        Thank you for your answer(s) !
          • 10449
          • 956 Posts
          Well, the requirements page suggests "for optimal results" = 64MB
          http://modxcms.com/learn/general-requirements.html

          8MB nowadays is... nothing :|

          Personally, I never use modx page-caching at all. What if you disable it, i.e. go to modules > docManager > other properties > select "uncacheable" for all documents? People often believe that lots of database queries are the only thing that can slow down a website, while big and frequent file-access can be just as stressful for a server - probably more.

          Including snippets via include() is a good idea, generally speaking, but this alone won’t make your cached site noticeably faster on an 8 or 16MB server.