[erlang-questions] Mnesia or memcached?

Gleb Peregud <>
Sun Apr 13 00:25:59 CEST 2008


Yariv, take a look at cacherl: http://code.google.com/p/cacherl/

Disclaimer: I'm a project member.

It is an implementation of memcache protocol in erlang (with addition
of optional persistancy for some items). Still in alpha/beta state,
but it is already used by me in a production system without
significant issues.

Probably it can be tuned a little bit to meet your needs. There is an
initial support of "namespaces" - one may improve it by implementing
memory limits for some namespaces (or for whole storage space).

Feel free to send me patches :)

On 4/12/08, Nick Gerakines <> wrote:
> Yariv,
>
> If you use ram + disc backing can't you use the size of the disc from
> dets:info(Table, memory)? Having a process periodically look at this value
> and cleanup based on the file size could work. For the cleanup process to
> work your record would have to store the time the time the record was
> inserted as well as the expiration time.
>
> I could see how under large amounts of read/write load when the system is
> constantly at its max this could strain the app.
>
> Food for thought.
>
> # Nick Gerakines
>
> On Fri, Apr 11, 2008 at 9:38 PM, Yariv Sadan <> wrote:
> > Hi,
> >
> >  I need for an Erlang app a caching solution that does essentially what
> >  memcached does:
> >
> >  1. You tell it the max memory it can use or each node.
> >  2. You insert, lookup and remove objects by primary key.
> >  3. When you look up an object its time stamp is updated to the current
> time.
> >  4. When you insert an object and the max memory is exceeded, the
> >  oldest object(s) is (are) removed to make room for the new object.
> >  5. The cache is distributed. Each key/value pair exists on only one
> >  node in a cluster and is accessible by all nodes.
> >
> >  Should I try to use Mnesia for this (I don't need transactions --
> >  dirty operations are fine) or should I go with memcached?  I know
> >  Mnesia can take care of 1, 3 and 5 but I'm not sure about 1 and 4.
> >  I'll appreciate any feedback.
> >
> >  Thanks,
> >  Yariv
> >  _______________________________________________
> >  erlang-questions mailing list
> >  
> >  http://www.erlang.org/mailman/listinfo/erlang-questions
> >
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>

-- 
Sent from Gmail for mobile | mobile.google.com

Gleb Peregud
http://gleber.pl/

Every minute is to be grasped.
Time waits for nobody.
-- Inscription on a Zen Gong



More information about the erlang-questions mailing list