Samba has a number of parameters which allow for tuning your SMB network. They may work to cross-purposes and local requirements may differ so you will have to experiment.
Keep also in mind that Samba spawns a new smbd process for every client connection, which does take some memory (you may count usually about 800K for the first client plus some memory used for caching). How big the increments are may depend on how shared libraries are used, if at all. Also important is how good your OS is at overlapping the text part of different processes, etc. One of the possible optimizations may consist of adding more memory to a server or splitting the server's job between more machines. Normally, after about 25 active clients, this is advisable, unless your server has a lot of CPU and memory horsepower. Bear in mind, however, that if you have 50 possible clients, probably only a few of them may be logged into the server at any given time.
The rate with which clients gobble server memory, and the level where
it is going to stop, depends to a great degree on how many open, and
how big, directories are cached in memory. Some clients do not close
directories when they are done and memory usage grows and grows. You
may change the MAXDIR
constant in local.h
to keep
Samba from caching too much. An absolute minimum for a correct
operation is 2 but with low values complex operations on deep
directory trees may fail. 64 is the default as of the 1.9.15p5
patchlevel of Samba. Andrew Tridgell wrote: "Note that samba does
try to allow up to 256 open directories even if MAXDIR is much
smaller. It does this by assuming the directory doesn't change on disk
and 'idling' then by noting only the path name in memory and reopening
it when needed. This will fail if the client is deleting files in a
directory that it has open from a previous search, then continuing the
search in that directory. In this case the client can get confused.
To combat this samba always idles the directory that is least recently
used." Also MAX_CONNECTIONS
and MAX_OPEN_FILES
have some memory impact, even when entries are not in use. These
limits are per client and not server wide.
Check the smb.conf
manual page for details, but here are some
parameters (some of them are tune-up parameters in a rather broad
sense) that you may want to read about:
Available socket options, their behaviour and interpretations may depend on the underlying sockets implementation. Consult your library documentation for details.
Previous Chapter
Table of contents of this chapter, General table of contents
Top of the document, Beginning of this Chapter