# Slow Samba, speedy FTP [partially resolved]

## cederberg

I've been using Samba for filesharing from my Gentoo box for some months (after finally getting it to work  :Smile: )  Now, today when I launched WinAmp on an old Win98 laptop to play some ogg files directly from the Gentoo box, I got an unpleasant surprise... It basically doesn't work due to performance problems on the Win98 side.  :Sad: 

The music stops after some seconds, and then resumes, and stops, and so on ad infinitum. The performance monitor shows 100% cpu usage on the windows side, but almost none on the Gentoo side.

After searching a lot for this everywhere (without finding anything but basic network problems) I compared the performance with FTP and Samba. And it turns out that while I get 8-9 Mbps read transfer with FTP, I only get about 200 kbps when using Samba...

So, is this just me or have anyone else seen this? And are there some solution to this (apart from refomatting and installing Gentoo everywhere of course)? I guess this is a Win98 problem, but I thought I might as well ask here, as you are all so very helpful...  :Smile: 

EDIT: Changed subject as a partial resolution has been found.Last edited by cederberg on Mon Apr 21, 2003 8:31 pm; edited 1 time in total

----------

## Forse

try optimizing SAMBA

----------

## Jesu

I had a similar thing - I was trying to stream my mp3 collection over my new 802.11b connection from my other gentoo box. With smbmount, it would play about a minute, drop out, play a bit more, drop out, etc. So, I just switched to NFS, and it's beautiful now  :Smile: 

Jesu

----------

## cederberg

 *Forse wrote:*   

> try optimizing SAMBA

 

Well, I had a look into that yesterday. But from the results presented in various Samba docs, the speedup from that seemed to be around 50% or thereabouts. I really need a factor x10 to make it worth the effort...  :Sad: 

I didn't see any mentioning of Win98 anywhere, although my experience says that I'm not the only one experiencing this. Also, the CPU hitting the roof on the Win98 machine seems to be the problem, and I'm not so sure that can be fixed by just optimizing Samba. There has to be a "right way" (some magic switch or something)...

 *Jesu wrote:*   

> I had a similar thing - I was trying to stream my mp3 collection over my new 802.11b connection from my other gentoo box. With smbmount, it would play about a minute, drop out, play a bit more, drop out, etc. So, I just switched to NFS, and it's beautiful now 

 

Now, if only there were NFS for Windows 98... (dreaming on...)

Anyway, to both of you, thanks for the ideas!

----------

## mglauche

did you use the TCP_NODELAY flag in samba ? that one can make a *huge* difference sometimes ...

----------

## cederberg

 *mglauche wrote:*   

> did you use the TCP_NODELAY flag in samba ? that one can make a *huge* difference sometimes ...

 

Thanks for the idea! Unfortunately (or fortunately, depending on the viewpoint) somebody else must already have thought about that... My smb.conf is basically a copy of the default smb.conf.example:

```
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
```

So, it appears I had that set already (unknowingly)...

----------

## Snackiz

This sounds like the same problem (and the cure for it)

http://hr.uoregon.edu/davidrl/samba/samba-unofficial-single.html#example-ts

----------

## cederberg

 *Snackiz wrote:*   

> This sounds like the same problem (and the cure for it)
> 
> http://hr.uoregon.edu/davidrl/samba/samba-unofficial-single.html#example-ts

 

