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

    I have MODx revo working on a load balanced enviornment using the code opengeek included using modRegistry.
    I'm using a combination od memcached for resourceCache and file cache for everything else.

    I have setup my "clearCache" plugin to run when the user presses the "clear cache" button, or when they Publish or Unpublish a resource. This is working well.

    The problem I have encountered is with the cache expiration time not working.
    If the user sets a Publish and Unpublish time, MODx is missing the unpublish times as I believe they are being cached?

    As a solution I thought I could set:
    cache_expires = 120 (and tune this figure) to sort this issue.

    This however does not work, as the web nodes are ignoring it.
    The cache never gets cleared unless I press Clear cache or Publish and Unpublish
    I am weary of attaching opengeeks code to the save resource event due to overhead?

    Can anyone help? Why would the individual web nodes ignore the cache expire set in system settings in the manager?

    This is the last part in what was a complicated puzzle smiley
    Thanks in advance!

    J



    [ed. note: jusmeig last edited this post 14 years, 10 months ago.]
      • 15083
      • 697 Posts
      Bump smiley

      Anyone know a way to turn off the caching for publishing and unpublishing dates, so MODx will always got ot the DB to check if a resource should be taken down or put up?

       $cacheRefreshOptions =  array(
                            'auto_publish' => array( 'contexts' => array('web') ),
                            'system_settings' => array(),
                            'db' => array(),
                            'context_settings' => array( 'contexts' => array('web') ),
                            'scripts' => array(),
                            'resource' => array( 'contexts' => array('web') ),
                          );


      I'm using this code to clear my cache on each web-node.
      The auto_publish should take care of the automatic publish/unpublish times no? [ed. note: jusmeig last edited this post 14 years, 10 months ago.]
        • 15083
        • 697 Posts
        Kind of solved this.
        Turning off memcache and using file cache seems to have worked.
        I was using memcached as follows:

        cache_resource_handler = cache.xPDOMemCache
        cache_resource_key = resourceCache
        memcached_server = blah:11111
        


        I'm only guessing that because memcached cannot refresh cache by key, that the auto_publish was getting ignored? memcached is not mastermind area....but with good old file cache its working file again. Might save some time smiley
          • 22303 MODX Staff
          • 10,725 Posts
          I assume you have a separate memcached instance for each web node? Otherwise, this explains the issue. The plugins which clear each local file cache are not in sync and if you are using memcached for the resource cache, it might not be seeing all the right information at the right time since the other cache information might be different depending on which web node was being hit.
            • 15083
            • 697 Posts
            Hi there,

            We don't have an instance for each web node, fairly sure of this.
            Forgive my "memnoob-ness".

            I kind of get what you are saying:
            - Plugin clears the localcache and memcache, another node reads memcache and its missing publish or unpublish dates.

            Problem does not happen with pure file cache (as its all in the same bucket so to speak)
            This correct?

            So do I have a plan B, performance with file cache was fine. We load tested and it passed with flying colours...perhaps I am overcomplicating by using membase?

              • 15083
              • 697 Posts
              Quote from: opengeek at Dec 15, 2011, 12:03 PM
              I assume you have a separate memcached instance for each web node?

              How would each node know what its instance is?
              I supply an IP and a port with membase running a vBucket for my project, are you saying I would need seperate buckets per node? My understanding was that membase is a central repository, so I guess I should never really be clearing down my memcache from the nodes at all then? Is this the case? Only the manager should do that...with the nodes just reading from one instance?
                • 22303 MODX Staff
                • 10,725 Posts
                No, I'm saying you need to either centralize the entire cache or isolate the entire cache per node. Not a combination of the two; that is the source of the issue with cache syncronization.
                  • 15083
                  • 697 Posts
                  Quote from: opengeek at Dec 16, 2011, 07:40 AM
                  No, I'm saying you need to either centralize the entire cache or isolate the entire cache per node. Not a combination of the two; that is the source of the issue with cache syncronization.

                  Thanks man.
                  Given how it's performing with local file caches (great!!), Might leave it alone smiley