Need help setting up a caching thumbnail server

Ryan Malayter malayter at
Wed Apr 14 17:07:46 MSD 2010

On Wed, Apr 14, 2010 at 1:58 AM, JamesAB <nginx-forum at> wrote:
> I've got a site with a lot of images and we are currently using apache to serve the static thumbnails. We have over 1.7 million thumbnails using over 30GB of disk space. So the average thumbnail is around 18kb.
> I'd like to setup a new dedicated server with 8GB RAM just running nginx to serve the static thumbnails.
> What will be the best way to approach the nginx configuration to take advantage of the RAM for caching the most frequently accessed thumbnail images and reducing disk I/O?

Unless there are some other requirements unmentioned, you don't need
to do anything special. The file-system cache (on Linux or whatever
OS) should keep the directory data and most frequently hit images in
RAM. This would even if you are running apache. You need to look at
the access ratios for images, though. If access to the images is
pretty uniform, cache won't help much unless it is the size of your
image store (32 GB RAM is pretty cheap.)

With only 30 GB of images, though, I would seriously consider using
solid state disk for your image server. That way, even with a cache
miss, you're going to get sub-millisecond response times from the
"disk" subsystem. Flash-based SSDs are way less expensive than RAM,
and would move the bottleneck from disk to your network just as easily
as RAM cache. If this is read-mostly, even some of the
"non-enterprise" SSDs might work well for you, and they are much
cheaper. An 80 GB Intel X25-Ms is about $200 now. Be wary of the
really inexpensive off-brands, though, the controllers and performance

We're using the Intel X-25Ms on a few systems, and routinely see
thousands of read IOPS from one drive. Even a 15K magnetic disk can
only do about 180 IOPS. With a lot of writes, you may need to look at
the X-25E versions, which are a lot more expensive but have better
write performance and endurance.


More information about the nginx mailing list