Multi-DB & Memcached Object Cache

Anyone had any problems running the Memcached object-cache.php while using the Multi-DB plugin. For me it's getting mixed up with requests and redirecting some sites to other ones, also not letting some people log in etc. Using WordPress's inbuilt object cache seems to work fine so far, fingers crossed.

Note that Memcached is only supporting one instance of WordPress Multi-site over two servers, using Repcached to replicate Memcached data between servers. Never tested this before Multi-DB so no idea if it's that or a problem with data not being unique enough in Memcached. If anyone has any similar problems or knows of a solution I would love to hear it!

  • Kimberly
    • Champion of Loops


    Welcome to WPMU! Thanks for visiting the forums!

    I'm not familiar with your plugins, but I think I may have come across something that could help. I found this thread that has a couple of fixes and and links for Memcache users with a Multisite installation.

    I hope that you can find this useful :slight_smile:

    I leave this thread open for a bit longer, maybe someone else will come across with some other info :slight_smile: If you find what you need in the thread above then please mark this as resolved by clicking the box below your comments.

    Best Regards,


  • PrimaryT
    • Site Builder, Child of Zeus

    Hi Kimberly,

    Thanks for that but it's not helped. Feel free to remove it as a help request and more of an open thread for future users with the same issue. Maybe some day a solution will appear, but at the moment it seems impossible to use Memcached object cache on a Multi-Site network with more than one server replicating to each other.



  • PrimaryT
    • Site Builder, Child of Zeus

    Thanks for moving it Kimberly. Still no luck unfortunately. We're running a similar set up to Edublogs server wise and it just doesn't seem to like reading and writing over multiple servers, even if you replicate between them.

  • PrimaryT
    • Site Builder, Child of Zeus

    Cheers mate. I'm pretty sure that was one of the things i tried previously. As far as I remember, it worked for about 10 minutes then it starts redirecting some blogs to other ones, like the key isn't unique enough. We currently have over 5000 blogs which are all accessed quite frequently.

    We're running memcached (repcached) over two servers over WAN to keep servers in sync. Not sure if that is also causing issues. We chose WAN for redundancy, but it's causing some headaches scaling wise.

  • PrimaryT
    • Site Builder, Child of Zeus

    I was using the object-cache.php on just 1 Multi-Site installation WP 3.3.1. I initially tried it on more than one install and all blogs started redirecting to each other, but even on one it does the same thing.

    wp-config.php - Replaced sensitive info with *, I've added the config options in from your post but not testing it again until this evening.

    define('DB_NAME', '*');
    define('DB_USER', '*');
    define('DB_PASSWORD', '*');
    define('DB_HOST', '*');
    define('DB_CHARSET', 'utf8');
    define('DB_COLLATE', '');
    define('VHOST', 'yes');
    $base = '/';
    define('DOMAIN_CURRENT_SITE', '*' );
    define('PATH_CURRENT_SITE', '/' );
    define('BLOGID_CURRENT_SITE', '1' );
    define('WP_ALLOW_REPAIR', false);
    define('AUTOSAVE_INTERVAL', 60 );
    define('WP_POST_REVISIONS', 5 );
    define('WP_MEMORY_LIMIT', '128M');
    define('ALLOW_UNFILTERED_UPLOADS', true);
    define('DISALLOW_UNFILTERED_HTML', false);
    define('EMPTY_TRASH_DAYS', 7 );
    define('DISALLOW_FILE_EDIT', true );
    define('FS_METHOD', 'direct');
    define('WP_DEFAULT_THEME', 'twentyeleven');
    define('PSTS_DONT_REVERSE_LEVELS', true);
    define('SC_WPFMP_ADMIN_ALERT_PERMISSION', 'manage_network');
    define('FS_CHMOD_DIR', (0755 & ~ umask()));
    define('FS_CHMOD_FILE', (0644 & ~ umask()));
    define('AUTH_KEY', '*');
    define('SECURE_AUTH_KEY', '*');
    define('LOGGED_IN_KEY', '*');
    define('NONCE_KEY', '*');
    define('AUTH_SALT', '*');
    define('LOGGED_IN_SALT', '*');
    define('SECURE_AUTH_SALT', '*');
    define('NONCE_SALT', '*');
    define('SECRET_SALT', '*');
    define('ADMIN_COOKIE_PATH', '/');
    define('COOKIEPATH', '/');
    define('SITECOOKIEPATH', '/');
    define('COOKIEHASH', md5('*'));
    $table_prefix  = 'wp_';
    define ('WPLANG', '');
    if( $base == 'BASE' )
    	die( 'Problem in wp-config.php - $base is set to BASE when it should be the path like "/" or "/blogs/"! Please fix it!' );
    global $varnish_servers;
    $varnish_servers = array('*','*');
    global $wpv_timeout_optval;
    $wpv_timeout_optval = 1;
    global $memcached_servers;
    $memcached_servers = array('default' => array('*'));
    global $blog_id;
    $blog_id = '*';
    if ( !defined('ABSPATH') )
    	define('ABSPATH', dirname(__FILE__) . '/');
    define( 'SUNRISE', 'on' );
    require_once(ABSPATH . 'wp-settings.php');
  • S H Mohanjith
    • Developer

    You might have issues with the primary blog tables being missing. It would be an issue if you still have wp_1_options tables and no wp_options.

    Without blogid and siteid in wp-config.php it's not possible to figure out the correct blog and site for global tables. Also it can cause more issues but seems you didn't have any other issues.

    You should copy all wp_1_* tables to wp_* and you should be good for any further upgrades :slight_smile:

  • PrimaryT
    • Site Builder, Child of Zeus

    Ok cheers. We've now got a new problem! Load from php-fpm is spiking massively when using object-cache.php, using all php-fpm child processes. It does make all sites faster initially but then starts throwing errors via Varnish due to timeouts. Not sure if this is due to repcached or something else.

  • PrimaryT
    • Site Builder, Child of Zeus

    Still the same issue, it just ramps up to 100% usage across the board. We had a similar issue with memcached last night when someone had set sessions to use memcache instead of files. Started getting zend_mem_corrupt errors, disabling memcache fixed it immediately. Starting to wonder if my install of nginx/php-fpm just doesn't like memecached.

  • Kimberly
    • Champion of Loops

    Ed Cooper,

    I've been watching this thread and must say it's been fascinating!

    But after getting this far I think that you might be better off getting a sysadmin to look at your database from here forward. It seems as if the support is getting a little deep, and that you need someone who can access all of your system to get the BIG picture :slight_smile:

    I hope that you do get the remainder of your issues solved and I look forward to seeing you around!



Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.