rick@seismo.UUCP (Rick Adams) (03/30/84)
The following shell file/awk script will calculate propagation delays
and news feed distribution for your site. It takes approx. 15 CPU
minutes on a Vax 11/780 and produces output like this:
Propagation Delay
No. of Cumulative
Days Articles Percent
<0 190 0% (Time Warp)
1 3231 79%
2 665 89%
3 218 93%
4 96 96%
5 28 96%
6 20 97%
7 31 97%
8 28 98%
9 19 98%
10 22 99%
11 10 99%
12 8 99%
13 5 99%
14 10 100%
Distribution of news feeds
Count Percent Site
3509 76% harpo
620 13% hao
130 2% ut-sally
102 2% rlgvax
77 1% rochester
71 1% brl-vgr
53 1% seismo
19 0% uwvax
(Yes there really were 190 "Time Warp" articles in the last 2 weeks)
Rick Adams
{ihnp4|cbosgd|allegra|cmcl2|lbl-csam}!seismo!rick
rick@seismo.ARPA
---------------------------------delay----------------------------
startdir=/usr/spool/news/net
history=/usr/lib/news/history
rm=rm
sed -e "
1i\\
cd $startdir
s/.* //
s/ .*//
/net\./!d
s/net\.//
s!\.!/!g
s!^!sed '/^\$/,\$d' !
" $history | sh |
awk '
BEGIN{
month["Jan"] = 1
month["Feb"] = 2
month["Mar"] = 3
month["Apr"] = 4
month["May"] = 5
month["Jun"] = 6
month["Jul"] = 7
month["Aug"] = 8
month["Sep"] = 9
month["Oct"] = 10
month["Nov"] = 11
month["Dec"] = 12
days[1] = 0
days[2] = 31
days[3] = 59
days[4] = 90
days[5] = 120
days[6] = 151
days[7] = 181
days[8] = 212
days[9] = 243
days[10] = 273
days[11] = 304
days[12] = 334
}
/^Date: /{
if (NF != 7 ){
if (NF == 5 && split($3,x,"-") == 3) {
$6 = $4
$5 = x[3]
$4 = x[2]
$3 = x[1]
}else{
print "Bad date",messageid, $0
continue
}
}
sent = $3 + days[month[$4]] + ($5-80)*365
if ($5%4 == 0 && month[$4] > 2)
sent++
split($6,x,":")
sent *= 60*24
sent += x[1] * 60 + x[2]
}
/^Date-Received: /{
if (NF != 7 ){
if (NF == 5 && split($3,x,"-") == 3) {
$6 = $4
$5 = x[3]
$4 = x[2]
$3 = x[1]
} else {
print "Bad date", messageid, $0
continue
}
}
rec = $5*10000 + month[$4]* 100 + $3
if (rec > today)
today = rec
rec = $3 + days[month[$4]] + ($5-80)*365
if ($5%4 == 0 && month[$4] > 2)
rec++
split($6,x,":")
rec *= 60*24
rec += x[1] * 60 + x[2] + 1.44
}
/^Message-ID: /{messageid = $2}
/^Path: /{
n = split($2,x,"!")
if( n > 2)
feed = x[2]
else
feed = x[1]
}
/^Relay-Version: /{
n = int((rec - sent)/(60*24)+0.999)
if( rec > 0 ) {
if ( n >= 0) {
adelay[n]++
if( n > amaxdelay)
amaxdelay = n
} else {
adelay[-1]++
print "Time Warp", messageid
}
totdelay++
feedsite[feed]++
}
rec = sent = 0
}
END {
n = int((rec - sent)/(60*24)+0.999)
if( rec > 0 ) {
if ( n >= 0) {
adelay[n]++
if( n > amaxdelay)
amaxdelay = n
} else {
adelay[-1]++
print "Time Warp", messageid
}
totdelay++
feedsite[feed]++
}
i = 0
count = 0
printf("\n\tPropagation Delay\n")
printf("\n\t No. of Cumulative\n")
printf("\tDays Articles Percent\n")
if (adelay[-1] > 0) {
printf("\t <0%8d%7d%% (Time Warp)\n",adelay[-1],0)
count += adelay[-1]
}
while (i <= amaxdelay) {
count += adelay[i]
if( adelay[i] != 0 )
printf("\t%3d%8d%7d%%\n",i,adelay[i],(count*100)/totdelay)
i++
}
n = 0
for (i in feedsite)
ptr[++n] = i
j = 1
while (j < n){
if (feedsite[ptr[j]] < feedsite[ptr[j+1]]){
temp = ptr[j]
ptr[j] = ptr[j+1]
ptr[j+1] = temp
if( j > 1) {
j--
continue
}
}
j++
}
printf("\n\tDistribution of news feeds\n")
printf("\t Count Percent Site\n")
j = 0
while (++j <= n){
i =feedsite[ptr[j]]
printf("\t%8d%7d%% %s\n",i,(i*100)/totdelay,ptr[j]);
}
}'mark@cbosgd.UUCP (Mark Horton) (03/30/84)
Rick - thanks much for posting this. I would appreciate it if all netnews administrators of backbone hosts would install this and keep an eye on it. Backbone sites are supposed to be very fast, reliable, and evenly loaded. If some backbone sites are getting over half of their news with a delay of over 24 hours, or if almost all of your news comes from one direction, I'd like to hear about it. We want the backbone to rum smoothly. Mark Horton