[Samba] Samba -> WinXP: slow transfers, partial solution

Marcello Romani mromani at ottotecnica.com
Fri Jun 8 09:28:31 GMT 2007



Alexander Tsvyashchenko wrote:
> 
> 
> Hello All,
> 
> I'm running Samba 3.0.24 as PDC and file server on Gentoo Linux,  
> AMD64, 2.6.19 kernel, 100MBit/s network, and experience quite slow  
> file transfers from Samba to WinXP SP2 clients: the speed is varying,  
> but is about 1-2Mb/s at best.
> 
> I spent quite some time investigating the issue, here are the  
> intermediate results:
> 
> 1) This happens only when transferring _from_ _Samba_ to _WinXP_.
> 
> All other combinations are unaffected:
> 
>   a) Transferring from WinXP to Samba server is at 10Mb/s.
> 
>   b) Transfering to/from Samba server from Gentoo Linux on the same PC  
> where WinXP is installed (so, completely the same hardware and  
> connection) is also at normal speed.
> 
>   c) Transferring to/from WinXP to the server where Samba is installed  
> using any other protocol (such as HTTPS or SCP) is also at normal speed.
> 
> 2) CPU is at almost idle level both at client and server, so it's not  
> the issue.
> 
> 3) If there is any other network activity, transfer speed is increased  
> up to normal level: f.e. doing two simulteneous transfers from Samba  
> server to WinXP client gives 5Mb/s at each transfer, as expected.
> 
> 4) Running tcpdump on server while the transfer is performed improves  
> transfer speed in about 1.5 - 3 times, but still not to the normal  
> speed.
> 
> 5) Playing with "socket options" does not give any results.
> 
> Specifically, using advices from the article  
> http://www.dd.iij4u.or.jp/~okuyamak/Documents/tuning.english.html  
> about SO_SNDBUF does not improve situation (but read below).
> 
> 6) tcpdump + tcptrace show that there are a lot of retransmissions,  
> see dumps below.
> 
> 7) I've tested several WinXP clients with different hardware, all with  
> the same results.
> 
> 8) Samba logs looks normal to me, nothing special.
> 
> Points (3) and (5), and also the article about SO_SNDBUF tuning gave  
> me an idea that there might be smth wrong with ACKs sent from WinXP.
> 
> I've tried to search for problems with ACK delays in WinXP and found  
> the following articles:
> 
> http://support.microsoft.com/kb/328890
> http://support.microsoft.com/kb/321098
> 
> Based on them, I've done the following changes in WinXP registry:
> 
>   - set TcpAckFrequency to 1 to switch off delayed ACKs
>   - set TcpDelAckTicks to 0 to disable delayed ACKs timer
> 
> These changes did not help on their own. But combining them with the  
> change of SO_SNDBUF to 1500 suddenly improved the speeds up to about 6  
> Mb/s!
> 
> It appeared that with these registry changes, setting SO_SNDBUF to any  
> value in the range 1404 - 1872 gives the same speed of 6.0 - 6.4 Mb/s,  
> while changing it even one byte lower / higher immmediately drops the  
> speed to less than 1Mb/s.
> 
> However, while this is partial solution I could live with, this is  
> still not the normal speed, so I still would like to find the way to  
> bring it to normal values.
> 
> It seems that I'm not the only one who have similar problems: see BUGs  
> 2117 and 3706 in Bugzilla, and discussion at Gentoo mailing list:  
> http://forums.gentoo.org/viewtopic-p-2820556.html
> 
> Please, let me know if any other information may be needed or if there  
> are any other tests I can do to pin down the problem ...
> 
> I'm attaching tcptrace logs for several sessions
> (all transfers are from Samba server to WinXP with registry changes
> applied,
> all transfers are done with the same file of the size 338Mb).
> 
> 1) Samba -> WinXP without SO_SNDBUF set.
> (note that due to the "tcpdump effect" the speed is higher than in
> reality,
> also please note big number of retransmits)
> 
> ================================
> TCP connection 3:
> 	host e:        ***client***:1314
> 	host f:        ***server***:445
> 	complete conn: no	(SYNs: 0)  (FINs: 0)
> 	first packet:  Sat Apr 14 15:05:57.502839 2007
> 	last packet:   Sat Apr 14 15:07:53.234397 2007
> 	elapsed time:  0:01:55.731558
> 	total packets: 425593
> 	filename:      snd_buf_off.log
>     e->f:			      f->e:
>       total packets:        175858           total packets:        249735
>       ack pkts sent:        175858           ack pkts sent:        249735
>       pure acks sent:       164954           pure acks sent:            8
>       sack pkts sent:            0           sack pkts sent:            0
>       dsack pkts sent:           0           dsack pkts sent:           0
>       max sack blks/ack:         0           max sack blks/ack:         0
>       unique bytes sent:    690320           unique bytes sent: 356048963
>       actual data pkts:      10904           actual data pkts:     249727
>       actual data bytes:    690320           actual data bytes: 356319077
>       rexmt data pkts:           0           rexmt data pkts:         195
>       rexmt data bytes:          0           rexmt data bytes:     270114
>       zwnd probe pkts:           0           zwnd probe pkts:           0
>       zwnd probe bytes:          0           zwnd probe bytes:          0
>       outoforder pkts:           0           outoforder pkts:           0
>       pushed data pkts:      10904           pushed data pkts:      10982
>       SYN/FIN pkts sent:       0/0           SYN/FIN pkts sent:       0/0
>       urgent data pkts:          0 pkts      urgent data pkts:          0
> pkts
>       urgent data bytes:         0 bytes     urgent data bytes:         0
> bytes
>       mss requested:             0 bytes     mss requested:             0
> bytes
>       max segm size:           170 bytes     max segm size:          1460
> bytes
>       min segm size:            40 bytes     min segm size:            39
> bytes
>       avg segm size:            63 bytes     avg segm size:          1426
> bytes
>       max win adv:           65535 bytes     max win adv:           24656
> bytes
>       min win adv:           64099 bytes     min win adv:           15008
> bytes
>       zero win adv:              0 times     zero win adv:              0
> times
>       avg win adv:           65464 bytes     avg win adv:           24655
> bytes
>       max owin:                171 bytes     max owin:              61504
> bytes
>       min non-zero owin:         1 bytes     min non-zero owin:         1
> bytes
>       avg owin:                  4 bytes     avg owin:              28273
> bytes
>       wavg owin:                 0 bytes     wavg owin:             16041
> bytes
>       initial window:          138 bytes     initial window:            0
> bytes
>       initial window:            1 pkts      initial window:            0
> pkts
>       ttl stream length:        NA           ttl stream length:        NA
>       missed data:              NA           missed data:              NA
>       truncated data:       537664 bytes     truncated data:    352822899
> bytes
>       truncated packets:     10904 pkts      truncated packets:    249727
> pkts
>       data xmit time:      115.730 secs      data xmit time:      115.730
> secs
>       idletime max:          661.6 ms        idletime max:          661.9
> ms
>       throughput:             5965 Bps       throughput:          3076507
> Bps
> ================================
> 
> 2) Samba -> WinXP without SO_SNDBUF set, two simultaneous transfers
> (note there are no retransmits at all)
> 
> ================================
> TCP connection 1:
> 	host a:        ***client***:1314
> 	host b:        ***server***:445
> 	complete conn: no	(SYNs: 0)  (FINs: 0)
> 	first packet:  Sat Apr 14 15:35:27.213438 2007
> 	last packet:   Sat Apr 14 15:36:31.474766 2007
> 	elapsed time:  0:01:04.261328
> 	total packets: 800651
> 	filename:      simult_snd_buf_off.log
>     a->b:			      b->a:
>       total packets:        326843           total packets:        473808
>       ack pkts sent:        326843           ack pkts sent:        473808
>       pure acks sent:       306750           pure acks sent:           31
>       sack pkts sent:            0           sack pkts sent:            2
>       dsack pkts sent:           0           dsack pkts sent:           1
>       max sack blks/ack:         0           max sack blks/ack:         1
>       unique bytes sent:   1266917           unique bytes sent: 658967341
>       actual data pkts:      20093           actual data pkts:     473777
>       actual data bytes:   1266980           actual data bytes: 658967341
>       rexmt data pkts:           1           rexmt data pkts:           0
>       rexmt data bytes:         63           rexmt data bytes:          0
>       zwnd probe pkts:           0           zwnd probe pkts:           0
>       zwnd probe bytes:          0           zwnd probe bytes:          0
>       outoforder pkts:           0           outoforder pkts:           0
>       pushed data pkts:      20093           pushed data pkts:      25922
>       SYN/FIN pkts sent:       0/0           SYN/FIN pkts sent:       0/0
>       urgent data pkts:          0 pkts      urgent data pkts:          0
> pkts
>       urgent data bytes:         0 bytes     urgent data bytes:         0
> bytes
>       mss requested:             0 bytes     mss requested:             0
> bytes
>       max segm size:           148 bytes     max segm size:          1460
> bytes
>       min segm size:            40 bytes     min segm size:            39
> bytes
>       avg segm size:            63 bytes     avg segm size:          1390
> bytes
>       max win adv:           65535 bytes     max win adv:           24656
> bytes
>       min win adv:           51724 bytes     min win adv:           24656
> bytes
>       zero win adv:              0 times     zero win adv:              0
> times
>       avg win adv:           65472 bytes     avg win adv:           24656
> bytes
>       max owin:          18446744073709551554 bytes     max owin:       
>          69822 bytes
>       min non-zero owin:         1 bytes     min non-zero owin:         1
> bytes
>       avg owin:                  7 bytes     avg owin:              45958
> bytes
>       wavg owin:         7750572630405 bytes     wavg owin:             
>   50450 bytes
>       initial window:           63 bytes     initial window:            0
> bytes
>       initial window:            1 pkts      initial window:            0
> pkts
>       ttl stream length:        NA           ttl stream length:        NA
>       missed data:              NA           missed data:              NA
>       truncated data:       985678 bytes     truncated data:    652334463
> bytes
>       truncated packets:     20093 pkts      truncated packets:    473777
> pkts
>       data xmit time:       64.257 secs      data xmit time:       64.257
> secs
>       idletime max:         2790.4 ms        idletime max:         2790.6
> ms
>       throughput:            19715 Bps       throughput:         10254493
> Bps
> ================================
> 
> 3) Samba -> WinXP with SO_SNDBUF set to 1500.
> 
> ================================
> TCP connection 3:
> 	host e:        ***client***:3878
> 	host f:        ***server***:445
> 	complete conn: no	(SYNs: 0)  (FINs: 0)
> 	first packet:  Sat Apr 14 18:18:59.800152 2007
> 	last packet:   Sat Apr 14 18:20:05.035874 2007
> 	elapsed time:  0:01:05.235721
> 	total packets: 501414
> 	filename:      snd_buf_on.log
>     e->f:			      f->e:
>       total packets:        251898           total packets:        249516
>       ack pkts sent:        251898           ack pkts sent:        249516
>       pure acks sent:       240994           pure acks sent:           10
>       sack pkts sent:            0           sack pkts sent:            0
>       dsack pkts sent:           0           dsack pkts sent:           0
>       max sack blks/ack:         0           max sack blks/ack:         0
>       unique bytes sent:    690320           unique bytes sent: 356048963
>       actual data pkts:      10904           actual data pkts:     249506
>       actual data bytes:    690320           actual data bytes: 356052623
>       rexmt data pkts:           0           rexmt data pkts:          20
>       rexmt data bytes:          0           rexmt data bytes:       3660
>       zwnd probe pkts:           0           zwnd probe pkts:           0
>       zwnd probe bytes:          0           zwnd probe bytes:          0
>       outoforder pkts:           0           outoforder pkts:           0
>       pushed data pkts:      10904           pushed data pkts:      10923
>       SYN/FIN pkts sent:       0/0           SYN/FIN pkts sent:       0/0
>       urgent data pkts:          0 pkts      urgent data pkts:          0
> pkts
>       urgent data bytes:         0 bytes     urgent data bytes:         0
> bytes
>       mss requested:             0 bytes     mss requested:             0
> bytes
>       max segm size:           170 bytes     max segm size:          1460
> bytes
>       min segm size:            40 bytes     min segm size:            39
> bytes
>       avg segm size:            63 bytes     avg segm size:          1427
> bytes
>       max win adv:           65535 bytes     max win adv:           24656
> bytes
>       min win adv:           64081 bytes     min win adv:           24656
> bytes
>       zero win adv:              0 times     zero win adv:              0
> times
>       avg win adv:           65483 bytes     avg win adv:           24656
> bytes
>       max owin:                171 bytes     max owin:               2921
> bytes
>       min non-zero owin:         1 bytes     min non-zero owin:         1
> bytes
>       avg owin:                  3 bytes     avg owin:               2805
> bytes
>       wavg owin:                 0 bytes     wavg owin:               765
> bytes
>       initial window:          138 bytes     initial window:            0
> bytes
>       initial window:            1 pkts      initial window:            0
> pkts
>       ttl stream length:        NA           ttl stream length:        NA
>       missed data:              NA           missed data:              NA
>       truncated data:       537664 bytes     truncated data:    352559539
> bytes
>       truncated packets:     10904 pkts      truncated packets:    249506
> pkts
>       data xmit time:       65.235 secs      data xmit time:       65.235
> secs
>       idletime max:         2000.5 ms        idletime max:         2000.8
> ms
>       throughput:            10582 Bps       throughput:          5457883
> Bps
> ================================
> 
> 4) Transfer from Samba server to WinXP using SCP protocol.
> 
> ================================
> TCP connection 4:
> 	host g:        ***client***:1501
> 	host h:        ***server***:22
> 	complete conn: no	(SYNs: 0)  (FINs: 2)
> 	first packet:  Sat Apr 14 15:25:26.305071 2007
> 	last packet:   Sat Apr 14 15:25:57.316420 2007
> 	elapsed time:  0:00:31.011348
> 	total packets: 436782
> 	filename:      scp.log
>     g->h:			      h->g:
>       total packets:        179196           total packets:        257586
>       ack pkts sent:        179196           ack pkts sent:        257586
>       pure acks sent:       174818           pure acks sent:           13
>       sack pkts sent:            0           sack pkts sent:            0
>       dsack pkts sent:           0           dsack pkts sent:           0
>       max sack blks/ack:         0           max sack blks/ack:         0
>       unique bytes sent:    210208           unique bytes sent: 356544464
>       actual data pkts:       4377           actual data pkts:     257572
>       actual data bytes:    210208           actual data bytes: 356544464
>       rexmt data pkts:           0           rexmt data pkts:           0
>       rexmt data bytes:          0           rexmt data bytes:          0
>       zwnd probe pkts:           0           zwnd probe pkts:           0
>       zwnd probe bytes:          0           zwnd probe bytes:          0
>       outoforder pkts:           0           outoforder pkts:           0
>       pushed data pkts:       4377           pushed data pkts:      21912
>       SYN/FIN pkts sent:       0/1           SYN/FIN pkts sent:       0/1
>       urgent data pkts:          0 pkts      urgent data pkts:          0
> pkts
>       urgent data bytes:         0 bytes     urgent data bytes:         0
> bytes
>       mss requested:             0 bytes     mss requested:             0
> bytes
>       max segm size:            96 bytes     max segm size:          1460
> bytes
>       min segm size:            32 bytes     min segm size:            28
> bytes
>       avg segm size:            48 bytes     avg segm size:          1384
> bytes
>       max win adv:           65535 bytes     max win adv:            8272
> bytes
>       min win adv:           22451 bytes     min win adv:            8272
> bytes
>       zero win adv:              0 times     zero win adv:              0
> times
>       avg win adv:           62839 bytes     avg win adv:            8272
> bytes
>       max owin:                 97 bytes     max owin:              65501
> bytes
>       min non-zero owin:         1 bytes     min non-zero owin:         1
> bytes
>       avg owin:                  5 bytes     avg owin:              50602
> bytes
>       wavg owin:                 0 bytes     wavg owin:             56657
> bytes
>       initial window:           80 bytes     initial window:            0
> bytes
>       initial window:            1 pkts      initial window:            0
> pkts
>       ttl stream length:        NA           ttl stream length:        NA
>       missed data:              NA           missed data:              NA
>       truncated data:       148930 bytes     truncated data:    352938456
> bytes
>       truncated packets:      4377 pkts      truncated packets:    257572
> pkts
>       data xmit time:       31.010 secs      data xmit time:       31.004
> secs
>       idletime max:          101.0 ms        idletime max:          103.8
> ms
>       throughput:             6778 Bps       throughput:         11497225
> Bps
> ================================
> 
> Thanks!
> 
> Good luck!                                     Alexander
> 
> 
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
> 
> 
> --
> To unsubscribe from this list go to the following URL and read the
> instructions:  https://lists.samba.org/mailman/listinfo/samba
> 
> 



