pfsense:squid:local_cache
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
pfsense:squid:local_cache [2020/03/14 12:33] – created peter | pfsense:squid:local_cache [2020/07/15 09:30] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 6: | Line 6: | ||
|Low-Water Mark in %|90| | |Low-Water Mark in %|90| | ||
|High-Water Mark in %|95| | |High-Water Mark in %|95| | ||
+ | |Do Not Cache|< | ||
+ | steampowered.com | ||
+ | steamcommunity.com | ||
+ | steamgames.com | ||
+ | steamusercontent.com | ||
+ | steamcontent.com | ||
+ | steamstatic.com | ||
+ | </ | ||
+ | |Enable Offline Mode|Not checked| | ||
+ | |External Cache Managers| | | ||
+ | ---- | ||
+ | ===== Squid Hard Disk Cache Settings ===== | ||
+ | |Hard Disk Cache Size|50000| | ||
+ | |Hard Disk Cache System|aufs| | ||
+ | |Level 1 Directories|64| | ||
+ | |Hard Disk Cache Location|/ | ||
+ | |Minimum Object Size|0| | ||
+ | |Maximum Object Size|1024| | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Squid Memory Cache Settings ===== | ||
+ | |||
+ | |Memory Cache Size|3072| | ||
+ | |Maximum Object Size in RAM|1024| | ||
+ | |Memory Replacement Policy|Heap GDSF| | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Dynamic and Update Content ===== | ||
+ | |||
+ | |Memory Replacement Policy|Checked| | ||
+ | |Custom refresh_patterns|< | ||
+ | # 1 year = 525600 mins, 1 month = 43800 mins, 1 week = 10080 min, 1 day = 1440 min | ||
+ | |||
+ | #Optional: dont cache wordpress admin panel | ||
+ | refresh_pattern (wp-admin) | ||
+ | |||
+ | # All Files. | ||
+ | refresh_pattern -i \.(3gp|7z|ace|asx|avi|bin|inc|cab|dat|qt|deb|rpm|divx|dvr-ms)(\? | ||
+ | refresh_pattern -i \.(rar|jar|gz|tgz|tar|bz2|iso|arj|lha|lzh|iop|nzp|pak|mar)(\? | ||
+ | refresh_pattern -i \.(m1v|m2(v|p)|mo(d|v)|(x-|)flv)(\? | ||
+ | refresh_pattern -i \.(jp(e? | ||
+ | refresh_pattern -i \.(mp(e? | ||
+ | refresh_pattern -i \.(og(x|v|a|g)|rar|rm|r(a|p)m|snd|vob|wav|ac4)(\? | ||
+ | refresh_pattern -i \.(pp(s|t)(x? | ||
+ | refresh_pattern -i \.(woff|txt|exe|dll|dmg|webm)(\? | ||
+ | refresh_pattern -i \.(pdf|rtf|xls(x? | ||
+ | refresh_pattern -i \.(css)(\? | ||
+ | refresh_pattern -i \.(js)(\? | ||
+ | |||
+ | refresh_pattern -i \.(html|htm)(\? | ||
+ | # | ||
+ | |||
+ | refresh_pattern -i \.(cdn) 10800 100% 43800 override-expire override-lastmod reload-into-ims ignore-reload ignore-no-cache ignore-private | ||
+ | refresh_pattern -i (cdn) 10800 100% 43800 override-expire override-lastmod reload-into-ims ignore-reload ignore-no-cache ignore-private | ||
+ | |||
+ | |||
+ | refresh_pattern \.ytimg\? 10800 90% 10800 override-expire ignore-reload ignore-no-cache | ||
+ | refresh_pattern ^http:// | ||
+ | refresh_pattern ^http:// | ||
+ | refresh_pattern ^http:// | ||
+ | refresh_pattern ^http:// | ||
+ | refresh_pattern ^http:// | ||
+ | refresh_pattern ^http:// | ||
+ | refresh_pattern ^http:// | ||
+ | |||
+ | refresh_pattern ^ftp: 1440 20% 10080 | ||
+ | refresh_pattern ^gopher: 1440 0% 1440 | ||
+ | |||
+ | # Dynamic Content. | ||
+ | refresh_pattern -i (/ | ||
+ | |||
+ | # Catch all. | ||
+ | # | ||
+ | refresh_pattern . 0 20% 4320 | ||
+ | </ | ||
+ | |||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== cache_mem ===== | ||
+ | |||
+ | This is one of the top two options as far as performance impact goes. | ||
+ | |||
+ | The default value here is 8 MB, which is a safe option for just about any system size. | ||
+ | |||
+ | But since your box is not lacking in memory it can safely be raised to 32 MB, and even 48 if you have stripped all other services off of your server. | ||
+ | |||
+ | If your box is lacking in memory, go back to the hardware section and reread the part about memory...you need a bunch of memory for a fast web cache. | ||
+ | |||
+ | You should be aware that **cache_mem** does not limit the process size of squid. This sets how much memory squid is allowed to set aside for "hot objects" | ||
+ | |||
+ | Having said all that, keep in mind that the buffer cache in Linux is also quite good, so the gains you'll see by raising this are very small, but still measurable. | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== cache_dir ===== | ||
+ | |||
+ | This is where you set the directories you will be using. | ||
+ | |||
+ | You should have already mkreiserfs' | ||
+ | |||
+ | First, you will want to use about 80% or less of each cache directory for the web cache. | ||
+ | |||
+ | If you use any more than that you will begin to see a slight degradation in performance. | ||
+ | |||
+ | Remember that cache size is not as important as cache speed, since for maximum effectiveness your cache needs only store about a weeks worth of traffic. | ||
+ | |||
+ | You'll also need to define the number of directories and sub-directories. | ||
+ | |||
+ | < | ||
+ | x=Size of cache dir in KB (i.e. 6GB=~6, | ||
+ | y=Average object size (just use 13KB) | ||
+ | z=Number of directories per first level directory (((x / y) / 256) / 256) * 2 = # of directories | ||
+ | |||
+ | As an example, if 6GB of the drives is used, so: | ||
+ | |||
+ | 6,000,000 / 13 = 461538.5 / 256 = 1802.9 / 256 = 7 * 2 = 14 | ||
+ | |||
+ | So my cache_dir line would look like this: cache_dir 6000 14 256 | ||
+ | </ | ||
pfsense/squid/local_cache.1584189187.txt.gz · Last modified: 2020/07/15 09:30 (external edit)