Slow writes to big directories

Malcolm Heath malcolm at glassworks.co.uk
Fri Feb 16 17:55:51 GMT 2001


Here's a problem I'm seeing when using an NT client to write to a Samba
server.  I have no problems using an Irix client to access the same server,
or the same NT client to an NT server.

We often work with directories containing a lot of, sometimes several
thousand, small files.  As the number of files in the directory increases,
so the performance of the server worsens.  Here are some figures:

500 files (total 400KB): 7 seconds = 57KB/s
1000 files (total 800KB):24 seconds = 33KB/s
6000 files (total 4800KB):683 seconds = 7KB/s

As you can see, the actual amount of data being transfered is trivial - it
seems that Samba is spending all its time dealing with directory
information.  This is only a problem when writing to the server - read times
increase more or less in proportion to the amount of data being transferred.

Does anybody have any suggestions?

I have already tried a few things which have been mentioned in earlier
mails:  adding  IPTOS_LOWDELAY to socket options; 
turning off stat cache; turning off raw writes; turning off getwd cache -
all to no avail.

I am running Samba 2.0.7 on Linux 2.2.16.

Here's my Samba configuration:


# Global parameters
[global]
	interfaces = 
	bind interfaces only = No
	security = DOMAIN
	encrypt passwords = Yes
	update encrypted = No
	allow trusted domains = Yes
	hosts equiv = 
	min password length = 5
	map to guest = Never
	null passwords = No
	password server = sohdmc03
	smb passwd file = /etc/samba/smbpasswd
	root directory = /
	passwd program = /bin/passwd
	passwd chat = *new*password* %n\n *new*password* %n\n *changed*
	passwd chat debug = No
	username map = 
	password level = 0
	username level = 0
	unix password sync = No
	restrict anonymous = No
	use rhosts = No
	ssl = No
	ssl hosts = 
	ssl hosts resign = 
	ssl CA certDir = 
	ssl CA certFile = 
	ssl server cert = 
	ssl server key = 
	ssl client cert = 
	ssl client key = 
	ssl require clientcert = No
	ssl require servercert = No
	ssl ciphers = 
	ssl version = ssl2or3
	ssl compatibility = No
	debug level = 1
	syslog = 1
	syslog only = No
	log file = /var/log/samba/%m.log
	max log size = 0
	debug timestamp = Yes
	debug hires timestamp = No
	debug pid = No
	debug uid = No
	protocol = NT1
	read bmpx = No
	read raw = Yes
	write raw = Yes
	nt smb support = Yes
	nt pipe support = Yes
	nt acl support = Yes
	announce version = 4.2
	announce as = NT
	max mux = 50
	max xmit = 65535
	name resolve order = wins lmhosts host bcast
	max ttl = 259200
	max wins ttl = 518400
	min wins ttl = 21600
	time server = No
	change notify timeout = 60
	deadtime = 0
	getwd cache = Yes
	keepalive = 300
	lpq cache time = 10
	max disk size = 0
	max open files = 10000
	read prediction = No
	read size = 16384
	shared mem size = 1048576
	socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
IPTOS_LOWDELAY
	stat cache size = 50
	load printers = Yes
	printcap name = /etc/printcap
	printer driver file = /etc/samba/printers.def
	strip dot = No
	character set = 
	mangled stack = 50
	stat cache = Yes
	domain groups = 
	domain admin group = 
	domain guest group = 
	domain admin users = 
	domain guest users = 
	machine password timeout = 604800
	add user script = 
	delete user script = 
	logon script = 
	logon path = \\%N\%U\profile
	logon drive = 
	logon home = \\%N\%U
	domain logons = No
	os level = 20
	lm announce = Auto
	lm interval = 60
	preferred master = No
	local master = No
	domain master = No
	browse list = Yes
	dns proxy = No
	wins proxy = No
	wins server = 195.172.40.95
	wins support = No
	wins hook = 
	kernel oplocks = Yes
	ole locking compatibility = Yes
	oplock break wait time = 10
	smbrun = /usr/bin/smbrun
	config file = 
	auto services = 
	lock directory = /var/lock/samba
	default service = 
	message command = 
	dfree command = 
	valid chars = 
	remote announce = 
	remote browse sync = 
	socket address = 0.0.0.0
	homedir map = auto.home
	time offset = 0
	unix realname = No
	NIS homedir = No
	source environment = 
	panic action = 
	comment = 
	path = 
	revalidate = No
	username = 
	guest account = nobody
	invalid users = 
	valid users = 
	admin users = 
	read list = 
	write list = 
	force user = 
	force group = 
	writeable = No
	create mask = 0777
	force create mode = 00
	security mask = -1
	force security mode = -1
	directory mask = 0777
	force directory mode = 00
	directory security mask = -1
	force directory security mode = -1
	inherit permissions = No
	guest only = No
	guest ok = No
	only user = No
	hosts allow = 
	hosts deny = 
	status = Yes
	max connections = 0
	min print space = 0
	strict sync = No
	sync always = No
	write cache size = 0
	printable = No
	postscript = No
	printing = lprng
	print command = lpr -r -P%p %s
	lpq command = lpq -P%p
	lprm command = lprm -P%p %j
	lppause command = 
	lpresume command = 
	queuepause command = 
	queueresume command = 
	printer = 
	printer driver = NULL
	printer driver location = 
	default case = lower
	case sensitive = No
	preserve case = Yes
	short preserve case = Yes
	mangle case = No
	mangling char = ~
	hide dot files = Yes
	delete veto files = No
	veto files = 
	hide files = 
	veto oplock files = 
	map system = No
	map hidden = No
	map archive = Yes
	mangled names = Yes
	mangled map = 
	browseable = Yes
	blocking locks = Yes
	fake oplocks = No
	locking = Yes
	oplocks = Yes
	level2 oplocks = No
	oplock contention limit = 2
	strict locking = No
	share modes = Yes
	copy = 
	include = 
	preexec = 
	preexec close = No
	postexec = 
	root preexec = 
	root preexec close = No
	root postexec = 
	available = Yes
	volume = 
	fstype = NTFS
	set directory = No
	wide links = Yes
	follow symlinks = Yes
	dont descend = 
	magic script = 
	magic output = 
	delete readonly = No
	dos filetimes = No
	dos filetime resolution = No
	fake directory create times = No

[homes]
	comment = Home Directories
	writeable = Yes
	browseable = No

[printers]
	comment = All Printers
	path = /var/spool/samba
	printable = Yes
	browseable = No

[usr]
	comment = usr share
	path = /usr
	writeable = Yes

[array1]
	comment = Large array 1
	path = /array1
	writeable = Yes
	guest ok = Yes

[array2]
	comment = Large array 2
	path = /array2
	writeable = Yes
	guest ok = Yes


Thanks for your help!

Malcolm Heath
Glassworks Ltd





More information about the samba mailing list