Memcache settings

I 'always had issues with memcached, but since very large sites as Twitter, Facebook and Google use it with success, it must be me. Installing and enabling it in ELGG is relatively simple.

The issues I have are that moving widgets in profiles is useless after enabling memcache since this will not be written into the DB.

Having multiple instances of ELGG on a single machine even gets the memcache server responding from the wrong database instance.

The documentation is somewhat limited on ELGG (just how to enable it in settings.php) Is there anyone using memcache with succes and knows what memcache.ini settings need to be set ?

I am testing with the latest "stable" version 1.4.15 of memcached combined with Elgg 1.8.16

At some point I really need this, since I am stretching the limits of all other performance improvements.

  • @Juho, I use memcached. So I will switch to memcache. Hope that helps

    @Jerome, could you share those 1-5 lines of code ?

  • in engine/settings.php

    $CONFIG->memcache_prefix = "<some prefix>";

    in engine/classes/ElggMemcache.php

    private $namespace;

    public function setNamespace($namespace = "default") {
            global $CONFIG;
            $prefix = "";

            if(!empty($CONFIG->memcache_prefix)) {
                $prefix = $CONFIG->memcache_prefix;
            }

            $this->namespace = $prefix . $namespace;
        }

    public function getNamespace() {
            return $this->namespace;
        }

    ps: I know more than 5 lines of code ;)

  • Thanks Jerome !

    What I still don't understand, memcached is not supported is what Juho said. But without memcached there is no service listening to port 11211. How to use it then ?

  • @Gerard,

    Juho was talking about the PHP module, not the service. There are two PHP modules, and you need to use php-memcache NOT php-memcached.

  • Ah :-0 

    So use php-pecl-memcache and not php-pecl-memcached ! I am clear now. That was what I already used. I found the fix in moving widgets for memcache. Now let's test a multiple instances and give them separate name spaces.

Performance and Scalability

Performance and Scalability

If you've got a need for speed, this group is for you.