As we run into filesystem bottlenecks, it makes sense to reduce the
filesystem access by caching thumbnail images in memcached. The
thumbnails are about 6-7 KB in size. We want to ensure there's a hot set
of thumbnails being cached in memcached but not that every image gets
cached. So here's my first draft on how to achieve that:
1. All thumbnails that are accessed by the client and driver are cached
in memcached with a timeout of 90 seconds. Of course, we can still
adjust this. Any access to the thumbnails will check the cache at first.
2. In order to keep the hot set low, we will modify our tag search query
to order by event date with the most recent upcoming events first. As a
result, the set of events searched by each tag are more deterministic
and will not often change. Since the tag search only shows 10 events per
page, the thumbnails for these top ten events for each tag will be held
in memcached.
The mathematical model for this is a little complicated, though. Since
we're dealing with non-uniform distribution of tags and a cap of 10
upcoming events on top of that. But please let me know whether you agree
with this conceptually.
Thanks,
-Akara
- Thumbnail caching proposal Akara Sucharitakul
-