Forum Discussion
IheartF5_45022
Nacreous
This post was so unpopular that I was compelled to take it off-forum to get it answered :-). I have a response from Dawn along the following lines;
Here is the feedback I have received, let me know if this works for you
For v10 you can do an invalidation which will remove the item from memory cache and then you would also need to run the attached script to find the item and delete it. Here are some examples of what it can do:
/shared/listhds
/wam/hds/cache/8222/6704.0/_e5/_a73fe25.pvl //jmetertest.f5net.com/p/documents/images/gif_logo_bigip.gif
/wam/hds/cache/8222/6704.0/_c3/_e6d28f5.pvl //jmetertest.f5net.com/p/documents/images/jpe_sun.jpe
/wam/hds/cache/8222/6704.0/_fe/_717dcc5.pvl //jmetertest.f5net.com/p/documents/images/jpeg_maroon_lake.jpeg
/shared/listhds -ls -min_size 400k
1,354,746 Jan 12 12:29 /wam/hds/cache/8222/6704.0/_fe/_717dcc5.pvl //jmetertest.f5net.com/p/documents/images/jpeg_maroon_lake.jpeg
/shared/listhds -ls -min_size 400k -max_size 500k
451,607 Jan 12 12:33 /wam/hds/cache/8222/6623.0/_50/_e44c445.pvl //jmetertest.f5net.com/p/documents/binary/jar_mysql-connector-java-3.1.12-bin.jar
432,650 Jan 12 12:31 /wam/hds/cache/3/3.0/_50/_fccfa25.pvl //0DF64F0DB61EC9A284E2EBD3F7D76FD000860600
For v11 making changes to any of the following features in the policy will evict the item from cache. Make a change to a policy node and invalidate, this will cause an unconditional GET to occur
image optimization (yes/no)
if image optimization is on, a change to any of the sub-settings
image_inlining (regardless of whether it makes sense for that type of object, I think)
css_inlining (also regardless of whether that feature makes sense for the object)
js_inlining (same)
js_reordering (same)
css_reordering (same)
minification (same)
and here is the attached shell script;
!/bin/sh
print pivlet -> UCI mapping
Usage: listhds [-min_size k [-max_size k] [-days_old ]
[-name regexp] [-batch ] [-ls]
-min/max_size should be integers ending with k (kB)
-days_old excludes files greater than days old
-batch specifies how many pivlets showhds will process per invocation
-ls prepends pivlet size and modified time to output lines
for i in "$@"; do
case "$1" in
-min_size) ARGS="$ARGS -size +$2"; shift; shift;;
-max_size) ARGS="$ARGS -size -$2"; shift; shift;;
-days_old) ARGS="$ARGS -mtime -$2"; shift; shift;;
-name) NAME="$2"; shift; shift;;
-batch) BATCH="-L $2"; shift; shift;;
-ls) LS=1; shift;;
*) break;;
esac
done
pick up the cache location from the config file
CACHE=`sed -n 's,^[ \t]*\(.*\).*,\1,p' /config/wa/pvsystem.conf`
do_ls prepends pivlet size and mod time to output
function do_ls {
perl -e '
$now = time; as per ls(1) use time for recent files, else year
$six_months = 6*30*24*3600;
while (<>) {
($file, $uri) = split;
@s = stat $file;
if (@s) {
$size = $s[7];
while ($size =~ s/(.*\d)(\d{3})/\1,\2/) {}; insert commas
$date = localtime($s[9]);
if (($now > $s[9]) && (($now - $s[9]) < $six_months)) {
$date =~ s/^... (.{12}).*/\1/;
} else {
$date =~ s/^... (.{7}).{8}(.*)/\1\2/;
}
printf("%11s %s %s", $size, $date, $_);
}
}'
}
find $CACHE -name '*.pvl' $ARGS |xargs $BATCH showhds -n -u 2>/dev/null |awk '
BEGIN {name="'"$NAME"'"}
/.*<\/uci>/ {
n = split($0, a, /;/)
uci = "//"
for (i=1; i<=n; ++i) {
if (match(a[i], /^L[^Q=]+=(.*).$/, b)) {
uci = uci "/" b[1]
}
else if (match(a[i], /^LQ([^=]+=.+).$/, b)) {
uci = uci "?" b[1]
}
else if (match(a[i], /^LQ([^=]+)=.$/, b)) {
uci = uci "?" b[1]
}
else if (match(a[i], /^V(.*).$/, b)) {
if (b[1] !~ /GET/ && b[1] !~ /POST/ && b[1] !~ /http/) {
uci = uci b[1]
}
}
}
if (match(uci, name) > 0) {
print substr(file, 7, length(file)-7) " " uci
}
} ' | case "$LS" in 1) do_ls;; *) cat;; esac
It works beautifully - run the script, which identifies the pivlet fragments on disk, and then you delete the relevant fragments (using rm).
Ideally this could happen in the data plane without having to get Ops to run this script or apply a new policy, but it's a good start. Thanks to Dawn and her team.
JG
Mar 29, 2014Cumulonimbus
I am getting the following error running this script on v10.2.4:
find: invalid predicate `-->'