Very interesting! I agree that it sounds very similar, although I have performance issues with all files transferred via Samba, small as well as big. I couldn't find the setting mentioned as the cure, however. It looks like Win98 provides far fewer parameters in the GUI, but I couldn't find anything suitable in the registry either... :-(

I guess that I will have to check what is happening with tcpdump when I get the time...

----------

## dol-sen

I haven't done much with samba, but I have done ftp transfers between two computers in my lan.

My server P200MMX running linux, proftpd.   The client; my daughters 1Ghz Athalon tranfering an cd iso.   Win98 was nearly twice the the time that mandrake & gftp took.    If I remember correctly a samba transfer between the  same two machines was really slo o o o o o w.

I think you are right that the problem is win98.

Brian

----------

## Xiderpunk

Copied from another source...

> I just spent so much time troubleshooting why

 > *some types* of samba transfers were slow that I thought

 > I would share how I resolved the problem.

 >

 > This problem had been going on for ever. As far as I could

 > tell, it was only happening with winamp (MP3 player). All

 > my MP3s reside on my Linux box and I was trying to access

 > them from my PC running Windows 2000. What was throwing me

 > for a loop was that Windows Media player seemed to be more

 > successful at playing them ! What would happen is that Winamp

 > would freeze and nothing would happen. I had then decided to

 > just copy my MP3s back to my PC.

 >

 > Then, last night I started using FrontPage for some reason or

 > another; and when I tried to publish my web site to my Linux

 > box, then behavior I had observed with my MP3s started

 > plaguing FrontPage as well.

 >

 > I went through all the troubleshooting guides, learned about

 > every samba configuration options: I was able to successfully

 > transfer a 100M file in either direction (linux->pc or

 > pc->linux) using the File Explorer without any problem.

 > But I just couldn't for the life of me understand why

 > winamp and FrontPage were having problems.

 >

 > Then I decided to use ethereal and try and understand what

 > was actually happening on the wire. I realized that when

 > winamp or FrontPage were trying to transfer files, Linux

 > was ending up retransmitting the same frame over and over

 > without ever receiving a TCP acknowledgment for it. Then the

 > PC would eventually tear down the session and re-establish the

 > session and restart the transfer. An article that I read

 > http://www.dd.iij4u.or.jp/~okuyamak/Documents/tuning.english.html

 > talking about how Windows could mysteriously drop packets,

 > and I started thinking that maybe packets were being lost

 > due to some hardware problem.

 >

 > So I looked at my PC network card configuration (Linksys LNE

 > 100TX Fast Ethernet) and saw that the "Connection Type" was

 > set to auto-detect. (My PC is connected to my Linux box through

 > a Linksys 8-port Workgroup Switch - Ehterfast 10/100) So I

 > thought, maybe having to ends that "auto-detect" each

 > others speed is not good. So I changed my "Connection Type"

 > to 100 TX Full Duplex and VOILA! All my problems solved, winamp

 > is happily playing away and FrontPage can publish my whole web

 > site in seconds.

HTH

----------

## cederberg

Thanks Xiderpunk for the information. It appears that the text you found is the same as the one Snackiz posted a link to earlier, though...  :Sad: 

Meanwhile I've finally gotten around to do some tests with tcpdump. Not that I found anything that looks like it can explain the whole issue. There are some clues however:

1. The Win98 TCP window is only 2144 bytes when using Windows filesharing. This is pretty small and affects performance negatively. When fetching the same file with WS_FTP, the TCP window is approx. 16-32 kB. After reading the dumps my estimation is that this difference cannot account for much more than a factor 2-3 in speed however, as the latency is very low on the local network.

2. The Win98 machine uses 100% cpu when transferring with Samba, but a much lower number for the FTP transfers. This seems to indicate something weird going on in the Windows 98 filesharing code, and my guess is that this is the real reason for my problems. I'll try googling a bit more on this to see if I cannot find anything related...

3. It doesn't look like it is a network related problem, as suggested in some recent posts. I have more or less the expected bandwidth when using FTP, it is just the Samba filesharing that doesn't work satisfactory.

If someone is interested in seeing the TCP dumps, I can of course post some extracts here...

BTW, thanks everyone for the help so far!!!

----------

## cederberg

After a lot of searching I finally came across this excellent guide for tweaking Win98. Without having rebooted yet (to see if it works), it at least looks promising...

----------

## cederberg

 *cederberg wrote:*   

> After a lot of searching I finally came across this excellent guide for tweaking Win98. Without having rebooted yet (to see if it works), it at least looks promising...

 

Ok, it looks like adjusting the default TCP window up to 64240 bytes actually improved the throughput by about 100%, i.e. a factor x2 (as prognosticated before). The magical setting was present in the Windows registry (of course) in the key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VxD\MSTCP

The performance is still not close to what I get with FTP, but for some reason the cpu utilization now stays at about 30% when playing mp3:s and ogg:s from my Samba share. And that was what all of this was about, after all...  :Wink: 

Thank you all for your time.

----------

