RE: Statistics for access times

From: Andrew Richards <>
Date: Mon, 2 Sep 1996 19:25:59 +-200

Hi all,

(View this message in a fixed-width font)

Someone helpfully pointed me in the direction of the release notes for Squid,
so I've hacked together a quick awk script to get the stats out of Squid
that I've come to expect, after using Netscape proxy. So what I've written
gives you output like this,

        local cache remote cache remote proxied no proxy,cache other
Number: 1255 522 2994 965 177
         21.2% 8.8% 50.6% 16.3% 3.0%
Time: 1.0s 1.7s 6.1s 3.7s 15.9s

which seems to nicely complement the existing stats scripts provided at nlanr.
It's written for nawk (for awk it probably needs a few formatting changes).

Here's the source - what I'd like now is if any of you use it, to check
whether I'm interpreting the logfile entries properly - in particular
the FIRST_PARENT_MISS entry. I say this because the results above are
real results and look peculiar to me - that the proxied time is longer
than the direct time. Am I doing something wrong?

The script is written for Squid's native logfile format (now I know
what that switch emulate_httpd_log and the -f switch for the nlanr
stats script means....)

Any improvements to this program will be most welcome
- please mail me as well as the list.


Andrew Richards.

        clientcache=1; t_clientcache=0;
           localhit=1; t_localhit=0;
        neighborhit=1; t_neighborhit=0;
          parenthit=1; t_parenthit=0;
         parentmiss=1; t_parentmiss=0;
             direct=1; t_direct=0;
               deny=1; t_deny=0;
               fail=1; t_fail=0;

/LOG_NONE/ { next }
/UDP_/ { next }
/ERR_/ { fail++; t_fail += $2; next}
/IFMODSINCE/ && /304/ {clientcache++; t_clientcache += $2; next};
/TCP_HIT/ { localhit++; t_localhit += $2; next};
/TCP_DENIED/ { deny++; t_deny += $2; next};
/DIRECT/ { direct++; t_direct += $2; next};
/NEIGHBOR_HIT/ { neighborhit++; t_neighborhit += $2; next};
/PARENT_HIT/ { parenthit++; t_parenthit += $2; next};
/PARENT_MISS/ { parentmiss++; t_parentmiss += $2; next};

END { localcache = localhit + clientcache;
                  t_localcache = t_localhit + t_clientcache;
                  othercache = neighborhit + parenthit;
                  t_othercache = t_neighborhit + t_parenthit;
                  other = fail + deny; t_other = t_fail + t_deny;
                  all = fail + clientcache + localhit + deny + \
                  direct + neighborhit + parenthit + parentmiss;

                  printf "\tlocal cached\tremote cached\tremote proxied\tno proxy,cache\tother\n";
                  printf "Nummer:\t%6d\t\t%6d\t\t%6d\t\t%6d\t\t%6d\n",
                         localcache-2, othercache-2, parentmiss-1, direct-1, other-2;
                  printf "\t%5.1f%%\t\t%5.1f%%\t\t%5.1f%%\t\t%5.1f%%\t\t%5.1f%%\n",
                        localcache/all*100, othercache/all*100,
                        parentmiss/all*100, direct/all*100, other/all*100;
                  printf "Zeit:\t%5.1fs\t\t%5.1fs\t\t%5.1fs\t\t%5.1fs\t\t%5.1fs\n",
                        t_direct/direct/1000, t_other/other/1000;

From: Andrew Richards[SMTP:andrew]
Sent: Freitag, 30. August 1996 21:39
To: ''
Subject: Statistics for access times

Hi all,

The time has come for us to throw out our Netscape Proxy Server in
favour of Squid, the latter appearing to be more resilient to parent-cache
unavailability (Netscape just gives up rather than trying to reach the host
directly and I can't be bothered to work out how to hack it to do the job
properly). And Squid allows multiple parents and neighbours and huge
cache areas. Nice.

My question: I've been looking at the stats scripts on (Aside/tip: They didn't work quite as
described, but using " -h access.log > summary; summary" seems to work nicely). I'm very
impressed with the scripts, but there's one thing that I consider
to be "missing", namely, that there is no figure given for an overall
access-time. This is something that was really useful in Netscape,
which gave two figures - the average access time and the estimated
access time without a proxy/cache.

I think the way Netscape got these figures was to give the average
access time for all accesses, and the access time for
accesses that couldn't be served directly from the cache.

Has anybody thought about this? Solved this problem already? If
not I may be able to spend some time on it, but I'm somewhat
confused by the access.log file - I'm not sure what it all means,
so if someone could point me in the right direction there, that
would be useful - in particular, I assume the final field is the access
time in milliseconds, but what about the next-to-last field, with terms
like TCP_MISS, TCP_HIT, TCP_REFRESH - what do these mean?

If I do write something (probably in awk), be assured that y'all be
the first to know.


Andrew Richards.
Received on Mon Sep 02 1996 - 10:32:45 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:32:55 MST