Meta-cache Performance

33 views
Skip to first unread message

Ben Greenberg

unread,
May 27, 2011, 12:50:54 AM5/27/11
to rack-cache
Hi all,

I'm using rack-cache in front of an image generation server. My cached
files are large (images) so I currently write both caches to disk. I
read that I can increase performance by putting the meta cache onto
memcached. The problem is that I already have many gigabytes cached;
the meta cache is currently about 1GB and I expect it to grow quite a
bit. I have two questions:

1) If I switch the meta cache to memcached but keep the entity cache
in the same location, will rack-cache know not to regenerate the
entities? Will this keep my cache relatively warm?

2) Are there any good alternatives to memcached for large meta caches?
Any particular filesystems better than others? Would it help to have
it on a separate volume from the entity cache?

Thanks
Ben

Ryan Tomayko

unread,
May 27, 2011, 1:30:45 AM5/27/11
to rack-...@googlegroups.com
On Thu, May 26, 2011 at 9:50 PM, Ben Greenberg <schn...@gmail.com> wrote:
> Hi all,
>
> I'm using rack-cache in front of an image generation server. My cached
> files are large (images) so I currently write both caches to disk. I
> read that I can increase performance by putting the meta cache onto
> memcached. The problem is that I already have many gigabytes cached;
> the meta cache is currently about 1GB and I expect it to grow quite a
> bit. I have two questions:
>
> 1) If I switch the meta cache to memcached but keep the entity cache
> in the same location, will rack-cache know not to regenerate the
> entities?

Yes. The metastore cache will need to fill in but the disk cache
should not be rewritten.

> Will this keep my cache relatively warm?

I think it would result in each of the cached URLs being generated by
the app in full once, even though the response won't need to be
written to disk. It's hard to say how much this will impact your app's
performance. If a relatively small percentage of URLs are being hit
very often, it should warm up very quickly. Otherwise, it could take
some time to rebuild the metastore cache.

> 2) Are there any good alternatives to memcached for large meta caches?
> Any particular filesystems better than others? Would it help to have
> it on a separate volume from the entity cache?

Depends on the type of disk, how much other activity is happening on
it, amount of RAM for disk cache, etc. If you're on linux than using a
tmpfs volume to back the metastore cache would probably be a nice win.
You'll lose it on restart and tmpfs uses the kernel's vm subsystem so
this will eat into RAM and eventually swap if RAM is low, but you
won't be moving disk heads loading things from cache which will
probably be a win.

Ryan

Ben Greenberg

unread,
May 28, 2011, 2:54:47 PM5/28/11
to rack-cache

On May 27, 1:30 am, Ryan Tomayko <r...@tomayko.com> wrote:
Thanks for the replies. This is on Amazon EC2 with the stores on an
EBS volume. So EBS itself is probably a bottleneck. I think that you
nailed it with the tmpfs suggestion; this will allow me to move my
meta-cache into RAM without having to regenerate everything.

Thanks
Ben
Reply all
Reply to author
Forward
0 new messages