After some hours of debugging, reading source code and rereading the HOWTO
word-by-word for chooser several times, I now see that the chooser script
is called for each of the jobs in the load balancing queue.
I was thinking it would call it once and ask for a printer and then wait
10 seconds. But it is calling it once for every job in the queue (why!!?),
hogging the entire server (that of course have no time to check for free
serving queues now) and then when it is done calling it for each job it
starts over all again.
This explains why there are huge delays when there are lots of jobs in the
queue. The server is spawning chooser scripts and not doing anything else.
If you have 3 load balancing queues with 80 jobs in each, you will soon
run out of most system resources if you are spawning processes like satan
himself.
I see no solution in setting the chooser_interval higher as LPRng will
still spawn a chooser script for each job no matter what. It does not work
so spawn a chooser script when there are 40-100 jobs in the load balancing
queue.
The current solution is not very good in my opinion. Sure, you can use the
chooser script to do your own queue priority control (by making the
chooser script return FAIL for any job you want to temporary hold for this
pass and return SUCC for any job you want to let through in front of
earlier jobs in the queue). Or you could have one master load balancing
queue that spreads jobs across your entire company to the closest printer
of the user/host. But this is not what the chooser functionality is for in
my opinion, there are other ways to do that in LPRng.
I have therefore written this first patch that will stop processing the
queue (exit the queue loop) when there is no serving queues available,
then wait the chooser_interval and then retry with the first available job
for printing again. I believe this should work so I will take this into
production use as we critically need it. I will return and read lpd_jobs.c
again and again and maybe come up with something better later on. One
could also introduce a config option for this (I am sort of used to that
by now :-]) but that is also not a project for tonight.
The patch will only do this for external chooser programs/scripts and not
if using the internal (written in C) chooser function. The patch is
written in Powell-style(tm) so it will look like the rest of the code. The
patch is _really_ huge:
--- lpd_jobs.c.orig Wed Apr 16 01:37:42 2003
+++ lpd_jobs.c Tue Sep 2 20:21:49 2003
@@ -959,6 +959,7 @@
if( out_tempfd >= 0 ) close( out_tempfd ); out_tempfd
= -1;
Free_line_list( &chooser_env );
Free_line_list( &chooser_list );
+ if( chooser_did_not_find_server == 1 ) break;
}
}
The patch with config option (later) will most likely apply to both
chooser routines (compiled in and external program) as then you have the
option to activate the code in this patch.
On Tue, 2 Sep 2003, Henrik Edlund wrote:
HE> I have an external chooser program that is called for the load balancing
HE> queues. This worked great, when there were less than 10 jobs in the queue.
HE> I tested it for weeks like this.
HE>
HE> Now suddenly LPRng has started to send a list of no printers to the
HE> chooser's STDIN even though both serving queues are free. This seem to
HE> happen when there are 20 or more jobs in the load balancing queue. It
HE> continues to send an empty printer list for 2-3 minutes even though both
HE> serving queues are empty. Then finally LPRNg sends a list of the now two
HE> free printers to the script so it can choose.
HE>
HE> This effectivly halts any printing for 2-3 minutes. Anyone run into this?
HE> I tried changing chooser_interval from default 10 seconds to 2 seconds,
HE> but difference. It works great when the number of jobs in the load
HE> balancing queue are few.
HE>
HE> If I turn off the chooser script and let LPRNG round-robin it works
HE> without problems and jobs are moved to the serving queues without delay.
-----------------------------------------------------------------------------
YOU MUST BE A LIST MEMBER IN ORDER TO POST TO THE LPRNG MAILING LIST
The address you post from MUST be your subscription address
If you need help, send email to [EMAIL PROTECTED] (or lprng-requests
or lprng-digest-requests) with the word 'help' in the body. For the impatient,
to subscribe to a list with name LIST, send mail to [EMAIL PROTECTED]
with: | example:
subscribe LIST <mailaddr> | subscribe lprng-digest [EMAIL PROTECTED]
unsubscribe LIST <mailaddr> | unsubscribe lprng [EMAIL PROTECTED]
If you have major problems, send email to [EMAIL PROTECTED] with the word
LPRNGLIST in the SUBJECT line.
-----------------------------------------------------------------------------