printing in 2.2.0
damian at cisco.com
Sat May 12 03:34:00 GMT 2001
> I have some printing problems with 2.2.0.
> Samba was installed on a Solaris 2.8 server and a SuSE Linux 7.1
> server. In both cases I got nearly the same effects: selecting a printer
> is realy slow and cpu usage is high for smbd.
> 250 printers are connected to the solaris 2.8 server. if you open about 4
> or 5 printer in one minute cpu goes up to 100%.
I believe I know what the problem is, but the fix is going to be very
The problem appears to be that the algorithms used to get the data out
of the TDB files are not very efficient. This becomes significant when
dealing with more than a few dozen printers. There main problem is
that in several places
Samba needs to do a partial match of keys. Since tdb is based on a
hash algorithm, there is now way to select a partial key match (e.g.
all keys beginning with xyz). So Samba has to resort to trolling
through the entire file selecting the keys it needs.
There are two main places this happens:-
1) When looking up printer, driver and forms info it has to troll
through the entire ntdrivers.tdb file
2) When looking for queue information (i.e. what jobs are in each
queue) it has to troll through all the jobs in printing.tdb looking
for jobs for that particular printer.
To make matters worse as it reads each key it locks and unlocks the
record, on most OS's this is quite expensive.
For the job queue info, you can reduce the load considerably if you
are prepared to live without job queue info. Just change your lpq
command entry in smb.conf to something like:-
lpq command = echo 'no entries'
and delete printing.tdb
This will keep this file empty and thus the search will be quick.
My solution to problem 1) is to backend Samba with a different
directory service (that allows partial matches), however this is not a
solution for most people.
Long term, I think Samba needs to either store it's data in a tree db,
such that it can do partial key matches, or we need to split out
printing.tdb into one tdb file per printer and split ntdrivers.tdb
into printer info, driver info and forms info.
Considering Samba is heavily reliant on TDB, I think the second option
is going to be the most workable.
As soon as I get some time, I am hoping to work on this.
CEPS Team Lead
Desk: +61 2 8446 6344
Mob: +61 418 217 582
More information about the samba-technical