Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

a memcached proxy with energy and pep

Fetching latest commit…

Cannot retrieve the latest commit at this time

debian force use of bundled libconflate & libstrophe for binary packages
devtools Implement 'noreply' option for update commands. (Tomash Brechko <toma…
doc
libconflate @ f450512
libmemcached-0.30
patches
scripts
t
.gitignore
.gitmodules Changing submodule pointer to northscale github repository.
.shipit Checking in changes prior to tagging of version 1.2.4. Changelog diff…
AUTHORS autoconf/automake support from evan
BUILD
COPYING add a duplicate of the LICENSE file so GNU automake doesn't assume it…
ChangeLog Changelog update from 1.2.8 fixes.
Doxyfile Exclude testapp.c instead of internal_tests.c from docs.
HACKING Remove reference to glib in the HACKING doc.
LICENSE change from GPL to BSD.
Makefile.am
NEWS auto* changes, update to version 1.0.2
README
TODO merge end of facebook branch into trunk, after copying the old trunk …
TODO.moxi added stats todo items
agent.h
agent_config.c
agent_ping.c
agent_stats.c
assoc.c
assoc.h
autogen.sh
cache.c
cache.h
check_moxi.c
check_moxi_agent.c
check_util.c
check_work.c
configure.ac
cproxy.c
cproxy.h
cproxy_config.c
cproxy_front.c
cproxy_multiget.c
cproxy_protocol.c
cproxy_protocol_a2a.c
cproxy_protocol_a2b.c
cproxy_stats.c
daemon.c
genhash.c
genhash.h
genhash_int.h
globals.c
hash.c
hash.h
items.c
items.h
matcher.c
matcher.h
memcached.c
memcached.h
memcached.spec.in Merged in 1.4.1
memcached_dtrace.d
protocol_binary.h
redirects.c
redirects.h
sizes.c
slabs.c
slabs.h
solaris_priv.c
stats.c
stats.h
testapp.c
thread.c
timedrun.c
trace.h
util.c
util.h
version.sh
work.c
work.h
README
moxi - a memcached proxy with energy and pep

Dependencies:

   -- libevent, http://www.monkey.org/~provos/libevent/ (libevent-dev)
   -- libmemcached, http://tangent.org/552/libmemcached.html

To compile moxi, after you got the dependencies:

  ./autogen.sh
  ./configure
  make

For example, if libevent is installed in /opt/local, you'd do...

  ./autogen.sh
  ./configure --with-libevent=/opt/local
  make

Using moxi:

In moxi terminology, "upstream" are the memcached clients,
and "downstream" are the memcached servers.

  moxi -z <port=<memcached_host:memcached_port(,*)>>

moxi will listen on the given port and accept connections from
upstream memcached clients.  It will forward requests to downstream
memcached servers running on memcached_host:memcached_port.  For
example...

  moxi -z 11211=my_memcached_server:11222

Above, moxi will listen on port 11211 and forward requests
to the memcached running on my_memcached_server that's listening
on port 11222.

You can list more than one memcached_host:memcached_port,
separated by commas.  For example...

  moxi -z 11211=memcached_1:11211,memcached_2:11211

The default downstream port is 11211, so you can also
just use...

  moxi -z 11211=memcached_1,memcached_2

If you have some memcached servers running on the same server,
but on different ports, you can put moxi in front of them
with something like...

  moxi -z 11211=server:11222,server:11233

To get more command line usage info:

  moxi -h

Tests:

  # To test that moxi still behaves like memcached
  # and passes all the tests that memcached passes...
  #
  make test

  # To test moxi in a simple proxy topology of...
  #  client <-> moxi <-> memcached
  #
  ./t/moxi.pl

  # To test moxi in a chained proxy topology of...
  #   client <-> moxi <-> moxi <-> moxi <-> memcached
  #
  ./t/moxi.pl chain

  # To test moxi in a fanout topology of...
  #   client <---> moxi <---> memcached
  #                       |-> memcached
  #                       |-> memcached
  #                       |-> memcached
  #
  ./t/moxi.pl fanout

  # To test moxi in a fanout and back in again topology of...
  #   client <---> moxi <---> moxi <-> memcached
  #            |-> moxi <-|
  #            |-> moxi <-|
  #            |-> moxi <-|
  #
  ./t/moxi.pl fanoutin

  # To test moxi proxy cases...
  #
  ./moxi -z 11333=localhost:11311 -t 1
  python t/moxi_mock.py

More notes:

If using Linux, you need a kernel with epoll.  Sure, libevent will
work with normal select, but it sucks.

epoll isn't in Linux 2.4 yet, but there's a backport at:

    http://www.xmailserver.org/linux-patches/nio-improve.html

You want the epoll-lt patch (level-triggered).

If you're using MacOS, you'll want libevent 1.1 or higher to deal with
a kqueue bug.

Also, be warned that the -k (mlockall) option to memcached might be
dangerous when using a large cache.  Just make sure the memcached machines
don't swap.  memcached does non-blocking network I/O, but not disk.  (it
should never go to disk, or you've lost the whole point of it)

The memcached website is at:

    http://www.danga.com/memcached/
Something went wrong with that request. Please try again.