Squid proxy server supports two types of caching – RAM caching and hardware caching. While configuring you should keep in mind that caching may either accelerate query processing or slow it down, in case configuration parameters are wrong. Another important point is that caching results in additional load on server, e.g. excessive cache in RAM is able to paralyze sever causing lack of RAM.
Squid standard configuration provides RAM cache only with memory usage of 256 Mbyte. You may increase cache volume and set maximum volume of a cached object using the following directives:
cache_mem 1024 MB #volume of the memory available for casing maximum_object_size_in_memory 512 KB #maximum volume of a cached object
Also, one should take into account that cache is reset every time sever restarts or turns off, so the results of configuration change will be perceptible only over time.
HDD cache usage is controlled by
cache_dir storage_type path_to_storage volume L1 L2
cache_dir ufs /var/squid_cache 1024 16 256
Cache volume on hardware is counted in Mbytes. In the example below cache with maximum volume of 1 Gbyte is stored in /var/squid_cache. ufs storage type is standard. Parameters 16 and 256 denote the number of first and second level directories, these volumes are standard, too.
You may also specify the cached object maximum volume:
maximum_object_size 2 MB