I would like to report that the suggestion listed in this e-mail improved my
transfer speed dramtcally.

Thanks alexander.

My environment is as follows:

Server:

Pentium IV 2.60 GHz Hyperthreading enabled, 2GB RAM, software raid1 on two
37GB 10krpm U160 scsi disks.
Network: GB ethernet on the server

uname -a:

Linux serverlinux 2.6.16-gentoo-r9 #3 SMP Fri Mar 23 12:55:22 CET 2007 i686
Intel(R) Pentium(R) 4 CPU 2.60GHz GenuineIntel GNU/Linux

smbd --version:

Version 3.0.22

Client: Windows XP SP2, up-to-date with the latest windows update fixes.
Athlon XP 2GHz, 1GB ram, 40GB IDE drive.
Network: 100MBit ethernet.


The problem:
I was working on a 17MB OpenOffice Writer document, which is stored on our
main network share. The time required to load the document was quite high,
but acceptable. Saving the document, though, took almost 30 to 40 seconds.
During the saving process, both the server and client CPUs were almost idle,
the network usage measured on the client was around 2% and the r/w load on
the server disks were very low.

The average transfer rate reported by tcptrace was around 150Kb/s

I applied the registry modifications on the client and rebotted the machine:
the situation was the same.

Then I applied the SO_SNDBUF modification on the server and did a killall
-HUP smbd. Now the transfer rate reported by tcptrace has bumped up to a
respectable 1Mb/s, and the load/save times experienced while working on the
document are back to normality.

