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

Alexander Tsvyashchenko lists at ndl.kiev.ua
Sat Apr 14 15:33:07 GMT 2007


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.




More information about the samba mailing list