? ? Failure

User tests: Successful: Unsuccessful:

avatar jdolinski
jdolinski
29 Mar 2017

AWS AutoDiscovery
AWS Elasticache Memcached support allows auto-discovery to dynamically manage memcached nodes in the cluster. Amazon ElastiCache Cluster Client is an enhanced PHP library to connect to ElastiCache clusters. This client library has been built upon libmemcached and is released under the Apache License. https://github.com/awslabs/aws-elasticache-cluster-client-memcached-for-php/releases

Current Joomla release as of today (3.6.5) does not support AWS's autodiscovery of nodes and design is based on configuring static nodes in a multi memcached cluster. As of today, the static feature is not fully implemented and will require you to update your configuration if new nodes or failures occur in your cluster. This is a new feature request to support PHP autodiscovery.
Pull Request for Issue #14993.

Summary of Changes

Added support to allow auto discovery of memcached nodes from AWS ElastiCache PHP client.

  1. Created a subclass of the JCacheStorageMemcached for AWS support called JCacheStorageMemcachedaws.
  2. Created new cache handler memcachedaws

Testing Instructions

Prerequisite documentation for autodiscovery configuration.
Installing the ElastiCache Cluster Client for PHP.
Compiling the Source Code for the ElastiCache Cluster Client for PHP

Configure your configuration.php as follows:

public cache_handler = 'memcachedaws'
...
public $memcached_persist = '1';
public $memcached_compress = '1';
public $memcached_server_host = 'your-elasticache-endpoint';
public $memcached_server_port = '11211';
public $memcached_autodiscovery = '1';
...
public session_handler = 'memcached'
public $session_memcached_server_host = 'your-elasticache-endpoint';
public $session_memcached_server_port = '11211';

The configuration.php file will be required to be modified to include the following line:
public $memcached_autodiscovery = '1';
This will allow you to turn on the auto discovery to register all the memcached nodes in your cluster with the Joomla Memcached.

Expected result

Using Auto Discovery Caching with multiple Memcached nodes. You can login and you will not be logged out before the session expiration as you are routed to the nodes in your cluster.

When turning off auto discovery the caching behavior remains same as before this change.

Actual result

Caching in memcached & session management hits.

Documentation Changes Required

I have updated the "administrator/components/com_config/model/form/application.xml"

avatar jdolinski jdolinski - open - 29 Mar 2017
avatar jdolinski jdolinski - change - 29 Mar 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 29 Mar 2017
Category Administration com_config Language & Strings Libraries
avatar jdolinski jdolinski - change - 29 Mar 2017
Labels Added: ? ?
avatar jdolinski jdolinski - change - 29 Mar 2017
The description was changed
avatar jdolinski jdolinski - edited - 29 Mar 2017
avatar brianteeman
brianteeman - comment - 29 Mar 2017

As you can see the travis continuous integration tests are failing with

Fatal error: Undefined class constant 'OPT_CLIENT_MODE' in /home/travis/build/joomla/joomla-cms/libraries/joomla/cache/storage/memcached.php on line 88

avatar jdolinski
jdolinski - comment - 29 Mar 2017

@brianteeman Thanks sorry I didn't realize I opened two issues.

The Travis CI failed because of the dependency on AWS memcached module. Do you need me to work through that?

This made me realize I also need to test this pull on a server using the standard PHP memcached module. I will do this tomorrow and fix code as needed to pass the CI build.

avatar brianteeman
brianteeman - comment - 29 Mar 2017

@mbabker can you comment on that last question as its above my paygrade

avatar jdolinski jdolinski - change - 29 Mar 2017
The description was changed
avatar jdolinski jdolinski - edited - 29 Mar 2017
avatar jdolinski jdolinski - change - 29 Mar 2017
The description was changed
avatar jdolinski jdolinski - edited - 29 Mar 2017
avatar mbabker
mbabker - comment - 29 Mar 2017

We might have to do this as a subclass of the Memcached adapter versus including it inline if it has an additional dependency. That's my first thought.

avatar jdolinski
jdolinski - comment - 29 Mar 2017