The tcptrace report _before_ applying the modifications is:

(.201 is the server, .19 is the client)

TCP connection 2:
        host c:        192.9.200.19:1133
        host d:        192.9.200.201:445
        complete conn: no       (SYNs: 0)  (FINs: 0)
        first packet:  Fri Jun  8 10:32:18.486390 2007
        last packet:   Fri Jun  8 10:34:15.324113 2007
        elapsed time:  0:01:56.837723
        total packets: 44000
        filename:      ced.dump
   c->d:                              d->c:
     total packets:         17796           total packets:         26204
     ack pkts sent:         17796           ack pkts sent:         26204
     pure acks sent:         4003           pure acks sent:         6480
     sack pkts sent:            5           sack pkts sent:          423
     dsack pkts sent:           0           dsack pkts sent:          60
     max sack blks/ack:         1           max sack blks/ack:         1
     unique bytes sent:  17630024           unique bytes sent:  25753790
     actual data pkts:      13793           actual data pkts:      19724
     actual data bytes:  17717624           actual data bytes:  26294993
     rexmt data pkts:          60           rexmt data pkts:         429
     rexmt data bytes:      87600           rexmt data bytes:     541203
     zwnd probe pkts:           0           zwnd probe pkts:           0
     zwnd probe bytes:          0           zwnd probe bytes:          0
     outoforder pkts:         258           outoforder pkts:           0
     pushed data pkts:       2004           pushed data pkts:       2368
     SYN/FIN pkts sent:       0/0           SYN/FIN pkts sent:       0/0
     urgent data pkts:          0 pkts      urgent data pkts:          0
