Very cool. Can't wait to take a look.
Does your library support the idea of server state? In other words, if
a server crashes or is otherwise marked offline (but is planned to
return, so not removed from the list), does the hashing still stay
consistent?
Ideally, we don't want items to get re-hashed to a new server (unless,
of course, the server is permanently removed from the pool) because then
there's the chance for stale cache reads in the future. Instead, we
want the hashing to take the same # of servers into account, but for the
client to simply not attempt reads/writes to servers marked "down".
The PECL extension added similar functionality in 2.1.0, and I believe
it's fairly common practice.
Alex Stapleton wrote:
Well I mentioned I had written a UDP capable C library for working with
memcached a couple of days ago and here it is. It requires libketama,
libevent and uses Boost.Build currently. Included is a PHP library that
provides access to it, and pretty much zero documentation. There is a
fairly comprehensive example program and a test PHP script as well. It
works pretty well but has not been tested in any sort of failure
scenario yet.
libevent: http://www.monkey.org/~provos/libevent/
libketama: http://www.last.fm/user/RJ/journal/2007/04/10/392555/
Here's the README with more info
=======
cmemcache - C memcached client
authors: Alex Stapleton <[EMAIL PROTECTED]>
version: 0.5 - Dedicated to Varablese, the Greek God of
uncertainty.
date: 28 Apr 2007
This is the first revision of this client, it seems to mostly work and
valgrind
doesn't report any massive memory issues with it. *crosses fingers* This is
probably usable. It supports TCP and UDP and relies on libketama,
libevent and
Bost.Build. Links to dependencies are down below. Currently it is
assumed all
servers are operating in both UDP and TCP mode with the UDP port 1
higher than
the TCP port listed in the ketama server file. This is a lame hack I know.
It should be pretty easy to add support to force a server to only do TCP
though.
The PHP module has been tested under PHP4 and PHP5. This extension has not
been used in a high load situation yet. Proper QA and bugfixing has not
been done. This is going to be happening over the next week or two as we
roll it out onto our web servers.
Get requests are sent aynchronously using libevent which means you get
pretty
good performance using large numbers of servers for batch requests.
I am almost certain there are horrendously evil bugs in this code. If
anything
breaks and loses your customers or sets your parents on fire, it's not
my fault.
=======
You can only get it from SVN right now the repo is at
svn checkout http://cmemcache.googlecode.com/svn/trunk/ cmemcache
Just type bjam to build it (assuming you have Boost.Build v2 installed.)
I'd appreciate any feedback (especially in the form of patches ;) no
matter how scathing.
Alex Stapleton
[EMAIL PROTECTED]