Maintained by: NLnet Labs

[Unbound-users] memcached backend?

Attila Nagy
Sat Oct 18 17:30:40 CEST 2008


Hello,

If somebody has many caches behind a load balancer, cache coherency can 
be an issue, for example when there is an "old" record with the max TTL, 
fetched from a server, whose admin forgot to lower the TTL and just 
changed the zone, and a "new" cached by another server.
This way the users will be getting inconsistent answers, which is much 
worse than a consistend "bad" (the old record) answer.

Another thing is that no matter if you have room for caching x records 
on each machines, they can't be aggregated, two machines won't be able 
to hold 2*x entries, because they waste memory and cache everything 
twice (if requested, of course).

So I wonder, would anybody like the idea of having memcached as a(n 
optional) storage backend for unbound? (and of course take the time to 
write the code? :)

Pros:
- if you have n machines, you can use n times the memory and increase 
hit rate
- you will get consistent results, no matter what server you asked
- memory can be decoupled from the servers, if needed
- unbound doesn't have to manage the cache (expiring records, limiting 
the overall size), because memcached does this
- cache management could be done from "outside", and deleting a record 
would be effective for all servers, you won't have to delete in each of them

Cons:
- additional latency, answers would be served from a local or remote 
(but not so distant as a remote nameserver) memcached server, not from 
the memory space of the unbound process
- if (any) memcached server gets "ill" (answers, but slows down), 
answers from the cache will be slower, and will be slower for all 
unbound caches
- response times can't be "guaranteed", they can be more hectic and 
depend or more things (network latency, error rates, other server's 
load, etc)

But overall, on a fast local network I think it would be a gain and not 
a loss.

What do you think?

ps: http://www.danga.com/memcached/