Samba Performance

I just took the plunge and moved an application from NT to a samba server.
The following are the specifics:
Original server was NT 4.0 sp5 IBM Pent Pro 200 with AHA 2940 and 256mb ram.
My test samba server is AMD 400 with 6 gb IDE. So the ibm server is a real  server and my samba server is really just a workstation.
The application I hosted is GoldMine which is a contact manager that used .dbf files for data and a program written in "C" for the client.
I setup about 6 users. Because of how it works this program opens about 40 files when it starts. It opens all the dbf and index files on startup.

I have noticed a significant slowdown after moving the application. It seems to be most noticeable when starting the program and more noticable when more users are logged in.
The following is my smb.conf file.
Is all of this performance loss explained by less memory and IDE drive?
Are there setting I should change?
What should I do to improve performance in what order?

# Global parameters
        workgroup = SOFTDESIGNS
        netbios name = SAMBA1
        encrypt passwords = Yes
        map to guest = Bad Password
        guest account = ftp
        path = /home/public
        read only = No
        guest ok = Yes
Who is Participating?
jlevieConnect With a Mentor Commented:
Hi David,

How much memory in in the Linux system and what ether card is it using? Is the Linux system's bus running at 66 or 100Mhz?

You can probably improve the performance of Samba a bit by including:

socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

in the global section of your smb.conf file.

Oh yeah, you are also being penalized on the Linux system, at least to some degree, by the IDE drive. A high performance SCSI controller and more than one disk would help. I'd probably set it up with the OS on one disk and user/Samba data on at least one other drive. Within reason, the more the system & data gets distributed over multiple spindles the more responsive the system will be.
davidpmAuthor Commented:
Whoa!!! That socket options setting made a huge differerence. Are those magic numbers or will I do even better messing with them.
I just check an swat reports about 50 files open per logged in ws. I saw a real difference in starting the program after the socket options setting.
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

davidpmAuthor Commented:
Its a 3com nic 3bo something. I tried a new 3Com server NIC but it did not load properly so I went to this one. I tried a d-link and I saw a "something evil" messege on the console.
128 mb ram 100mhz bus. I'm mostly interested in tuning info now since we sell hardware I can build an identical box and run benchmarks NT vs. Samba etc.
I suspect the NT tuning info is a little hard to come by.
I'm expecting that since Samba is running on an OS that is not forced to run a GUI it should squeek ahead.
Those are "magic" numbers. I doubt that you'd see much if any improvement by messing with them. What I'd recommend you do is to run top and see what the memory utilization is. I suspect that you might be a bit memory starved with only 128Mb. Memory is relatively cheap for the performance gain it provides if the system has to swap.

I assume you are using a 3c905, correct? A plain old 3c905 (not a "Net management" or "Wake On LAN" version) ought to provide pretty good performance. You could probably get a bit more performance by having two EIDE 7200rpm drives (as Primary & Secondary masters). Put the OS on one & user data on the other so that you have two spindles and head stacks in use.

davidpmAuthor Commented:
Adjusted points from 50 to 100
davidpmAuthor Commented:
Here it is:
 10:39am  up 20:29,  1 user,  load average: 0.00, 0.00, 0.00
33 processes: 32 sleeping, 1 running, 0 zombie, 0 stopped
CPU states:  0.0% user,  0.5% system,  0.0% nice, 99.4% idle
Mem:   64136K av,  62584K used,   1552K free,  14460K shrd,  27192K buff
Swap: 136512K av,    968K used, 135544K free                 20532K cached

 1025 root      13   0  1012 1012   820 R       0  0.5  1.5   0:00 top
    1 root       0   0   380  368   320 S       0  0.0  0.5   0:03 init
    2 root       0   0     0    0     0 SW      0  0.0  0.0   0:00 kflushd
    3 root       0   0     0    0     0 SW      0  0.0  0.0   0:00 kupdate
    4 root       0   0     0    0     0 SW      0  0.0  0.0   0:00 kpiod
    5 root       0   0     0    0     0 SW      0  0.0  0.0   0:00 kswapd
    6 root     -20 -20     0    0     0 SW<     0  0.0  0.0   0:00 mdrecoveryd
  286 bin        0   0   308  288   228 S       0  0.0  0.4   0:00 portmap
  339 root       0   0   488  480   388 S       0  0.0  0.7   0:00 syslogd
  350 root       0   0   676  664   312 S       0  0.0  1.0   0:00 klogd
  366 daemon     0   0   312  296   232 S       0  0.0  0.4   0:00 atd
  382 root       0   0   548  540   452 S       0  0.0  0.8   0:00 crond
  402 root       0   0   444  436   368 S       0  0.0  0.6   0:00 inetd
  418 root       0   0   448  436   368 S       0  0.0  0.6   0:00 lpd
  449 root       0   0   400  384   324 S       0  0.0  0.5   0:00 gpm
  466 xfs        0   0   900  892   536 S       0  0.0  1.3   0:00 xfs
  528 root       0   0   384  384   316 S       0  0.0  0.5   0:00 mingetty
  529 root       0   0   384  384   316 S       0  0.0  0.5   0:00 mingetty  

