Do-It-Yourself Caching: Squid 2.3 - page 7
Why Caching is Essential
Once you've stabilized Squid, you can then proceed to fine-tune its operating efficiency. The configuration file contains over 100 tuning knobs. Among other things, you can:
- modify listening ports, IP addresses, hostnames and connect, select, request and ident timeouts
- modify outgoing ports to spread response handling across multiple interfaces
- specify ICP ports, neighbor selection criteria (including weight and TTL) and cache digests
- set cache swap high and low water marks for cache object replacement
- limit the largest object size or prevent caching based on URL substrings
- determine the location, size and index levels for cache storage configure the size and refresh behavior for the IP and FQDN (DNS) caches
- enable and configure memory pools to increase speed
- enable and configure delay pools to constrain bandwidth
- set maximum HTTP request and reply body and header sizes to protect against DOS attacks
- define min / max lifetimes for objects without TTL, identified by URL regular expression
- choose a replacement policy (see below)
Earlier versions of Squid had a single self-explanatory replacement policy: Least Recently Used (LRU). In version 2.3, you can also choose Greedy-Dual Size Frequency (GDSF) or Least Frequently Used with Dynamic Aging (LFUDA). GDSF gives priority to smaller objects that have a better chance of getting hit. LFUDA is more like LRU, but employs a dynamic aging mechanism that is said to be more efficient than recent usage. Generally, GDSF produces a higher hit rate, while LFUDA reduces WAN bandwidth use. For further details, follow the URLs supplied in squid.conf.
Squid can't provide the patented adaptive or predictive refresh methods used by some commercial caching products and doesn't include the ability to preload specified high-utilization sites. However, it is quite simple to write a script that uses wget to download sites, invoked on a scheduled basis by cron.
You'll find a tuning tips to increase hit rate, improve response time and optimize cache performance in the Squid FAQ. The Cache Manager offers instantaneous, tabular stats. General Runtime Info summarizes HTTP, ICP and DNS request rates, hit ratios, median service times, mean object size, CPU, memory, swap and file descriptor usage.
Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.
- 1Linux Top 3: RHEL 6.7, BackBox Linux 4.3 and RoboLinux 8.1
- 2Linux Top 3: SLES 11 SP4, Chromixium OS 1.5 and Canonical Licensing
- 3Linux Top 3: VirtualBox 5, Point Linux 3.0 and OpenSUSE Leap 42.x
- 4Linux Top 3: Linux 4.2 rc1, 4MLinux 13 and antiX15
- 5Linux Top 3: Linux Mint Rafaela, OpenMandriva Lx 2014.2 and VectorLinux 7.1