pkts
     urgent data bytes:         0 bytes     urgent data bytes:         0
bytes
     mss requested:             0 bytes     mss requested:             0
bytes
     max segm size:          1460 bytes     max segm size:          1460
bytes
     min segm size:            41 bytes     min segm size:            39
bytes
     avg segm size:          1284 bytes     avg segm size:          1333
bytes
     max win adv:           65535 bytes     max win adv:           32767
bytes
     min win adv:           64079 bytes     min win adv:           32767
bytes
     zero win adv:              0 times     zero win adv:              0
times
     avg win adv:           64998 bytes     avg win adv:           32767
bytes
     initial window:          198 bytes     initial window:            0
bytes
     initial window:            1 pkts      initial window:            0
pkts
     ttl stream length:        NA           ttl stream length:        NA
     missed data:              NA           missed data:              NA
     truncated data:     17524522 bytes     truncated data:     26018857
bytes
     truncated packets:     13793 pkts      truncated packets:     19724
pkts
     data xmit time:      116.836 secs      data xmit time:      116.837
secs
     idletime max:        10705.3 ms        idletime max:        10706.0 ms
     throughput:           150893 Bps       throughput:           220424 Bps


The report _afeter_ the modification is instead:

TCP connection 2:
        host c:        192.9.200.19:1076
        host d:        192.9.200.201:445
        complete conn: no       (SYNs: 0)  (FINs: 0)
        first packet:  Fri Jun  8 11:06:50.522285 2007
        last packet:   Fri Jun  8 11:07:07.647955 2007
        elapsed time:  0:00:17.125670
        total packets: 55619
        filename:     
