Fwd: Help Needed: Samba share slow to query not existing files

Andrew Walker awalker at ixsystems.com
Wed Jan 20 18:34:39 UTC 2021


On Wed, Jan 20, 2021 at 1:21 PM Jeremy Allison via samba-technical <
samba-technical at lists.samba.org> wrote:

> On Wed, Jan 20, 2021 at 02:37:45PM -0300, Jônatas Hudler via
> samba-technical wrote:
> >Hello everyone,
> >
> >*(First mail in this mailing list, so take it easy if I'm infringing any
> >good manners here)*
> >
> >In a samba share we have a directory with lots of files - binaries and
> >resources to run our ERP application (around 20K entries).
> >
> >The application is taking too long to load. The found reason is that the
> >application tries to load several files in a trial/error fashion, looking
> >for extensions in a particular order (e.g: file.dll, file.lbr, file.gnt,
> >file.int). Many of these files are not required and doesn't even exist.
> >
> >Every "not found" hit take ~0.2 seconds. And there are lots of these
> events.
> >
> >The thing is that apparently samba is not caching this result. My guess is
> >that every new not existing file open request causes a full directory's
> >entries lookup.
> >
> >If I run this code (in a Windows Command Prompt) in this samba share, it
> >takes considerable time, whereas in a native Windows share it is
> >instantaneous.
> >
> >  for /L %i in (1,1,50) do @dir \\server\share\not_existing.txt >nul
> >
> >Anything that can be done?
>
> You are running into the classic "large directory performance"
> issue, caused by Samba having to run on top of a POSIX case-sensitive
> filesystem.
>
> Here's the brute force fix:
>
>
> https://wiki.samba.org/index.php/Performance_Tuning#Directories_with_a_Large_Number_of_Files
>
> NOTE!!! from the text:
>
> "All files on the share must be converted to lowercase when using the
> example.
> Files using uppercase or both uppercase and lowercase are no longer listed
> on the share."
>
> Or switch to a filesystem the supports case insensitive
> lookups (I think xfs or zfs can do this).'
>

One quick note about the zfs side of this. "casesensitivity" is an
immutable dataset property, and so it _must_ be set when the zfs dataset is
first created.


More information about the samba-technical mailing list