I'm not too good at reading this yet. What do you make of it?
Yes it is a 3c905.
Are you saying that the  3c980b 3Com EtherLink Server card would actually cause problems if I could get it to work. I tried it and Kudsu did not like it.
davidpmAuthor Commented:
I just checked the docs and noticed that TCP_NODELAY is the default. Perhaps it would work just as well with just the other two settings.
davidpmAuthor Commented:
Also I was reading about starting servers from inetd vs a script. Should I be looking at that also?
davidpmAuthor Commented:
I'm trying to puzzle out the top info I posted.
It looks like 64mb memory.
It looks like memory is mostly used but swap is lightly used.

If I added memory would the swap usage go to 0 or is a meg of swap usage the minumum.
Top only shows 64Mb of memory with 1.5Mb free. I thought you said this box had 128Mb.

"Mem:   64136K av,  62584K used,   1552K free,  14460K shrd,  27192K buff"

Were the smbd & nmbd daemons running at the time? I'd presume that there probably weren't any Samba users at the time.

For serious use you want Samba running as daemons, not from inetd. The only reason to run it from inetd would be if you needed tcpwrappers for security or if it was only occasionally used on a memory-poor machine. When run as a daemon, the startup time for client connects is reduced over what one would see if it is running from inetd.

The 3c905 cards now exist in several slightly different versions. There's some information about them on and at least some of the variants will work. I've also heard good things about the Intel Pro100 boards.
davidpmAuthor Commented:
I thought is was 128 now I know it is 64 <g>.
I actually had 4 users logged in at the time. What is your best guess regarding the benifit of adding memory to improve performance.
My guess, since you only have 64 MB, would be "considerable". Just about any significant activity will cause swapping, and I think that the kernels dynamic buffers are probably smaller than they'd be with more memory available. Ideally, you like there to be enough memory so that on average the system is running out of memory with a fair bit free, perhaps 5-10Mb as a guess. Since you are playing around with configurations, why not watch the system with top as it gets loaded up. Then add 32-64Mb and see what it looks like then.
davidpmAuthor Commented:
Will Do
davidpmAuthor Commented:
If you want to comment on some of the other related questions I would appreciate it but your magic numbers did the trick, thanks.
Fire away...
davidpmAuthor Commented:
If I wanted to pop in another drive for just data what would be the process?

Could you interprete some of the important numbers in my top posting.
How do those numbers compare to other machines you work on. I have very limited experience so do not know what is good, bad, normal etc.

I assume smb is running from a script not inetd, how do I know for sure.

davidpmAuthor Commented:
Unfortunatly I may be forced to take this service off Samaba anyway because I can find no way to back up the files. The files are always open because a service is always listening for remote users that may be syncronizing.
Let's take the last one first. Which files are you talking about? The Goldmine data? If so, then there is exactly the same problem on NT if there are any clients with the app running when backups occur (I've seen Networker on NT complain about it).

This is something that an "administrative solution" could address. Simply tell everyone that backups will occur at a specific time and that they need to close all apps & log out before then. You should then be able to back up the data as nothing should have a "write lock" on the it. If you want to enforce that policy, simply stop Samba before the backup and restart it when backups are finished.

The default for Samba is to run it from /etc/rc.d/init.d/smb. You can tell for sure by looking in /etc/inetd.conf for lines that would start smbd & nmbd.

Lets consider a few of the lines that top shows. The line:
CPU states:  0.0% user,  0.5% system,  0.0% nice, 99.4% idle
should be pretty self-explanatory, if you know that "user" refers time the cpu spends executing "user level code", "system" refers to cpu time spent in "system state" (file I/O, kernel, networking, etc), and "nice" is time spent running tasks at other than normal priority (see man nice).

This line:
Mem:   64136K av,  62584K used,   1552K free,  14460K shrd,  27192K buff
says what the total memory is (av), how much is current in use or free (used/free), how much is in shared use (shrd) for dynamic libs or interprocess shared memory, and finally how much is being used for various buffers (kernel buffers, file/disk buffers, network buffers, etc). Although shown on the line with the swap data, "cached" refers to the amount of memory used for filesystem cache's (see man free for more info).

Speaking of memory, some MB's don't report the installed memory in a way that Linux can directly use and you may see 16, 32, 64, 128Mb when you've got more than one of those amounts installed. It's easy to fix. When booting the system, type "linux mem=nnn" (nnn=installed memory) and see if all is recognized. Assuming it is, add 'append="mem=nnn"' to the global section of /etc/lilo.conf (and run lilo to install).

There's not much that can be inferred from an idle system (except that in this case it's memory starved and total & used are almost equal). Looking at top output as the system loads up will give you some ideas as to what resources are being consumed. It won't necessarily tell you where a bottleneck is (for example, very high disk I/O won't directly show, but the "system" percentage of cpu will be high relative to the others).

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.