I can subclass the memcached class, if that is preferred. It is a different implementation of the memcached module. Let me know your preference and any tips.

avatar jdolinski
jdolinski - comment - 29 Mar 2017

@mbabker @brianteeman BTW - I stumbled upon this issue when trying to use a memcached multi-node cluster with Session Management. The constructor in the memcached.php file had the following //todo. This can be fixed using AWS autodiscovery. I did not remove the //todo in my PR but we can remove if you agree or add a note or leave alone.
// This will be an array of loveliness // @todo: multiple servers $this->_servers = array( array( 'host' => $config->get('session_memcached_server_host', 'localhost'), 'port' => $config->get('session_memcached_server_port', 11211), ), );
Looking forward to your feedback.

avatar csthomas
csthomas - comment - 29 Mar 2017

IMO subclass will be better.
There is a method isSupported() which has to be overrided.

avatar franz-wohlkoenig franz-wohlkoenig - change - 30 Mar 2017
Status Pending Discussion
avatar jdolinski jdolinski - change - 31 Mar 2017
The description was changed
avatar jdolinski jdolinski - edited - 31 Mar 2017
avatar jdolinski
jdolinski - comment - 31 Mar 2017

Added subclass for review and updated ticket documentation for setting up AWS ElastiCache.
Will finish testing on my side next week. Going to create a Apache JMeter load script to test performance and dynamically adding/removing nodes.

avatar jdolinski
jdolinski - comment - 31 Mar 2017

I did not override isSupported() AWS uses same Memcached class

avatar zero-24
zero-24 - comment - 31 Mar 2017

@jdolinski i have just commited some CS Changes and extended doc blocks 91fd32e

avatar csthomas
csthomas - comment - 31 Mar 2017

I mentioned about isSupported() in order to add a condition: if Memcached::OPT_CLIENT_MODE is defined.

avatar jdolinski
jdolinski - comment - 31 Mar 2017

Gotcha, will override that method

avatar jdolinski
jdolinski - comment - 3 Apr 2017

I overrode the isSupported() method, please review latest changes. Will be pushing this version to production (on our side) and begin using with AWS ElastiCache.

Created Apache Jmeter test and discovered bug under load, refactored the dynamic connection code. Was able to add/remove memcached nodes while simulating user connections to multiple pages in test.

avatar jdolinski jdolinski - change - 3 Apr 2017
Title
Adding support for AWS dynamic discovery of nodes in a memcached clus…
Add support for AWS dynamic discovery of nodes in a memcached cluster
avatar jdolinski jdolinski - edited - 3 Apr 2017
avatar jdolinski jdolinski - change - 3 Apr 2017
Title
Adding support for AWS dynamic discovery of nodes in a memcached clus…
Add support for AWS dynamic discovery of nodes in a memcached cluster
avatar jdolinski
jdolinski - comment - 14 Apr 2017

@brianteeman I ran performance tests against memcached and found my site is slower. Very similar and appears to be related to #9898. I will take a look at the comments and see if I can help. Maybe this is the reason the cache handler is still marked as "Experimental"?

avatar franz-wohlkoenig franz-wohlkoenig - change - 11 Apr 2019
Category Administration com_config Language & Strings Libraries Administration com_config Libraries
avatar HLeithner
HLeithner - comment - 1 Jul 2019

Hi @jdolinski,
thx for the time you invested into this PR. We can't merge it into J3 because of the feature freeze.
I'm also not sure if this is the right why to get it into J4 a plugin system for cache/session stores would be a better approach but if you are still interested to get this cache store into Joomla! it would be great if you rebase it for J4.

In the meantime I close this PR, thx for trying to make Joomla! a better CMS.

avatar HLeithner HLeithner - close - 1 Jul 2019
avatar HLeithner HLeithner - change - 1 Jul 2019
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2019-07-01 22:09:10
Closed_By HLeithner
avatar joomla-cms-bot joomla-cms-bot - change - 1 Jul 2019
Category Administration com_config Libraries Administration com_config Language & Strings Libraries

Add a Comment

Login with GitHub to post a comment