Samba - CPU and memory usage - Proposed solution(?)

Nikos Balkanas nbalk at
Sun Jan 23 02:40:00 GMT 2005

Hi Andrew,

Thanks for the fast reply. I don't know why, your reply reached me as an
attachment. A couple of questions:

On Sat, 2005-01-22 at 08:53 +0200, Andrew Bartlett wrote:
> On Sat, 2005-01-22 at 07:53 +0200, Nikos Balkanas wrote:
>> Hello,
>> Solution developed against samba 2.2.22. Didn't and do not have the
>> opportunity to test samba 3.0.0.
>> No browsing or wildmasks of files needed, only
>> exact file request through the database.
>> Putting samba through the debugger, I noticed that on every file request,
>> would scan all the files in the large directory, while converting to Unix
>> filenames and building up the filename cash until it reaches 150 MB. I
>> developed a configurable parameter "many files", which when set, disables
>> file browsing (who needs listing of ~1,000,000 files?) and performs a
>> to get the file.

> Yes, this is a well-known problem with Samba's case insensitive filename
> handling, on case-sensitive Unix systems.

> If, as occurs in your case, the name is known exactly, such that a stat
> () will determine the result, then you may set 'case sensitive = yes',
> and Samba will do exactly that. This is best in 3.0.11pre2, (ie, the
> current code, I'm not sure how far back the changes were applied) where
> jra applied some patches to ensure that the directory listing was not
> performed.

Do you mean to say that an exact "stat" is performed in this case? Wouldn't
it be more efficient from the beginning to do 2 "stats" - 1 for upper case,
the other for lower case? Even in the case where the exact name is known
from the database, there is no guarantee that windows filesystem will
request the same case from Unix. Can one do wildcard matching in this case?

> So, you may wish to advise your former employer that an 'out of the box'
> solution should now be available.

Can one also disable browsing and wildcard matching per directory? If this
is not done, security is compromised. Furthermore, only half the performance
boost is realized, since any time a CRM agent will try to save a bill to his
own PC, Windows opens as default saving directory the source directory,
killing the server in the process (and the PC).

The changes I have done result to a somehow "illegal" filesystem. If you do
a "dir" or open a window on it, they both come up empty and return
immediately. If, however, you do a "dir filename.txt" and the file exists,
it will be displayed - only that file. Siebel has a very machinelike naming
of the files, so little chance an average CRM user can guess it - unless has
access to the database. This is not much, but guards against accidental
deletion and is as much security as can be given from the filesystem -
anything more must be given through the application.

> Finally, I'm pleased to see Samba used being used in such big
> applications. It's a joy to hear about these kind of installations.

Always a pleasure - as long as they are knowledge people to take the risk
and support it in case of problems ;-)
Remember, all big top systems, utilize the database and the filesystem in a
similar way. Until Windows realize that there is a professional need to
decouple browsing from access, samba will be a superior choice.
> Andrew Bartlett


Andrew Bartlett

Authentication Developer, Samba Team

Student Network Administrator, Hawker College

More information about the samba-technical mailing list