Re: [squid-users] Optimising squid cache for USB flash drives

From: Amos Jeffries <>
Date: Sat, 21 Jul 2012 16:38:22 +1200

On 21/07/2012 3:11 p.m., Eliezer Croitoru wrote:
> On 7/20/2012 5:17 PM, haggismn wrote:
>> Hi all,
>> I am a bit of a noob with squid, as well as USB flash storage, so please
>> bear with me.
>> I have squid up and running on a USB equipped dd-wrt router. I have
>> plugged
>> in a 8gb USB flash drive, of which 4gb are allocated for the squid
>> cache.
>> Currently I am using mostly default settings, ie cache_dir ufs
>> /mnt/sda1/cache 4096 16 256
> Nice.
>> I am aware that by using a USB flash drive with squid, the lifespan
>> of the
>> drive will be greatly decreased, due to the limited number of write
>> cycles
>> each block on the disk has. I was therefore wondering if it is
>> possible to
>> set up the caching so that it reduces the number of writes made onto the
>> disk. I have been looking at options like minimum_object_size, which
>> I have
>> set to 8 KB, thus reducing the number of small files written. Will
>> this help
>> in any way? Are there other measure I can take which might help? I
>> have been
>> looking at using COSS storage, with a low max-stripe-waste, with the
>> intention that this might reduce write frequency. As far as I can
>> tell, this
>> will write to the disk in 1MB chunks. Might this help by any chance? Are
>> there any other measures that might help, for example formatting the
>> flash
>> drive in a certain way (although likely limited to FAT32).
> dont think about the lifespan of the drive because if they die they die.
> cache is "by all means possible write to disk what you can" excluding
> the ram cache.
> this is the basic idea of cache.
> USB flash drives are not that fast compared to many HD but can still
> be faster then the link you have.
> the basic thing is to disable logging which you dont really need to
> store on most of wrt devices.
> the "minimum_object_size" is not important in this case (my opinion).
> COSS is not being used anymore and there is a rockstore something.
> anything is better then fat32 in you case of linux OS.
> the reiser FS is ment for lots and lots of small files.
> ext2/3/4 and reiser fs has an option of "noatime" that can reduce some
> drive access but it has a risk of corruption the FS.
> in you case of 4GB cache it really not suppose to be a big deal if you
> will loose it unless you have more data on it.
> i dont remember exactly but the size of the cache dir suppose to be in
> use with your ram size and for a DD-wrt device that dosnt have much
> ram 4gb of cache dir will might not be a good idea.

32-bit OS : 10MB per GB
64-bit OS: 15MB per GB

I'd set the min-size parameter on cache_dir instead of the global
minimum_object_size limit. A lot of small objects can be kept in RAM
cache easily enough without affecting disk lifetime.

Received on Sat Jul 21 2012 - 04:38:42 MDT

This archive was generated by hypermail 2.2.0 : Sat Jul 21 2012 - 12:00:03 MDT