| Index | Alphabetical Index |
Option Name: | cache_dir |
---|---|
Replaces: | |
Requires: | |
Default Value: | none |
Suggested Config: |
# Uncomment and adjust the following to add a disk cache directory. #cache_dir ufs /usr/local/squid/var/cache/squid 100 16 256 |
Usage: cache_dir Type Directory-Name Fs-specific-data [options] You can specify multiple cache_dir lines to spread the cache among different disk partitions. Type specifies the kind of storage system to use. Only "ufs" is built by default. To enable any of the other storage systems see the --enable-storeio configure option. 'Directory' is a top-level directory where cache swap files will be stored. If you want to use an entire disk for caching, this can be the mount-point directory. The directory must exist and be writable by the Squid process. Squid will NOT create this directory for you. In SMP configurations, cache_dir must not precede the workers option and should use configuration macros or conditionals to give each worker interested in disk caching a dedicated cache directory. The ufs store type: "ufs" is the old well-known Squid storage format that has always been there. cache_dir ufs Directory-Name Mbytes L1 L2 [options] 'Mbytes' is the amount of disk space (MB) to use under this directory. The default is 100 MB. Change this to suit your configuration. Do NOT put the size of your disk drive here. Instead, if you want Squid to use the entire disk drive, subtract 20% and use that value. 'L1' is the number of first-level subdirectories which will be created under the 'Directory'. The default is 16. 'L2' is the number of second-level subdirectories which will be created under each first-level directory. The default is 256. The aufs store type: "aufs" uses the same storage format as "ufs", utilizing POSIX-threads to avoid blocking the main Squid process on disk-I/O. This was formerly known in Squid as async-io. cache_dir aufs Directory-Name Mbytes L1 L2 [options] see argument descriptions under ufs above The diskd store type: "diskd" uses the same storage format as "ufs", utilizing a separate process to avoid blocking the main Squid process on disk-I/O. cache_dir diskd Directory-Name Mbytes L1 L2 [options] [Q1=n] [Q2=n] see argument descriptions under ufs above Q1 specifies the number of unacknowledged I/O requests when Squid stops opening new files. If this many messages are in the queues, Squid won't open new files. Default is 64 Q2 specifies the number of unacknowledged messages when Squid starts blocking. If this many messages are in the queues, Squid blocks until it receives some replies. Default is 72 When Q1 < Q2 (the default), the cache directory is optimized for lower response time at the expense of a decrease in hit ratio. If Q1 > Q2, the cache directory is optimized for higher hit ratio at the expense of an increase in response time. The rock store type: cache_dir rock Directory-Name Mbytes <max-size=bytes> [options] The Rock Store type is a database-style storage. All cached entries are stored in a "database" file, using fixed-size slots, one entry per slot. The database size is specified in MB. The slot size is specified in bytes using the max-size option. See below for more info on the max-size option. If possible, Squid using Rock Store creates a dedicated kid process called "disker" to avoid blocking Squid worker(s) on disk I/O. One disker kid is created for each rock cache_dir. Diskers are created only when Squid, running in daemon mode, has support for the IpcIo disk I/O module. swap-timeout=msec: Squid will not start writing a miss to or reading a hit from disk if it estimates that the swap operation will take more than the specified number of milliseconds. By default and when set to zero, disables the disk I/O time limit enforcement. Ignored when using blocking I/O module because blocking synchronous I/O does not allow Squid to estimate the expected swap wait time. max-swap-rate=swaps/sec: Artificially limits disk access using the specified I/O rate limit. Swap out requests that would cause the average I/O rate to exceed the limit are delayed. Individual swap in requests (i.e., hits or reads) are not delayed, but they do contribute to measured swap rate and since they are placed in the same FIFO queue as swap out requests, they may wait longer if max-swap-rate is smaller. This is necessary on file systems that buffer "too many" writes and then start blocking Squid and other processes while committing those writes to disk. Usually used together with swap-timeout to avoid excessive delays and queue overflows when disk demand exceeds available disk "bandwidth". By default and when set to zero, disables the disk I/O rate limit enforcement. Currently supported by IpcIo module only. The coss store type: NP: COSS filesystem in Squid-3 has been deemed too unstable for production use and has thus been removed from this release. We hope that it can be made usable again soon. block-size=n defines the "block size" for COSS cache_dir's. Squid uses file numbers as block numbers. Since file numbers are limited to 24 bits, the block size determines the maximum size of the COSS partition. The default is 512 bytes, which leads to a maximum cache_dir size of 512<<24, or 8 GB. Note you should not change the coss block size after Squid has written some objects to the cache_dir. The coss file store has changed from 2.5. Now it uses a file called 'stripe' in the directory names in the config - and this will be created by squid -z. Common options: no-store, no new objects should be stored to this cache_dir min-size=n, refers to the min object size in bytes this cache_dir will accept. It's used to restrict a cache_dir to only store large objects (e.g. aufs) while other storedirs are optimized for smaller objects (e.g. COSS). Defaults to 0. max-size=n, refers to the max object size in bytes this cache_dir supports. It is used to select the cache_dir to store the object. Note: To make optimal use of the max-size limits you should order the cache_dir lines with the smallest max-size value first and the ones with no max-size specification last. Note for coss, max-size must be less than COSS_MEMBUF_SZ, which can be changed with the --with-coss-membuf-size=N configure option. |
|
| Index | Alphabetical Index |