check if deflate gets any benefits to single URL
authorDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 2 Nov 2009 15:40:23 +0000 (15:40 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 2 Nov 2009 15:40:23 +0000 (15:40 +0000)
git-svn-id: svn://svn.rot13.org/sysadmin-cookbook@155 191e9f34-6774-4a6d-acfc-7664dacd4a2a

recepies/apache2/deflate-test.sh [new file with mode: 0755]

diff --git a/recepies/apache2/deflate-test.sh b/recepies/apache2/deflate-test.sh
new file mode 100755 (executable)
index 0000000..3e77ef2
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+if [ -z "$1" ] ; then
+       echo "Usage: $0 http://www.example.com/"
+       exit 1
+else
+       url=$1
+fi
+
+time wget $url -O /tmp/foo
+echo
+time wget --header="Accept-Encoding: gzip" $url -O /tmp/foo.gz
+echo
+
+orig_size=`ls -al /tmp/foo    | awk '{ print $5 }'`
+comp_size=`ls -al /tmp/foo.gz | awk '{ print $5 }'`
+
+if [ $comp_size -lt $orig_size ] ; then
+       echo "OK $comp_size < $orig_size";
+else
+       echo "ERROR: no visible compression benefits"
+fi
+
+#ls -al /tmp/foo /tmp/foo.gz