You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Joshua Marantz <jm...@google.com> on 2012/08/17 19:38:30 UTC
Re: apr_memcache vs libmemcached
Following up: I've been pretty successful using apr_memcache so far. The
performance is roughly on par with a file-cache running on a tmpfs
partition, but of course it adds network scalability. I'd encourage anyone
wanting to integrate memcached into Apache modules to give it a try. It
might even be one of the easiest ways to get a map that can be used across
processes on a single server, rather than working with shared memory.
It *looks* like libmemcached has a richer API and the potential for better
performance due to asynchronous APIs and usage of the memcached binary
protocol, but I have not been as successful with it. And apr_memcache
seems good enough, performance wise, based on my load tests, and so far
it's very stable.
Example usage:
http://code.google.com/p/modpagespeed/source/browse/trunk/src/net/instaweb/apache/apr_mem_cache.cc,
.h<http://code.google.com/p/modpagespeed/source/browse/trunk/src/net/instaweb/apache/apr_mem_cache.h>,
and _test.cc<http://code.google.com/p/modpagespeed/source/browse/trunk/src/net/instaweb/apache/apr_mem_cache_test.cc>
.
-Josh
On Thu, Jul 19, 2012 at 5:47 PM, Joshua Marantz <jm...@google.com> wrote:
> I think the point of that Wiki was that whoever wrote that entry claimed
> that apr_memcached wasn't being actively worked on, but perhaps that's
> false. I don't think the implication was that the work was expected to
> happen in code.google.com.
>
> This question is in the context of mod_pagespeed<https://developers.google.com/speed/pagespeed/mod>,
> which currently uses the file system for caching that's visible across
> Apache child processes. That works pretty well but has limitations in
> performance and network scope. memcached is being considered as a possible
> replacement for that.
>
> I'll take a look at socache.
>
>
> One of the advantages of libmemcached is that it supports -- or claims to
> support -- asynchronous fetches, which we believe is important for
> performance at scale. However, I have not actually been able to get that
> to work as expected, and have fallen back to a fairly synchronous model.
> The libmemcached API *looks* asynchronous -- it just doesn't seem to quite
> work. And if I'm going to stay synchronous then it might be a lot easier
> to integrate if I use the built in APR support. And even synchronous
> fetches from memcached might be better than synchronous reads form disk.
>
> Thanks,
> -Josh
>
>
> On Thu, Jul 19, 2012 at 5:39 PM, Nick Kew <ni...@apache.org> wrote:
>
>> On Thu, 19 Jul 2012 16:41:51 -0400
>> Joshua Marantz <jm...@google.com> wrote:
>>
>> > Hi,
>> >
>> > Is anyone maintaining apr_memcache? Or should I stick with
>> libmemcached?
>> >
>> > This page: http://code.google.com/p/memcached/wiki/Clients suggests
>> > apr_memcached is not maintained.
>>
>> Huh? It's not maintained at google code since it was contributed
>> to the core APR project. If you have any reasonably recent APR
>> installed (as you must have if you run httpd), it includes
>> apr_memcache.
>>
>> Since you posted here I'd guess your purpose is writing a module?
>> You might want to look at the socache modules as a higher-level
>> abstraction.
>>
>>
>> --
>> Nick Kew
>>
>
>