Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Can't break 15mbps OpenVPN throughput

    Scheduled Pinned Locked Moved OpenVPN
    34 Posts 5 Posters 9.0k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      coachmark2
      last edited by

      I don't have an Intel unit to test on. :(

      But when not using VPN, I can pull 120+mbit/s through that interface all day long. It's just over VPN that it chokes.

      1 Reply Last reply Reply Quote 0
      • DerelictD
        Derelict LAYER 8 Netgate
        last edited by

        Wasn't the pfSense store recently selling Dell R210s?  I would think that pretty much clears his hardware.

        Chattanooga, Tennessee, USA
        A comprehensive network diagram is worth 10,000 words and 15 conference calls.
        DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
        Do Not Chat For Help! NO_WAN_EGRESS(TM)

        1 Reply Last reply Reply Quote 0
        • C
          coachmark2
          last edited by

          @__Derelict__

          That was my thought. :( They were actually R200s, but the R210 uses a very similar NIC setup.

          I have a performance update for inquiring minds. I re-ran my iperf testing with a few different parameters. When I use 8 simultaneous TCP streams, I see at or around 50mbit/s :D That's more like it and very tolerable. UDP looks like about the same.

          So… what could possibly be limiting a single TCP stream to 15 mbit/s?

          1 Reply Last reply Reply Quote 0
          • K
            kejianshi
            last edited by

            I also get throttled reliably at certain times of day.

            Example.  I can always download at my max rate from the web (like hulu or netflix) but a vpn is throttled to death after say 5pm here and not as bad at say 9am.

            It could be an ISP deal and traffic shaping.

            1 Reply Last reply Reply Quote 0
            • C
              coachmark2
              last edited by

              Sure, I'm certain that happens to me too. But this IS a VPN. To the ISP, it appears as a bunch of UDP gibberish, so they wouldn't be able to even see the fact that I'm running 1 vs. 8 TCP streams inside the tunnel.

              Consistently reproducible is the fact that I get 15mbit/s for a TCP data stream and 50mbit/s aggregate when number of streams >4. No matter the time of the day.

              Any idea what could be causing that?

              1 Reply Last reply Reply Quote 0
              • K
                kejianshi
                last edited by

                Yeah - sounds like they are throttling you per connection.  That or "long fat pipe" issues.  How far away are these vpns?

                1 Reply Last reply Reply Quote 0
                • C
                  coachmark2
                  last edited by

                  Approx. 400 miles by road. Since the East Coast routing tables are all kinds of screwed over right now (thanks Comcast!) it might be going through anywhere from 10 to 17 hops depending on what BGP feels like doing this particular time of day.

                  How would the ISP realize whether or not I'm pushing multiple TCP connections over this VPN though if it's encrypted UDP?

                  1 Reply Last reply Reply Quote 0
                  • K
                    kejianshi
                    last edited by

                    Are you telling me that all your traffic is going out over this 1 udp vpn but that if you are doing 1 TCP downlaod with this vpn you are limited to 15 but when doing many tcp downloads over this same vpn you can hit 50?

                    1 Reply Last reply Reply Quote 0
                    • C
                      coachmark2
                      last edited by

                      Not exactly.

                      All traffic going over this VPN. I have 100mbit/s UPLOAD speed for my client. I have 100mbit/s download speed where the OpenVPN server is. Pushing FROM my client TO my server, I would expect 100mbit/s minus some overhead. I instead get 15mbit/s with one TCP stream or 50mbit/s with 8 TCP streams.

                      50 is acceptable, and looks like ISP shaping. 15 is not good or expected.

                      1 Reply Last reply Reply Quote 0
                      • K
                        kejianshi
                        last edited by

                        You didn't answer my essential question.

                        Are the TCP stream all inside the vpn when you test or are you testing without vpn?

                        If you are getting these results while everything is being tunneled on vpn, then your problem is latency.  Latency will cause 1 single TCP stream to have limited available bandwidth.

                        This is the "long fat pipe" issue I mentioned earlier.  The cure for this is to either break a single file into multiple tcp streams for transfere or to transfer many files at once to max out available bandwidth.

                        1 Reply Last reply Reply Quote 0
                        • C
                          coachmark2
                          last edited by

                          All TCP streams are inside the tunnel when testing.

                          Is there anything in the system tunables section or somewhere else that I can tweak to improve speeds? :(

                          Multiple transfers at the same time seems to be what I'll have to do, I guess.

                          1 Reply Last reply Reply Quote 0
                          • K
                            kejianshi
                            last edited by

                            I already told you what is limiting your bandwidth per TCP connection.

                            Same issue here at 8k miles from pfsense vpn, only alot worse.

                            1 Reply Last reply Reply Quote 0
                            • C
                              coachmark2
                              last edited by

                              Well alright then. I guess we'll chalk it up to TCP being TCP.

                              Thanks

                              1 Reply Last reply Reply Quote 0
                              • P
                                phil.davis
                                last edited by

                                TCP window size can be an issue, but most modern end-clients sort that out reasonably.
                                e.g. if you have 10ms latency (1/100th sec) then it always takes at least 10ms to receive an ACK back for a packet.
                                At 50Mbps the TCP connection needs to be willing to have at least 50,000,000/100 = 500,000bits of data unACKed, outstanding in the pipe - this is "TCP window size". Otherwise it wastes time sitting waiting for old ACKs before putting more data in the pipe.
                                If the latency is higher (e.g. 100ms) then you would need 5,000,000 bits window size…

                                If you can run iperf (or similar) tests end-to-end through the pipe and adjust the window size used by iperf then you should be able to observe all that.

                                As the Greek philosopher Isosceles used to say, "There are 3 sides to every triangle."
                                If I helped you, then help someone else - buy someone a gift from the INF catalog http://secure.inf.org/gifts/usd/

                                1 Reply Last reply Reply Quote 0
                                • C
                                  coachmark2
                                  last edited by

                                  Interesting. Setting a very large window size (10Megabytes) yields 25 mbit/s….. What you say seems to be the case. :)

                                  Anything PFSense side that should be modified?

                                  1 Reply Last reply Reply Quote 0
                                  • K
                                    kejianshi
                                    last edited by

                                    Formula to Calculate TCP throughput

                                    TCP-Window-Size-in-bits / Latency-in-seconds = Bits-per-second-throughput

                                    So lets work through a simple example. I have a 1Gig Ethernet link from Chicago to New York with a round trip latency of 30 milliseconds. If I try to transfer a large file from a server in Chicago to a server in New York using FTP, what is the best throughput I can expect?

                                    First lets convert the TCP window size from bytes to bits.  In this case we are using the standard 64KB TCP window size of a Windows machine.

                                    64KB = 65536 Bytes.  65536 * 8 = 524288 bits

                                    Next, lets take the TCP window in bits and divide it by the round trip latency of our link in seconds.  So if our latency is 30 milliseconds we will use 0.030 in our calculation.

                                    524288 bits / 0.030 seconds = 17476266 bits per second throughput = 17.4 Mbps maximum possible throughput

                                    So, although I may have a 1GE link between these Data Centers I should not expect any more than 17Mbps when transferring a file between two servers, given the TCP window size and latency.

                                    What can you do to make it faster?  Increase the TCP window size and/or reduce latency.

                                    To increase the TCP window size you can make manual adjustments on each individual server to negotiate a larger window size.  This leads to the obvious question:  What size TCP window should you use?  We can use the reverse of the calculation above to determine optimal TCP window size.

                                    Link here:

                                    http://bradhedlund.com/2008/12/19/how-to-calculate-tcp-throughput-for-long-distance-links/

                                    1 Reply Last reply Reply Quote 0
                                    • C
                                      coachmark2
                                      last edited by

                                      ;D

                                      Kudos to you for the explanation! I appreciate it.

                                      We'll consider this problem "explained"… perhaps not solved, but definitely understood better now.

                                      Thank you both.

                                      1 Reply Last reply Reply Quote 0
                                      • P
                                        phil.davis
                                        last edited by

                                        @coachmark2:

                                        Interesting. Setting a very large window size (10Megabytes) yields 25 mbit/s….. What you say seems to be the case. :)

                                        Anything PFSense side that should be modified?

                                        TCP window size is an end-to-end client parameter of the TCP session they establish. Routers and firewalls… in the session path do not mess with that. So you need to make any settings at the client node on each end.
                                        I remember messing with this many years ago to optimize single-session use of 4Mbps circuits many years ago! Now that people want 100Mbps transfer rates there are much larger TCP window sizes needed, but I thought that modern OS networking stacks were good at sorting this out automagically underneath.

                                        As the Greek philosopher Isosceles used to say, "There are 3 sides to every triangle."
                                        If I helped you, then help someone else - buy someone a gift from the INF catalog http://secure.inf.org/gifts/usd/

                                        1 Reply Last reply Reply Quote 0
                                        • K
                                          kejianshi
                                          last edited by

                                          Assuming you own both the servers and clients, the link includes how to calculate best settings.  However, you will be sacrificing performance for either the near connections or the far.  Ehhhhhh…  I just use a client that opens multiple simultaneously TCP links for a single file download to max out my available bandwidth.

                                          Hope you can optimize you settings.

                                          1 Reply Last reply Reply Quote 0
                                          • C
                                            coachmark2
                                            last edited by

                                            Is there a client or protocol that you'd recommend? Maybe good 'ole FTP over TLS or something… :)

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.