Thread View: news.software.nntp
4 messages
4 total messages
Started by John Carr
Tue, 29 Oct 1996 00:00
Characterizing feed latency
Author: John Carr
Date: Tue, 29 Oct 1996 00:00
Date: Tue, 29 Oct 1996 00:00
13 lines
1028 bytes
1028 bytes
I'm looking for a method to help characterize the delay in my newsfeed. Is anything available that produces some metric that reflects the delay from posting to receipt? Something like the median of the difference between the time of receipt & the time of posting seems reasonable. Any suggestions? =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= John A. Carr TRW SIG Sunnyvale carr@svl.trw.com
Re: Characterizing feed latency
Author: T. William Wells
Date: Wed, 30 Oct 1996 00:00
Date: Wed, 30 Oct 1996 00:00
31 lines
1861 bytes
1861 bytes
In article <558bed$l1v@earth.alpha.net>, Joe Greco <jgreco@ns.sol.net> wrote:
: In article <carr-ya023180002910961850040001@news.svl.trw.com>,
: John Carr <carr@svl.trw.com> wrote:
: >I'm looking for a method to help characterize the delay in my newsfeed. Is
: >anything available that produces some metric that reflects the delay from
: >posting to receipt? Something like the median of the difference between
: >the time of receipt & the time of posting seems reasonable.
:
: You mean, like this?
:
: (spool.jgreco.pts/0-2) 1:36pm ~ 2 > newsdelay
: Minimum delay for last 300 articles: -11.791944444444444784 hours.
: Average delay for last 300 articles: 12.08244999999999969 hours.
: Maximum delay for last 300 articles: 166.58444444444444343 hours.
: Average articles per second was 2.9411764705882355031
The typical posting delay distribution looks like this:
***
* ****
* *****
* ******
_+=*_* *******+_+=_+=_+=
^this is the interesting number, as it represents the
"wavefront" of incoming posts. The average is usually quite a bit
further to the right of this point. The median isn't a bad
representation of the wavefront; the average is pretty useless.
Re: Characterizing feed latency
Author: Joe Greco
Date: Wed, 30 Oct 1996 00:00
Date: Wed, 30 Oct 1996 00:00
90 lines
3334 bytes
3334 bytes
In article <carr-ya023180002910961850040001@news.svl.trw.com>,
John Carr <carr@svl.trw.com> wrote:
>I'm looking for a method to help characterize the delay in my newsfeed. Is
>anything available that produces some metric that reflects the delay from
>posting to receipt? Something like the median of the difference between
>the time of receipt & the time of posting seems reasonable.
You mean, like this?
(spool.jgreco.pts/0-2) 1:36pm ~ 2 > newsdelay
Minimum delay for last 300 articles: -11.791944444444444784 hours.
Average delay for last 300 articles: 12.08244999999999969 hours.
Maximum delay for last 300 articles: 166.58444444444444343 hours.
Average articles per second was 2.9411764705882355031
(spool.jgreco.pts/0-2) 1:37pm ~ 3 > more `which newsdelay`
#! /bin/sh -
count=300
if [ "0$1" -gt 0 ]; then
count="$1"
fi
# This will look at the last 300 articles that arrived at this site and
# find the average delay from the time when the articles were originally
# posted to the time they arrived at this site.
. /usr/local/news/innshellvars
tail -${count} $HISTORY\
| newsdelay.pl
# | tr '~' ' '\
# | awk '{s += $2 - $4} END\
# {print "Average delay for last "NR/1" articles: "s/NR/3600" hours."}' -
#
(spool.jgreco.pts/0-2) 1:37pm ~ 4 > more `which newsdelay.pl`
#! /usr/local/bin/perl
$, = ' '; # set output field separator
$\ = "\n"; # set output record separator
$MIN = 9999999999999999;
$SUM = 0;
$MAX = 0;
$COUNT = 0;
$ARMIN = 9999999999999999;
$ARMAX = 0;
while (<>) {
tr/~/ /;
($Fld1,$Fld2,$Fld3,$Fld4) = split(' ', $_, 9999);
$DELAY = $Fld2 - $Fld4;
$SUM += $DELAY;
if ( $DELAY < $MIN ) {
$MIN = $DELAY;
}
if ( $DELAY > $MAX ) {
$MAX = $DELAY;
}
if ( $ARMIN > $Fld2 ) {
$ARMIN = $Fld2;
}
if ( $ARMAX < $Fld2 ) {
$ARMAX = $Fld2;
}
$COUNT += 1;
}
print 'Minimum delay for last ' . $COUNT / 1 . ' articles: ' . $MIN / 3600 . '
hours.';
print 'Average delay for last ' . $COUNT / 1 . ' articles: ' . $SUM / $COUNT / 3
600 . ' hours.';
print 'Maximum delay for last ' . $COUNT / 1 . ' articles: ' . $MAX / 3600 . '
hours.';
$PERIOD = $ARMAX - $ARMIN;
print 'Average articles per second was ' . $COUNT / $PERIOD;
(spool.jgreco.pts/0-2) 1:45pm ~ 5 >
My apologies to the author of the original idea. This has been through
several iterations here. I find it very useful, particularly the
"average articles per second" number, which is a server health indication.
... JG
Re: Characterizing feed latency
Author: Gordy Thompson
Date: Thu, 31 Oct 1996 00:00
Date: Thu, 31 Oct 1996 00:00
341 lines
11593 bytes
11593 bytes
In article <carr-ya023180002910961850040001@news.svl.trw.com>,
carr@svl.trw.com (John Carr) wrote:
>I'm looking for a method to help characterize the delay in my newsfeed. Is
>anything available that produces some metric that reflects the delay from
>posting to receipt? Something like the median of the difference between
>the time of receipt & the time of posting seems reasonable.
>
>Any suggestions?
This handy utility was posted a year ago. I looked for it with
Archie and AltaVista just now, but evidently nobody took the author up
on the suggestion to make it available on a public site.
Newsgroups: news.software.nntp
Subject: Script for newsfeed statistics
From: sommar@enea.se (Erland Sommarskog)
Date: 22 Oct 1995 11:24:09 +0100
I'd like to share with you a Perl script that I've put together. I
think I've posted it some time before, but there's a new function
in it now - and some more directions on how to use it in the comments
as well.
Anyway, the script reads the history file to find out how old
the news is that you get, and to find out the number of articles
by posting date. I use both this to monitor the function of our
only incoming feed (which is a lousy one). Some sample output:
0942 2413 1.68 0 0 0 2202 188 19 1 1 2
951020 #arts Avg <0 0< <1 1day 2d 3d 4d 5d 6d 7d 8d 9d
10 11 12 13
1542 16653 1.73 0 0 2 15605 776 177 51 13 11 10 3 0
2 0 0 3
1642 2070 2.07 0 0 0 1244 794 17 9 1 3 0 0 1
0 0 0 1
1742 450 2.06 0 0 0 25 422 1 0 0 2
1842 22 2.10 0 0 0 0 22
1942 11 2.19 0 0 0 0 11
2042 61 0.94 6 27 2 0 26
2142 1921 0.09 92 1775 36 12 0 3 1 2
2242 2783 0.23 102 2407 85 106 48 27 2 4 1 0 1
2342 3219 0.13 83 2986 48 78 12 8 0 0 2 0 1 0
1
Here you can see that our feed was behind for more than a day
and a half, until they apparently flushed the queues. (You can
can also see that our machine was sick and didn't run cron for a
while.)
And here is what you see in the file for article per posting date:
951016 43111
951017 56207
951018 54373
951019 2258
951020 19796
951021 43323
951022 14874
951023 24
Did the world take a holiday the 19th? I don't think so.
If anyone feels that this fits in an FTP archive somewhere, please
feel free to add it.
#!/usr/bin/perl
#
# histtime3 -this script provides statistics about your news feed.
Typically
# you run it from your crontab once an hour, although you
may choose
# another frequency if you wish. A typical crontab entry:
#
# 42 * * * * cd News/lists; ../histtime3 histtime.log
datefreq.log
#
# The first log file contains the following columns from
left to
# right: time of run, number of articles arrived since last
run,
# their average age in days, then a histogramme: no of arts
with
# negative age (time warp), no of arts days 0-0.5 days old,
no of
# arts 0.5-1.0 day old, and then 1.0-2.0 days old etc. When
the
# time has passed noon or midnight since the last run,
there is a
# header printed. This first log file is mandatory. The
script
# determines when the last run took place by looking at the
age
# of this script.
#
# The second log file continas number of articles by
posting date.
# The point with this statistics is that you can detect if
your
# feed suddenly just throw a bunch of articles away. This
log
# is optional; if you omit this argument, no such file is
written.
#
# Implementation detail: the file works by reading the
history
# file. It starts from one place near the end, and then
jumps
# around until it finds the first article arrived after the
last
# run. The script may miss a handfull of articles arriving
when
# the script runs. (Did I say it was perfect.)
#
# IMPORTANT NOTICE about HARDCODINGS!
# You most certainly want to change "enea.se" below to
something
# that matches your own site name. Excluding your own site
name
# is good, because your own articles are always 0 days old
or there-
# about. If your feed is far behind, this may be the only
articles
# in that range, fooling you to believe that you are
actually
# getting some new articles from your feed.
# Furthermore there are some numbers hardcoded below that
don't
# affect function, but that you may want to adjust your
site to
# improve performance.
# Also, if you don't have the history file in
/usr/local/news,
# you need to change that.
#
# Eventually the copyright stuff. This script was written by Erland
Sommarskog
# at ENEA Data AB in his spare time, and thus believes he holds all
copyrights
# to this script himself. Copyright and copyright, do want ever you
want with
# it, but if you sell it, don't keep the money but donate them to me
or the
# beggar you see in the streets. Specifically the GNU so-called
copyleft does
# in now way apply to these plain lines of code.
#
# If you have ideas or improvements to share with me, I can be reached
at
# sommar@enea.se.
#
# My special thanks for Larry Wall for inventing Perl.
#
# Enough talk, let's work!
# Formats time in a nice format.
sub format_time {
local($time) = @_;
local($year, $month, $day, $hour, $min, $sec);
$time = time if (! defined $time);
($sec, $min, $hour, $day, $month, $year) = localtime($time);
return sprintf("%2.2d%2.2d%2.2d %2.2d%2.2d",
$year, ++$month, $day, $hour, $min);
}
# This routine extracts the things we want from a history line.
Returns
# 0, if at end of file.
sub get_times{
local($msg_id, $times, $arrival, $expire, $posted, $line);
$line = <H>;
return (0, 0, 0) if ! $line;
($msg_id, $times) = split(" ", $line);
($arrival, $expire, $posted) = split(/\~/, $times);
($msg_id, $arrival, $posted);
}
# Get arguments and starting point.
$file = shift @ARGV;
die "Argument missing\n" unless $file;
$start_time = time - 86400 * -M $file;
$datefile = shift @ARGV if @ARGV;
# Open and read the date file given and if if we have one.
if ($datefile && -e $datefile) {
open(F, "$datefile") || die "Cannot open $datefile: $!\n";
while (<F>) {
chop;
($date, $no_of_arts) = split;
$dates{$date} = $no_of_arts;
}
close F;
}
# Open the history file
open(H, "/usr/local/news/history") || die "Could open history file:
$!\n";
# Normally $start_time is some hour ago, so we better start looking at
# from the end of the history file, but if is too long ago we start
# from the beginning. Four days is just my choice, because we expire
most
# after three days. This is mainly useful when you run the script the
# first time.
if (time - $start_time < 4 * 86400) {
# Position us somewhere near the end. -200000 is a good guess for a
little
# more than an hour of traffic at our site for the moment.
seek(H, -200000, 2);
# Iterate until we are before the starting time.
while (1) {
<H>; # Sync to a new
line
($msg_id, $arrival, $posted) = &get_times(); # Examine the
current line
last if $arrival < $start_time || ! $msg_id; # Break if we are
behind now
seek(H, -100000, 1); # Take another step
back;
}
}
else {
$arrival = 0;
$msg_id = 1;
}
# Now iterate until we're just ahead of the starting time.
while ($arrival < $start_time && $msg_id) {
($msg_id, $arrival, $posted) = &get_times();
}
# Now we can start collecting the data.
$sum = $no_of_art = $neg_travs = $half_days = $#histogramme = 0;
while ($msg_id) {
# Ignore our own articles. Note: this is hardcoded, so you need to
change
# this
next if $msg_id =~ /enea.se\>/;
# Skip cancelled or expired articles.
next if ! $posted;
# Calculate the travel time and increment.
$travel_time = ($arrival - $posted) / 86400.0;
$sum += $travel_time;
$no_of_art++;
# Put it in the right box in the histogramme
if ($travel_time < 0) {
$neg_travs++;
}
elsif ($travel_time > 0.5 && $travel_time < 1.0) {
$half_days++;
}
else {
$histogramme[int($travel_time)]++;
}
# Get the date the article was posted and increment.
($posted_date) = split(' ', &format_time($posted));
$dates{$posted_date}++;
# Pick up the next line.
} continue {
($msg_id, $arrival, $posted) = &get_times();
}
close H;
# Open the output file.
open(F, ">>$file");
$now = &format_time(time);
$then = &format_time($start_time);
# This is the widths for ages for 1 day and more.
@widths = (5, 4, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2);
# Find out if we are to write a header. We do this every the time the
# small hand has passed twelve.
($daynow, $timenow) = split(" ", $now);
($daythen, $timethen) = split(" ", $then);
if ( ($daynow != $daythen) || ($timenow > 1200 && $timethen < 1200) )
{
print F "$daynow #arts Avg <0 0< <1 1day";
foreach $i (2..$#widths) {
$width = ($i <= 9 ? $widths[$i] - 1 : $widths[$i]);
$d = ($i <= 9 ? "d" : "");
printf F " %${width}d${d}", $i;
}
print F "\n";
}
printf F " %s %5d", $timenow, $no_of_art;
if ($no_of_art > 0) {
printf F " %4.2f %3d %4d %4d",
$sum/$no_of_art, $neg_travs, $histogramme[0], $half_days;
foreach $i (1..$#histogramme) {
$width = ($widths[$i] ? $widths[$i] : 1);
printf F " %${width}d", $histogramme[$i];
}
}
else {
$server = `/var/INN/bin/ctlinnd mode`;
$server = (split(' ', $server))[1];
print F " Server mode: $server.";
}
print F "\n";
close F;
# Now write the date file
if ($datefile) {
open(F, ">$datefile.new") || die "Cannot write to $datefile.new:
$!\n";
foreach $date (sort keys %dates) {
printf F "%s %7d\n", $date, $dates{$date};
}
close F;
rename("$datefile.new", $datefile) ||
die "Cannot rename $datefile.new to $datefile: $!\n";
}
==========================================================================
Gordon T. Thompson gordy@nytimes.com
Manager, Internet Services 212 556 1386
The New York Times fax: 212 556 1636
The Times and I have an arrangement: Neither of us speaks for the other.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads