Preliminary disk-based persistent caching.

Juli Mallett juli at clockworksquid.com
Fri Apr 24 13:20:26 PDT 2015


Folks,

The latest code in GitHub contains preliminary support for persistent,
on-disk caching.  This can work either with a raw, block device (as
long as the block size is 512 or 2048; 4k block size devices would not
work at present) or with a file on a filesystem.  The on-disk cache
can be shared between multiple proxies and multiple peers within a
single WANProxy instance.

See the "wanproxy.conf" file in programs/wanproxy to see an example of
how to configure a cache hierarchy including a RAM-backed, "hot"
cache, and an on-disk persistent cache.  Note that the configuration
system now exposes the ability to configure a cache hierarchy (of
arbitrary complexity; you can chain pairs of primary and secondary
caches), including setting a limit on the in-memory cache size.

Do note, though, that at present there is no distinction between a
backing/underlying cache and the per-peer cache in the API, and while
there are hacks in place to allow the disk cache to be shared by
multiple peers (i.e. multiple UUIDs), the size limit on an in-memory
cache applies on a *per-peer* basis, rather than in total.  So that's
still clearly a shortcoming, and while it's fairly easy to address, I
have not yet done so.  I have been approached by someone who wanted to
fund improvements to the caches in general, and began this work
towards meeting their needs, but they have ceased corresponding, and
the next month will be a very busy time for me.  It would not take
much to clean up the API, refine some of the related abstractions, and
enforce a cache-wide limit on in-memory data storage, I just don't
know when I'll next be able to take the time away from paid work to do
this.  If that work does pick back up, I also would intend to
implement LRU replacement of on-disk cache entries, rather than the
current FIFO strategy, which would not be very difficult.  (The
on-disk layout was practically designed for it; there's no fixed FIFO
notion for the whole cache as such but the FIFO head is established by
a `counter' field which is in practice linear and monotonically
increasing, but need not be.)

Thanks,
Juli.


More information about the wanproxy mailing list