JBoss Community Archive (Read Only)

Infinispan 5.1

Using Infinispan Memcached Server


Starting with version 4.1, Infinispan distribution contains a server module that implements the memcached text protocol. This allows memcached clients to talk to one or serveral Infinispan backed memcached servers. These servers could either be working standalone just like memcached does where each server acts independently and does not communicate with the rest, or they could be clustered where servers replicate or distribute their contents to other Infinispan backed memcached servers, thus providing clients with failover capabilities.

Starting an Infinispan memcached server

The simplest way to start up an Infinispan memcached server is to simply unzip the all distribution and either run the startServer.bat or startServer.sh script passing memcached as the protocol to run. For example:

dnb:infinispan-4.0.0-SNAPSHOT galder$ ./bin/startServer.sh -r memcached

When the script is called without any further parameters, the started Infinispan memcached server bounds to port 11211 on localhost ( and uses a local (unclustered) Infinispan cache instance configured with default values underneath.

Command Line Options

You can optionally pass a set of parameters to the Infinispan memcached server that allow you to configure different parts of the server.  You can find detailed information in the server command line options article.

Please note that the mapping between Infinispan Memcached server instances and Infinispan Cache instances is 1 to 1. Therefore, when passing an Infinispan configuration file to the Infinispan Memcache server, the cache created is based of the default cache configuration defined in the file.

Enabling Statistics

To be able to query stats, make sure you enable jmx statistics in the default cache via XML configuration. For example:

   <jmxStatistics enabled="true"/>

Note that since Infinispan 4.2.0.CR1, Infinispan Memcached server has jmx statistics enabled by default, so it's not necessary to pass a configuration file with jmx statistics enabled in order to query Memcached statistics.

Command Clarifications

Flush All

Even in a clustered environment, flush_all command leads to the clearing of the Infinispan Memcached server where the call lands. There's no attempt to propagate this flush to other nodes in the cluster. This is done so that flush_all with delay use case can be reproduced with the Infinispan Memcached server. The aim of passing a delay to flush_all is so that different Memcached servers in a full can be flushed at different times, and hence avoid overloading the database with requests as a result of all Memcached servers being empty. For more info, check the Memcached text protocol section on flush_all.

Unsupported Features

This section explains those parts of the memcached text protocol that for one reason or the other, are not currently supported by the Infinispan based memcached implementation.

Individual Stats

Due to difference in nature between the original memcached implementation which is C/C++ based and the Infinispan implementation which is Java based, there're some general purpose stats that are not supported. For these unsupported stats, Infinispan memcached server always returns 0.

Here's the list of currently unsupported stats:

  • pid

  • pointer_size

  • rusage_user

  • rusage_system

  • bytes

  • curr_connections

  • total_connections

  • connection_structures

  • auth_cmds

  • auth_errors

  • limit_maxbytes

  • threads

  • conn_yields

  • reclaimed

Statistic Settings

The settings statistics section of the text protocol has not been implemented due to its volatility.

Settings with Arguments Parameter

Since the arguments that can be send to the Memcached server are not documented, Infinispan Memcached server does not support passing any arguments to stats command. If any parameters are passed, the Infinispan Memcached server will respond with a CLIENT_ERROR.

Delete Hold Time Parameter

Memcached does no longer honor optional hold time parameter to delete command and so the Infinispan based memcached server does not implement such feature either.

Verbosity Command

Verbosity command is not supported since Infinispan logging cannot be simplified to defining the logging level alone.

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-11 09:16:05 UTC, last content change 2011-07-20 07:46:25 UTC.