ced.dump.TcpAckFrequency1.TcpDelAckTicks0.sosndbuf1500
   c->d:                              d->c:
     total packets:         29699           total packets:         25920
     ack pkts sent:         29699           ack pkts sent:         25920
     pure acks sent:        15872           pure acks sent:         6387
     sack pkts sent:            0           sack pkts sent:          379
     dsack pkts sent:           0           dsack pkts sent:          59
     max sack blks/ack:         0           max sack blks/ack:         1
     unique bytes sent:  17632261           unique bytes sent:  26066694
     actual data pkts:      13827           actual data pkts:      19533
     actual data bytes:  17718401           actual data bytes:  26066694
     rexmt data pkts:          59           rexmt data pkts:           0
     rexmt data bytes:      86140           rexmt data bytes:          0
     zwnd probe pkts:           0           zwnd probe pkts:           0
     zwnd probe bytes:          0           zwnd probe bytes:          0
     outoforder pkts:         214           outoforder pkts:           0
     pushed data pkts:       2039           pushed data pkts:       2324
     SYN/FIN pkts sent:       0/0           SYN/FIN pkts sent:       0/0
     urgent data pkts:          0 pkts      urgent data pkts:          0
pkts
     urgent data bytes:         0 bytes     urgent data bytes:         0
bytes
     mss requested:             0 bytes     mss requested:             0
