Fine tunning your polipo cacheFollow @ggarron
If you have read my post about Installing personal web server and you have installed it, you may be now enjoying its benefits but now it is maybe time to tweak it a little, specially the way it purges files and maintain the cache size in the disk.
Polipo never erase a file from the cache, so there is a script that installs automatically on your Linux box when you install Polipo that takes care of this, that script is run daily with cron, and it is located at:
/etc/cron.daily/polipo its content is:
#!/bin/sh set -e FORBIDDEN_FILE=/etc/polipo/forbidden CONFIG_FILE=/etc/polipo/config if [ ! -x /usr/bin/polipo ]; then exit 0 fi if [ ! -f $FORBIDDEN_FILE ]; then FORBIDDEN_FILE=/dev/null fi PIDFILE=/var/run/polipo/polipo.pid [ -f "$PIDFILE" ] && kill -USR1 $(cat "$PIDFILE") su -c \ "nice polipo -x -c $CONFIG_FILE forbiddenFile=$FORBIDDEN_FILE > /dev/null" \ proxy [ -f "$PIDFILE" ] && kill -USR2 $(cat "$PIDFILE")
Well now you can see that each day this script polipo with -x parameter, to purge the files in the cache, but which files? this is where we can use some options to modify its default behavior, there are basically three variables in the
/etc/polipo/config file that controls this behavior which are:
- diskCacheTruncateTime: Specifies the time an object should remain unused to be truncated, default is 4 days
- diskCacheUnlinkTime: specifies the time an object should remain unused to be erased, default is 32 days
- diskCacheTruncateSize: Specifies the size at an object is going to be truncated when it arise the diskCacheTruncateTime time
you can tweak your cache disk behavior according to your disk size, or anything that better fits your needs.
At my laptop I did not change its default behavior, but in my Desktop (with more disk) I changed those variables to these values
diskCacheTruncateTime = 10d diskCacheUnlinkTime = 60d diskCacheTruncateSize = 4 MB