Slashdot Mirror


Better Bandwidth Utilization

jtorin writes "Daniel Hartmeier (of OpenBSD fame) has written a short but interesting article which explains how to better utilize available bandwidth. In short it gives priority to TCP ACKs over other types of traffic, thereby making it possible to max both upload and download bandwidth simultaenously. Be sure to check ot the nice graphs! Also note the article on OpenBSD Journal. OpenBSD 3.3 beta is now stable enough for daily use, so why not download a snapshot from one of the mirrors and try it out?"

33 of 196 comments (clear)

  1. How ironic by JPDeckers · · Score: 4, Funny

    How ironic, an article about better utilizing available bandwidth, and already /.-ed with 0 comments. Guess bandwidth is utilized now.

    1. Re:How ironic by TopShelf · · Score: 4, Funny

      Guess we better implement this idea without any delay, then!

      --
      Stop by my site where I write about ERP systems & more
  2. How to better utilize bandwidth by gmuslera · · Score: 4, Funny

    rule 1: don't put an article in slashdot pointing to your site

  3. Oh, that's where OpenBSD is... by dereklam · · Score: 4, Funny
    Thanks for linking to OpenBSD... I was wondering what that whole BSD thing was!

    Now if only I could find that Linux thing...

  4. like wondershaper does for months now? by Anonymous Coward · · Score: 5, Informative
    1. Re:like wondershaper does for months now? by gmuslera · · Score: 4, Informative

      Wondershaper uses other approach, like having a scheduler and (de)prioritize certain ports and hosts . I think that right now it not specially prioritize TCP ack, and, well, that could improve the good job what do wondershaper right now if it works.

    2. Re:like wondershaper does for months now? by gmuslera · · Score: 4, Informative

      Second revisions are always better. It prioritizes small packets (of less of 64 bytes), and I suppose that this include ACKs :)

    3. Re:like wondershaper does for months now? by Captain+Pedantic · · Score: 5, Interesting

      From the Wondershaper script:

      # To speed up downloads while an upload is going on, put ACK packets in
      # the interactive class:


      tc filter add dev $DEV parent 1: protocol ip prio 12 u32 \
      match ip protocol 6 0xff \
      match u8 0x05 0x0f at 0 \
      match u16 0x0000 0xffc0 at 2 \
      match u8 0x10 0xff at 33 \
      flowid 1:10

      --

      None are more hopelessly enslaved than those who falsely believe they are free. Johann Wolfgang von Goethe.
    4. Re:like wondershaper does for months now? by stratjakt · · Score: 4, Informative

      And from the explanation in the readme:

      "To make sure that uploads don't hurt downloads,
      we also move ACK packets to the front of the queue."

      It's pretty cool, it throttles your speeds to just under what the maximum should be, so that queueing will only happen on your linux box, and then you can prioritize what you want.

      --
      I don't need no instructions to know how to rock!!!!
    5. Re:like wondershaper does for months now? by spydir31 · · Score: 4, Informative
      better version, I think
      tc filter add dev $DEV parent 1:0 prio 10 u32 \
      match ip protocol 6 0xff \
      match u8 0x10 0x10 at nexthdr+13 \
      flowid 1:10
  5. This will be of most use to ... by adzoox · · Score: 4, Insightful
    I think this may be of most use to two way satellite connections and maybe to service providers - however; I don't see how one can get much faster than a cable modem or DSL connection - the internet comes through at the same bandwidth and speed whether I am wireless or T1 or cable modem/DSL - this is the majority of network traffic nowadays

    Corporate networks are already optimized under 100 or gigabit ethernet with Cisco routers which automatically handle collisions and error corrections.

    --
    Yell & scream & rant & rave... it's no use... you need a shaaaave ~ Bugs Bunny
    1. Re:This will be of most use to ... by arkanes · · Score: 4, Informative

      If you have a non-shaped asynchronous connection, like most forms of DSL and cable, it's pretty easy to cap out your upstream. When you do that, your downstream goes through the floor because your ACKs don't get through. This just says that if your routers prioritize ACKs, your downstream will still be fine even if your upstream is saturated. This isn't exactly new, my cable ISP already does this.

  6. We figured this before by Thijssss · · Score: 5, Interesting

    Actually ever since my isp changed from A2000 to Chello we had the same problem as this guy has with his download being killed by his upload, a few months ago me and some friends figured the same solution but we had no idea how to actually do it on a windows based machine, anyone with a idea?

  7. My solution: by Black+Parrot · · Score: 5, Funny


    Put lower priorities on p0rn, MP3s, Windows viruses, and Slashdot referrals. That should speed everything else up by about two orders of magnitude.

    --
    Sheesh, evil *and* a jerk. -- Jade
    1. Re:My solution: by radish · · Score: 5, Funny

      What is this "everything else" of which you speak?

      --

      ---- Den ene knappen er powerknapp, den andre er Bender voice knapp "Bite My Shiny Metal Ass"

  8. Note the article is all about low bandwidth setups by jj_johny · · Score: 4, Insightful
    Daniel has done some good work in micromanaging the available bandwidth to make sure that ACKs get through to minimize retransmits due to drops as well as other causes. When you look at low bandwidth links the time in queue and to transmit can be much bigger than the near instananious transmission times that you expect on high capacity lines.

    A little off topic but I always find it interesting that people with hicap gear (Foundry, Cisco, etc.) are always talking about QOS when it really only makes sense most times on low bandwidth lines. So his work is really important when you look at where it is in scheme of things - out at the end users line.

  9. Daniels original email by blkwolf · · Score: 5, Informative

    You can find Daniels original email on the subject at:
    http://marc.theaimsgroup.com/?l=openbsd-pf&m= 10463 0260218727

    It contains a little more of the pf rules than the article does, and has all the relevant information you need except for the nice /.'d graphs

  10. Uh, no, I don't think so by somethingwicked · · Score: 4, Informative

    That "Intro to the Internet" class from college is a little hazy now, but I don't recall it being as simple as the "internet" coming out of the pipe like water.

    Someone far more knowledgable than myself will get to correct me, but I seem to recall there was a process of-

    Send some stuff-wait for ACK.

    When you get the ACK, send some more.

    By turbocharging the ACKs, you are reducing that lag time

    --

    ---"What did I say that sounded like 'Tell me about your day?'"---

    1. Re:Uh, no, I don't think so by Patrick · · Score: 4, Informative
      Send some stuff-wait for ACK.

      When you get the ACK, send some more.

      By turbocharging the ACKs, you are reducing that lag time

      Not quite. TCP streams use pipelining: you send N packets (N is the "window size"), and each time you get an ACK you send one more. So in the ideal case there's no lag, because the ACK for packet 3 lets you go ahead and send packet 10 (if N=7).

      When a packet (or its ACK) gets dropped, TCP assumes the network is congested, and cuts N in half, and very slowly increases it back to where it was. So after each dropped packet or ACK you have a while during which you're not using the full link. Several drops in a row can reduce your throughput by a factor of 100 or more.

      Prioritizing ACKs doesn't reduce the lag time. It reduces the likelihood that TCP will overreact and reduce its sending rate due to perceived congestion.

  11. Re:Linux solution by pe1rxq · · Score: 5, Informative

    No it doesn't....
    It is a differend solution to a different problem caused by the same thing....

    The cause is the big cache in the modem, it results in a delay on outgoing traffic.
    One problem is that interactive traffic gets, well, less interactive (e.g. the echo characters in a remote shell have a delay). This is solved in the HOWTO you refered to.
    Another problem is that the downstream acks get delayed resulting in less downstream data. This is solved in the mentioned article.

    A combination of the two would be really great and could probably be done in both linux and openbsd.

    Jeroen

    --
    Secure messaging: http://quickmsg.vreeken.net/
  12. .CX Domain by goldspider · · Score: 4, Funny

    Was I the only one who was a little apprehensive about clicking on a link from the .cx domain?

    --
    "Ask not what your country can do for you." --John F. Kennedy
  13. Re:The problem is by The+Evil+Couch · · Score: 4, Informative

    it's a possible way to game the system, however they can also ignore what the packets are marked as and just boost the priority of the smaller packets, which are almost always system messages. if the bump up everything under 64 bytes, then they'd get the same effect, but without the possibility of someone cheating the system like that. though I'm pretty sure someone else has already done that.

  14. Slashdotted - Mirror by SILIZIUMM · · Score: 5, Informative

    Since the website seems slashdotted now I've set up a mirror. You can see it there.

  15. Try it by genka · · Score: 4, Funny


    "OpenBSD 3.3 beta is now stable enough for daily use, so why not download a snapshot from one of the mirrors and try it out?"


    Windows XP is now stable enough for daily use, so why not download a snapshot from one of the mirrors and try it out?"

    (intended as a joke)

  16. Title is correct! by DarkMan · · Score: 5, Interesting

    Your correct, bandwidth is fixed. This is about better bandwidth utilisation.

    The article is /.ed but the gist is that if you consider a full duplex conection, and you max out one side of that, say uploads, then the ACK packets get swamped, so your downstrem bandwidth is spent re-transmitting, or empty whilst the other end is waiting for ACKs.

    The bandwidth is there, it;s just under utilised. By prioritisng the ACK's, so that they get boosted through, it becomes possible to saturate both upstream and downstream pipes at once, at peak efficency, rather than one of the coasting along, waithing for the other.

    Note that this only applies for TCP/IP and similar, reliable, protocols. If you had a UDP app (e.g. media streaming done properly), then this trick won't affect it at all, as it doesn't wait for an ACK.

  17. this may break TCP flow control! by mekkab · · Score: 5, Interesting

    If the acks are sped up, this interferes with TCP keeping track of the statistical average Round Trip Time.

    So if the network is congested and an ACK SHOULD time out but doesn't, TCP will keep on flooding the network, ruining the pool for everyone.(see: Tragedy of the commons)

    Yes, I agree that this is a big-O style worse case scenario, but its something to consider.

    --
    In the future, I would want to not be isolated from my friends in the Space Station.
    1. Re:this may break TCP flow control! by anthony_dipierro · · Score: 5, Informative

      So if the network is congested and an ACK SHOULD time out but doesn't, TCP will keep on flooding the network, ruining the pool for everyone.

      No. If the downstream is flooded, the packets won't be received, and no ACK will be sent. ACKs have higher priority, but even that can't make them appear out of thin air.

  18. W. Richard Stevens TCP/IP Illustrated, Volume 1 by puzzled · · Score: 5, Informative



    It seems to me that a great many /. readers have a cursory knowledge of how TCP/IP works. This is true of almost every other topic and I don't have a generalized solution for ignorance, but in this case a quick read of the first volume of Stevens' excellent TCP/IP Illustrated Series should do the trick.

    Reading that book will give you a foundation to understanding how a single endpoint behaves in an IP network. If you want some understanding of the guts of a large scale internetwork I'd suggest the Cisco Press IP Quality of Service book.

    There are a great many things near and dear to /. reader's hearts - the god given right to steal music by treating a retail DSL/Cable connection like a dedicated wholesale circuit being the prime example - that are more easily understood after a read of these two books.

    If you're impatient you can look at my journal - I've covered some of the issues there.

    --
    I am very easy to get along with, but I don't have time to waste being nice to people who are being stupid. -Theo
  19. Re:Security hole by Arethan · · Score: 5, Interesting

    It's called SYN flooding. The idea is that a system only has so much memory to work with. Each established TCP session has memory overhead for packet ordering and split packet reassembly. Generally, when a system recienves a SYN packet, it assumes that the session is going to be valid, and it begins the process of completing the TCP session building, which happens to include setting aside some memory for session management.

    For each SYN packet you send, you eat up a little bit more memory and CPU time on the victim. Do it enough times, and the system runs out of memory or processor time, and the system becomes unable to perform its regular operations. Effectively causing a Denial of Service.

    If you're smart, you'll form the SYN packets to have source addresses that differ from your real IP, otherwise a) you're traceable; and b) your machine will be flooded with SYN/ACKS. If you are even smarter, you'll use an IP that, while valid and routable, belongs to a host that either doesn't exist, or is currently off. Otherwise the 2nd level victim recieving the SYN/ACKs from your initial target will send RSETs for every SYN/ACK, since it never requested to initial the connection. When your target gets the RSET for the SYN/ACK, it will close the session, freeing up the memory and CPU time that you are desparately trying to fill. Essentially, a non-existant host will never respond to a SYN/ACK, so the target system has to wait for a timeout duration before closing the session, which makes it easier for you to eat up CPU and memory. Unfortunately though, the fake spirce IP on your SYN packets will likely have to be within your ISP's network range, as all smart ISP network administrators perform egress packet filtering to prevent such attacks from originating within their network.

    Better tactics include sending the SYNs from multiple machines that have different providers. Thus preventing load from the SYN/ACKs from filling your ISPs pipe. This effectively makes the attack a DDoS, rather than a DoS.

    Either way, you can't really perform these attacks in much safety, as competent network administrators will have sniffers in place to detect these attacks as they cross their network. So #1) if your ISP admin is smart, you're busted by them regardless; and #2) if the chain of smart admins follows you all the way back to your sources, you're busted by the authorities (which if you cross state lines means the Feds, which will suck quite adamently).

    So, that is how it works, but I wouldn't recommend trying it.

  20. Server got /.'ed before 0 comments... by JRHelgeson · · Score: 4, Informative
    For the benefit of all: The follwing is the article in its entirity - sans the graphics which can be seen at: (provided the servers are working)

    http://www.benzedrine.cx/ackpri-norm.jpg
    http://www.benzedrine.cx/ackpri-priq.jpg

    benzedrine.cx - Prioritizing empty TCP ACKs with pf and ALTQ Prioritizing empty TCP ACKs with pf and ALTQ

    Introduction ALTQ is a framework to manage queueing disciplines on network interfaces. It manipulates output queues to enforce bandwidth limits and priorize traffic based on classification.

    While ALTQ was part of OpenBSD and has been enabled by default since several releases, the next release will merge the ALTQ and pf configuration into a single file and let pf assign packets to queues. This both simplifies the configuration and greatly reduces the cost of queue assignment.

    This article presents a simple yet effective example of what the pf/ALTQ combination can be used for. It's meant to illustrate the new configuration syntax and queue assignment. The code used in this example is already available in the -current OpenBSD source branch.

    Problem I'm using an asymmetric DSL with 512 kbps downstream and 128 kbps upstream capacity (minus PPPoE overhead). When I download, I get transfer rates of about 50 kB/s. But as soon as I start a concurrent upload, the download rate drops significantly, to about 7 kB/s.

    Explanation Even when a TCP connection is used to send data only in one direction (like when downloading a file through ftp), TCP acknowledgements (ACKs) must be sent in the opposite direction, or the peer will assume that its packets got lost and retransmit them. To keep the peer sending data at the maximum rate, it's important to promptly send the ACKs back.

    When the uplink is saturated by other connections (like a concurrent upload), all outgoing packets get delayed equally by default. Hence, a concurrent upload saturating the uplink causes the outgoing ACKs for the download to get delayed, which causes the drop in the download throughput.

    Solution The outgoing ACKs related to the download are small, as they don't contain any data payload. Even a fast download saturating the 512 kbps downstream does not require more than a fraction of upstream bandwidth for the related outgoing ACKS.

    Hence, the idea is to priorize TCP ACKs that have no payload. The following pf.conf fragment illustrates how to set up the queue definitions and assign packets to the defined queues:

    ext_if="kue0"

    altq on $ext_if priq bandwidth 100Kb queue { q_pri, q_def }
    queue q_pri priority 7
    queue q_def priority 1 priq(default)

    pass out on $ext_if proto tcp from $ext_if to any flags S/SA \
    keep state queue (q_def, q_pri)

    pass in on $ext_if proto tcp from any to $ext_if flags S/SA \
    keep state queue (q_def, q_pri)
    First, a macro is defined for the external interface. This makes it easier to adjust the ruleset when the interface changes.

    Next, altq is enabled on the interface using the priq scheduler, and the upstream bandwidth is specified.
    I'm using 100 kbps instead of 128 kbps as this is the real maximum I can reach (due to PPPoE encapsulation overhead). Some experimentation might be needed to find the best value. If it's set too high, the priority queue is not effective, and if it's set too low, the available bandwidth is not fully used.
    Then, two queues are defined with (arbitrary) names q_pri and q_def. The queue with the lower priority is made the default.

    Finally, the rules passing the relevant connections (statefully) are extended to specify what queues to assign the matching packets to. The first queue specified in the parentheses is used for all packets by default, while the second (and optional) queue is used for packets with ToS (type of service) 'lowdelay' (for instance interactive ssh sessions) and TCP ACKs without payload.

    Both incoming and outgoing TCP connections will pass by those two rules, create state, and all packets related to the connections will be assigned to either the q_def or q_pri queues. Packets assigned to the q_pri queue will have priority and will get sent before any pending packets in the q_def queue.

    Result The following test was performed first without and then with the ALTQ rules explained above:

    • -10 to -8 minutes: idle
    • -8 to -6 minutes: download only
    • -6 to -4 minutes: concurrent download and upload
    • -4 to -2 minutes: upload only
    • -2 to 0 minutes: idle

    The first graphs shows the results of the test without ALTQ, and the second one with ALTQ:

    Image 1, ACK PRI Normal

    Image 2, ACK PRI PRIq

    The improvement is quite significant, the saturated uplink no longer delays the outgoing empty ACKs, and the download rate doesn't drop anymore.

    This effect is not limited to asymmetric links, it occurs whenever one direction of the link is saturated. With an asymmetric link this occurs more often, obviously.

    Related links

    --
    Good security is based upon reality and common sense. Common sense is a function of having common knowledge.
  21. Not just low bandwidth by TFloore · · Score: 5, Interesting

    Though you might see more effects of this on a low bandwidth link, it is not just for low bandwidth.

    A fair number of protocols do transmit windows of a certain size. They'll send a certain amount of data, and not send more data until the oldest packest in the window gets an ACK back. You therefore only have so much data "in-flight" at any one time. Strongly asynchronous link (like aDSL and cablemodems) can require strikingly different window sizes than synchronous links.

    The right amount of in-flight data is dependent on the speed of your pipe, obviously, but a lot of applications still use defaults set for low-bandwidth pipes. You can argue that the proper solution for this is to change the defaults, but if you just give ACKs priority, you don't need to worry about it, and the less you force users to change, the better. (The transmit window size has to be a user setting, directly or indirectly, either by asking a window size, or by asking "what kind of pipe do you have?" and guessing a window size from that.)

    This is dependent on the protocol, true, but giving ACKs priority is actually a decent generic solution to what many consider an application-specific problem.

    QOS is also often about bandwidth guarantees, not necessarily throughput. You have a 155mbit link shared among several applications, and an application that *requires* 45mbit. So you use QOS to guarantee that application gets 45mbit if it wants it, and everything else shares the remainder. If the app isn't going, then that 45mbit it requires can be made available to other apps until it is required.

    --
    This is my sig. There are many like it but this one is... Oops. Frank, I've got your sig again! Where's mine?
  22. How does this compare to a DDR Fairness? by Froqen · · Score: 4, Informative

    Windows XP uses a DDR Fairness technique to solve the same problem, I wonder how the two techniques compare?
    See "QoS for Modems and Remote Access" at this KB article.

  23. ACK Shaping by nimrod_me · · Score: 4, Informative

    This is what is known today as "ACK traffic shaping". First on the market, I believe, was packeteer (www.packeteer.com) with their PacketShaper.

    Unlike most conventional traffic shapers which queue and control the data rate on the outgoing channel, PacketShaper controls the rate of acknowledgements on the reverse channel.

    This is usually used to *slow* traffic. I.e., instead of having the router drop packets (thereby wasting resources until the source TCP understands that the net is congested and reduces load) it just slows the ACKs and the sender automatically reduces its sending rate.

    Anyway, the real nice thing about the OpenBSD implementation is that they merge their packet filter (pf) with the ALTQ queuing code. Now this is really powerful.

    Sounds like a good time for all BSDs to adopt this new combination instead of relying on less-capable mechanisms. E.g. FreeBSD has ipfw for filtering and dummynet for queue management. I don't know how pf compares with ipfw but ALTQ is definitely better than dummynet.

    Nimrod.