bytes
     max segm size:          1460 bytes     max segm size:          1460
bytes
     min segm size:            41 bytes     min segm size:            39
bytes
     avg segm size:          1281 bytes     avg segm size:          1334
bytes
     max win adv:           65535 bytes     max win adv:           32767
bytes
     min win adv:           64076 bytes     min win adv:           32767
bytes
     zero win adv:              0 times     zero win adv:              0
times
     avg win adv:           65157 bytes     avg win adv:           32767
bytes
     initial window:          198 bytes     initial window:            0
bytes
     initial window:            1 pkts      initial window:            0
pkts
     ttl stream length:        NA           ttl stream length:        NA
     missed data:              NA           missed data:              NA
     truncated data:     17524823 bytes     truncated data:     25793232
bytes
     truncated packets:     13827 pkts      truncated packets:     19533
pkts
     data xmit time:       17.124 secs      data xmit time:       17.125
secs
     idletime max:         7717.0 ms        idletime max:         7717.2 ms
     throughput:          1029581 Bps       throughput:          1522083 Bps




Please note the following details:

Before:
idletime max:        10705.3 ms        idletime max:        10706.0 ms
throughput:           150893 Bps       throughput:           220424 Bps

After:
idletime max:         7717.0 ms        idletime max:         7717.2 ms
throughput:          1029581 Bps       throughput:          1522083 Bps
-- 
View this message in context: http://www.nabble.com/Samba--%3E-WinXP%3A-slow-transfers%2C-partial-solution-tf3576704.html#a11023232
Sent from the Samba - General mailing list archive at Nabble.com.



More information about the samba mailing list