scalability of print_queue_update

Martin Pool mbp at samba.org
Tue Mar 11 01:18:55 GMT 2003


On 10 Mar 2003, jra at dp.samba.org wrote:

> > One approach that was discussed a while ago is to have the lpd notify
> > samba when jobs are completed, deleted, or changed.  It could either
> > give all the details sufficient to update the record, or (much
> > simpler) just send an smbcontrol message to rescan the queue.
> 
> That's hard. Modifying all lpd's out there will not be easy.

For HP it is an option.  

It's OK to have a mode that only supports some lpds.  Perhaps tridge's
VFS rewrite might allow a separate VFS backend for printers -- one
generic one that polls lpq, and a smarter one for smarter spoolers.

> Ok, what will this patch do ? This is a very irritating comment :-) "I have
> a simple proof for this that unfortunately won't fit in this
> margin..." :-).

Sorry, I really did mean to send a patch :-) but I got distracted by
other CRs. :-)

I observed that it spends a large fraction of its time in
print_parse_jobid, called from traverse_fn_delete, called from
print_queue_update.  This function is I think called O(n**2) times,
because smbd compares every job in the tdb against every job in the
print queue.  Parsing the string is not terribly expensive, but doing
it so many times is.

It would be better to parse the jobids just once, when the lpq output
is read, and store them in the print_queue_struct.  I was just trying
to work out the right time to put them in there.

> Please explain :-).

For Aussies: "<hanson>ploise exploin</hanson>" :-)

-- 
Martin 


More information about the samba-technical mailing list