Implement Memached OPT_REMOVE_FAILED_SERVERS (sharding)

Created on 18 July 2024, 5 months ago
Updated 19 July 2024, 5 months ago

Problem/Motivation

The PECL memcached extension allows the automatic removal of dead servers. This feature could allows this module to relocated lost keys to the remaining cache servers, hence enabling high availability and resilience without any specific setup. At the moment, a single missing server equals no cache at all (but no White Screen Of Death as with Redis).

See: https://holmeshe.me/understanding-memcached-source-code-X-consistent-has... & https://www.php.net/manual/en/memcached.addservers.php

Steps to reproduce

  1. Install memcached php extension
  2. Configure this module as usual, enable memcache_admin sub module
  3. Set two memcached servers
  4. Add this config :
    $settings['memcache']['servers'] =  ["memcached:11211" => "default", "memcached2:11211" => "default"];
    $settings['memcache']['options'][Memcached::OPT_SERVER_FAILURE_LIMIT] = 2;
    $settings['memcache']['options'][Memcached::OPT_REMOVE_FAILED_SERVERS] = true;
    $settings['memcache']['options'][Memcached::OPT_CONNECT_TIMEOUT] = 10;
  5. Test a web page response time and check stats from /admin/reports/memcache
  6. Stop one of the memcached server
  7. Test again the web page response time and visits stats from /admin/reports/memcache

The performance are terrible and the stats page display an error.

Proposed resolution

Have a main maintainer confirm my diagnostic and determine if a fix could be made without rewriting the whole module or losing the memcache PECL compatibilty.

So far, my first approach was to "xdebug it" and catch each errors related to missing server.

Here's my first thoughts:

  • Remove dependencies form
    $settings['memcache']['servers'] 
    

    , get the servers list from Memcached::getServerList

  • Check if PECL memcache allows the same behavior

Remaining tasks

API changes

Some new methods should be created.

Feature request
Status

Active

Version

2.0

Component

Code

Created by

🇫🇷France O'Briat Nantes

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024