2.9BSD uucico s l o w n e s s

Jerry Aguirre jerry at oliveb.UUCP
Tue Oct 2 07:14:17 AEST 1984


I ran into the same problem of uucico slowness when I installed Unix
2.9BSD.  In comparing the sources to the version we were running before
I came to the  conclusion that the problem was the sleep(1) call in 
the file pk1.c.
	for (nchars = 0; nchars < n; nchars += ret) {
		if (nchars > 0)
			sleep(1);
		ret = read(fn, b, n - nchars);
		if (ret == 0) {
			alarm(0);
			return(-1);
		}
		PKASSERT(ret > 0, "PKCGET READ", "", ret);
		b += ret;
	}
Apparently this call was added to improve efficiency.  The idea is that
if it takes more than one read to receive a packet then you are wasting
time and should sleep to allow some other process to run.  Meanwhile
the line will buffer up characters so you can read a whole packet in
one read instead of a single character.

This sounds good until you analyze what is really happening!  The
condition of receiving only a few(1) characters only happens when your
system is lightly loaded so you are trying to improve response time
when it is good and not doing a damn thing when it is bad.  The upshot
of this is that during peak load your uucp will run at full speed and
during the wee small hours of the night it will limp along.  Also the
faster the line speed, the slower the data transfers.

This sleep is probably ok at 300 baud (Yech! primitive) where it would
indeed cut down on the overhead.  I noticed little degradation on my
system at 1200 baud.  But on our internal 9600 baud links the result
was terrible!  Monitoring the line showed:

    blink(packet sent) [delay 1 second] blink(ack sent) [delay 1
    second]

The result is a packet sent once every 2 seconds.

There is a modification to this code that checks the line speed in
order to determine whether to do a sleep.  The test is whether the
speed is less that 4800 buad so I doubt it will do anything for you.
The better fix is to "nap" for a period less than a second.  This
requires the "nap" system call which is nonstandard.  Another
alternative is to compile the pk(2) routines into the kernel.

I would suggest that you just comment out the sleep or use your 2.8
uucp source.  In comparing our version to the 2.9 I decided that our
"old" source was more up to date.



More information about the Comp.bugs.2bsd mailing list