A simple, asynchronous, single-threaded memcached client written in java.
Java Other
Latest commit 953c322 Jun 23, 2014 @daschl daschl committed with daschl SPY-176: Enhance redistribution logic and avoid possible deadlocks.
There have been issues reported that redistribution of operations does
not work as expected, especially with authentication scenarios. This
has been tracked down and the following changes have been made:


	- With the old redistribute logic, it could happen that subsequent
	  ops in the retry queue got accidentally deleted. With the copy
	  first, this cannot happen anymore.
	- On redistribute, if the handling node is still not set, just
	  clone the operation to avoid NPEs. A op without a node set
	  can happen if it is enqueued to retry because the target node
	  is not yet authenticated.
	- Do not try to add operations to a node which is not yet authen
	  ticated. This can lead to costly locks with redistributions since
	  they are run from the IO thread. Without the change, it can happen
	  that the IO thread waits for an auth latch, but is also responsible
	  for telling listeners when auth has completed, therefore
	  locking everything up until the auth latch wait runs out of time.

Much better resilience and performance with redistributions, especially
if authentication takes longer than expected and from scenarios where the
operations get redistributed/moved around from within the IO thread.

Change-Id: Icbc5f9e4f568ea885500e8d2baedfa989c8ef801
Reviewed-on: http://review.couchbase.org/38669
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
Reviewed-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>



Spymemcached can be compiled using Apache Ant by running the following command:


This will generate binary, source, and javadoc jars in the build directory of the project.

To run the Spymemcached tests against Membase Server run the following command:

ant test -Dserver.type=membase

To test Spymemcached against Membase running on a different host use the following command:

ant test -Dserver.type=membase \


The latest version of spymemcached has a set of command line arguments that can be used to configure the location of your testing server. The arguments are listed below.


This argument is used to specify the ipv4 address of your testing server. By default it is set to localhost.


This argument is used to set the ipv6 address of your testing server. By default it is set to ::1. If an ipv6 address is specified then an ipv4 address must be specified otherwise there may be test failures.


This argument is used when memcahched is started on a port other than 11211


This argument is used for CI testing where certain unit tests might be temporarily failing.

More Information

For more information about Spymemcached see the links below:

Project Page The

Spymemcached Project Home contains a wiki, issue tracker, and downloads section.


The gitub page contains the latest Spymemcached source.


At couchbase.org you can find a download's section for the latest release as well as an extensive tutorial to help new users learn how to use Spymemcached.