In my LAN, I have a router that runs a Samba server and my PC connects to the router.

I wiresharked during a uploading to the server and a downloading from the server.

The wireshark results show that:

  • During the uploading, the server sends an ACK every 0.6ms average
  • During the downloading, my PC send an ACK every 0.025ms average

As a consequence, the downloading generates about 120,000 frames while the uploading only generates 70,000 frames. And the downloading rate is about 12.7Mbytes/s while the uploading rate is 20Mbytes/s.

So I want to figure out the possible reason for this.

  • A number of things could be determining this, switch performance and buffer sizes, disk capabilities on either end. Jan 10 '12 at 23:00
  • The reason for what?
    – mailq
    Jan 10 '12 at 23:01

There are mainly two mechanisms to reduce the amount of ACK packets returned - the Nagle algorithm and Delayed ACKs - both described in RFC 1122. Both are optional, so there will be hosts which are either configured not to use them or have the appropriate implementation missing. Especially Samba can be instructed to disable the Nagle algorithm by using socket options = TCP_NODELAY in the configuration.

Your difference in upstream / downstream data rates for SMB file copies is likely to have other reasons than an abundance of TCP ACK packets though.

  • Yes, the main reason for this is the capabilities of CPU. My PC is capable of sending a packet every 12.5us average while the router sends a packet every 90us average. So, the uploading should be 7 time faster, but it didn't. That's why I think the ACK also has a quite important influence.
    – sliter
    Jan 10 '12 at 23:52
  • @sliter The number of ACKs would only influence the throughput if your router is operating at the maximum forwarding capacity regarding its packets per second performance (each received / forwarded / processed packet will obviously cost CPU performance) or if your upstream can't handle the sustained data rate needed for the ACKs. I would suggest looking into your router's/Samba server's performance metrics to check if the CPU is bottlenecking there on both occasions.
    – the-wabbit
    Jan 11 '12 at 21:12

The TCP implementation ACKs every other data packet. So you should see, typically, two data packets received and then an ACK sent. The sender, of course, is not waiting for the ACK anyway. It will continue to transmit until the window is full, even in the absence of an ACK.

There are other factors potentially at play here, such as Nagle and delayed ACK. But it doesn't look like you're seeing the affects of them.

  • This is exactly what I saw for the downloading, my PC ACKs after receiving two packets but not for the uploading. Besides, where the kernel's implementation for ACKing every other data packet?
    – sliter
    Jan 10 '12 at 23:44
  • What did you see during the uploading? The logic for ACKing is primarily in the __tcp_ack_snd_check function in tcp_input.c and tcp_send_delayed_ack in tcp_output.c. Jan 10 '12 at 23:50
  • For uploading, between two ACKs, there are around 22 frames transmitted. My guess is that, for uploading the delayed ACK is activated. Because, the time between ACKs is 0.6ms which is smaller than TCP_DELACK_MAX(2ms) and larger than TCP_DELACK_MIN(0.4ms). What you think?
    – sliter
    Jan 11 '12 at 9:02
  • Even so, the window should be large enough that the ACKs shouldn't be affecting performance. Jan 11 '12 at 19:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.