I'm running Samba 4.0.7 on CentOS 6.4 running double duty as DC and file server. OS X clients are taking a _long_ time to list long directories. One directory with 10K entries is taking 3-4 minutes to display the entries in Finder. I captured a few seconds worth of packets and noticed that it's doing three requests per file: 1. NTCreateAndX - just opens the file 2. Close 3. FIND_FIRST2 - to look for the resource fork The first two happen extremely fast, the 3rd one is the kicker. Samba is taking about 0.025 seconds to return a response to the client (usually no such file status). Multiple that by 10K requests and you have a few minutes on your hands. I'm guessing the problem is that Samba must honor case-insensitivity for the lookup which is likely an expensive operation. Is there anyway to speed this up?
On Tue, Jul 30, 2013 at 12:56:18PM -0400, Ryan Bair wrote:> I'm running Samba 4.0.7 on CentOS 6.4 running double duty as DC and file > server. > > OS X clients are taking a _long_ time to list long directories. One > directory with 10K entries is taking 3-4 minutes to display the entries in > Finder. > > I captured a few seconds worth of packets and noticed that it's doing three > requests per file: > 1. NTCreateAndX - just opens the file > 2. Close > 3. FIND_FIRST2 - to look for the resource fork > > The first two happen extremely fast, the 3rd one is the kicker. Samba is > taking about 0.025 seconds to return a response to the client (usually no > such file status). Multiple that by 10K requests and you have a few minutes > on your hands.Can you do an strace -ttT -o smbd.strace -p <smbd-pid> of the smbd serving the client while it's doing that? You can find out the smbd pid with the smbstatus command. Please upload the smbd.strace somewhere for inspection. Thanks, Volker Lendecke -- SerNet GmbH, Bahnhofsallee 1b, 37081 G?ttingen phone: +49-551-370000-0, fax: +49-551-370000-9 AG G?ttingen, HRB 2816, GF: Dr. Johannes Loxen http://www.sernet.de, mailto:kontakt at sernet.de
On Tue, Jul 30, 2013 at 12:56:18PM -0400, Ryan Bair wrote:> I'm running Samba 4.0.7 on CentOS 6.4 running double duty as DC and file > server. > > OS X clients are taking a _long_ time to list long directories. One > directory with 10K entries is taking 3-4 minutes to display the entries in > Finder. > > I captured a few seconds worth of packets and noticed that it's doing three > requests per file: > 1. NTCreateAndX - just opens the file > 2. Close > 3. FIND_FIRST2 - to look for the resource fork > > The first two happen extremely fast, the 3rd one is the kicker. Samba is > taking about 0.025 seconds to return a response to the client (usually no > such file status). Multiple that by 10K requests and you have a few minutes > on your hands. > > I'm guessing the problem is that Samba must honor case-insensitivity for > the lookup which is likely an expensive operation. Is there anyway to speed > this up?Only by giving me a case-insensitive file system on CentOS 6.4 :-). Otherwise, look at this: http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/largefile.html The hard part is this: "First, you need to canonicalize all the files in the directory to have one case, upper or lower, take your pick" Jeremy.
On Tue, 2013-07-30 at 12:56 -0400, Ryan Bair wrote:> I'm running Samba 4.0.7 on CentOS 6.4 running double duty as DC and file > server. > > OS X clients are taking a _long_ time to list long directories. One > directory with 10K entries is taking 3-4 minutes to display the entries in > Finder. > > I captured a few seconds worth of packets and noticed that it's doing three > requests per file: > 1. NTCreateAndX - just opens the file > 2. Close > 3. FIND_FIRST2 - to look for the resource fork > > The first two happen extremely fast, the 3rd one is the kicker. Samba is > taking about 0.025 seconds to return a response to the client (usually no > such file status). Multiple that by 10K requests and you have a few minutes > on your hands. > > I'm guessing the problem is that Samba must honor case-insensitivity for > the lookup which is likely an expensive operation. Is there anyway to speed > this up?Do you use resource forks on your share at all? If not, if the client can use streams for the xattrs (I think it can) then using xattrs to back these not-actually-used resource forks may well be much faster, as this is based on the file handle. Try: vfs objects = streams_xattr (if you use resource forks, then they may not fit, in which case perhaps try vfs objects = streams_depot, which uses a magic directory, but is less tidy and less efficient). Andrew Bartlett -- Andrew Bartlett http://samba.org/~abartlet/ Authentication Developer, Samba Team http://samba.org Samba Developer, Catalyst IT http://catalyst.net.nz