Has anyone tweaked (or optimized) TCP settings for your Windows trading PC?

Discussion in 'Trading Software' started by isaac000, Aug 24, 2008.

  1. I am wondering if optimizing your TCP settings would be helpful to certain trading software, for example, for someone that sends a lot of orders through API with TWS, etc.

    It looks like there are quite a few settings that could effect your network performance (MTU, Selective ACKs, Max duplicate ACKs, MaxConnectionsPerServer....just to name a few) . I came across several free TCP optimizers. I downloaded one of them called SG TCP Optimizer. It shows your current TCP settings and also recommends optimal TCP setting for your PC. I haven't changed any of those settings yet because I don't want to screw it up. I would like to hear from others who have optimized (or messed with) those TCP setting, and if the results were positive.
  2. I've changed my settings to "optimal" many times on several machines. Never caused a problem, though can't say as I've ever noticed any difference in performance.
  3. I would suggest: If you don't know what they are, then don't play with them.

    Things like the MTU are set by somebody other than you. I mean the MTU is between you and your Internet connection provider. An MTU of 16,000 is great...if you are close to the source and your provider can handle it...but, will really SUCK if you set your side to 16,000 and they are still around 1,500. There are other settings that could interrupt your actual connection...not just because your connection couldn't provide it, but because you may have a firewall that couldn't handle it. Something like adjusting SYNs and ACKs could be one of them. Hope this helps!

  4. OK, we know that the 'optimal' could give us a decent setup but what about using the BDP tab to optimize a TCP connection specifically for IB or a TT feed, for example? or the largest MTU using the IP of the remote feed (or a proxy)?
  5. Just my thought...

    Tweaking your rig to accomodate a specific feed has far more insidious implications than a generalized tweek.

    ANY, and I mean any changes made to the feed, on the feed end, can have major impact on you.

    Here's a slightly-off, nonetheless well-related example...

    IQFeed recently made some changes to the coding used for quotes for some CBOT symbols, such as YM and a few others. Ensign software broke (just for the affected symbols). The problem was hot-fixed over the phone in minutes, at least for me. The following day a new release of Ensign was released incorporating the fix.

    In my experience, general TCP tweeks are not noticable. Maybe just a rear-view mirror hanging air freshener, but that new car smell nonetheless.
  6. bronks


    Cut and paste article:

    ""I've seen those programs before and I've found that they've been basically junk. The fact that they are recommending a window of 256960 just proves my point. Oftentimes they butcher the TCP/IP stack in the O/S so badly it needs to be returned to stock.

    There's a lot of things to know about choosing the best RWIN and most of that information has been put up on the site. There's also a page that's almost completed :rolleyes: about the finer points of tuning which covers important issues that I've never heard mentioned before - mostly because people don't really understand how a packet-switched network works.

    Too large of a receive window means that when data is lost it will have to resend a larger amount of data all over again. That means that there is a point where RWIN sizing becomes too large and performance suffers. This is why I recommend a 64240 RWIN for most people. Generally speaking it offers the best performance without going too far (like 256960).

    From the grid page on the site, "In order to achieve maximum efficiency the RWIN size should not be an arbitrary value. It should always be an even multiple of the Ethernet Maximum Segment size (1460). You can use any value - but the ones listed below will be the most efficient and give you the best speed. Don't forget to re-boot your computer for the changes to take effect."

    You may wish to take a look at the white paper by Fisk et al on the downloads page for more information on modifying the TCP/IP window size. It's a really great short paper that covers a lot of ground.

    I never recommend testing against any servers except Microsoft's. This is covered on the testing page on the front of the site. It's just foolish to test against geographically close servers of questionable load. You can't get more geographically close then testing against an internal server like Shaw's. You are not even on the Internet at that point. It just doesn't make sense when most of a person's surfing is done outside the Shaw network on the Internet :)

    You can test against the Shaw speed test (if you really want to) whether you use the Proxy server or not. I always recommend using the the proxy server because it will increase speed for probably 75% (or more) of general web surfing. There's been many times where I've hit sites (without the proxy) where it's exactly the same as viewing it with a 28.8 modem because the server is nearly dead or the networks going to it are overloaded. With a proxy server it will be back to instant - even when the server is nearly dead.

    The only network I've found that is not beneficial to run the proxy server on is Microsoft's. Their network is so high end and professional that using Shaw's proxy server on it actually slows down the speed. A person can use the Proxy server and also add an exclusion to it so that *.microsoft.com is not connected to with the Proxy even when everything else is. That way you don't have to turn off the Proxy server setting - you just add in whatever sites you want to exclude.

    Checking on my site's speed ranking from Alexa shows that it's really slow. In fact they say that 83% of the sites on the Internet are faster then mine! I never see that slowdown because I use the Proxy Server. There's some pictures on the site in the Proxy Server Section that make it pretty clear why using the Proxy Server is faster. 99% of the speed testing sites out there will firmly tell you a Proxy Server is a bad idea but look at the pictures and judge for yourself :)

    Anyway, there's a whole lot to it but the easiest thing is to choose an RWIN between 64240 and 99280. That's the sweet spot for most connections but you'll not see much difference and that's only if you are testing against a good server like Microsoft's.

    The bottom line is this. You can't adjust your system for top speed everytime no matter what. This is because the Internet's speed and latency change all the time. The Internet is a TCP/IP network which means it takes the path of least resistance every time to get to the destination. That means that your traffic could go 20 million different ways to the destination you are trying to reach. That server on the other end will experience radical speed and load changes while you test against it.

    The other big issue is that you are not surfing one site (server) only - you are going to different sites every day. That means that your perfect settings have now gone out the window (pun intended) because of the extreme differences in the server and the network path needed to get there.

    So, if you really wanted a 'perfect' connection you would have to have a private network between your computer and it's destination. That way you could bench test the perfect RWIN setting for that specific network and machine. Catch my drift? It's impossible to get the perfect RWIN. This is why I come back to 64240 for most everyone. It's easiest and shows the most bang for the buck for older Microsoft Operating Systems (Windows 98 and earlier). Windows 2000 & XP really don't need tweaking because their TCP/IP stack is much more optimized for higher speed networks.

    If you're with me so far then you should be able to see the benefit of the Proxy Server. It's typically geographically close to your computer and in Shaw's case well managed (not bogged down). So, without the Proxy Server you are connecting to millions of different networks and servers to such an extent that you cannot possibly tune against them as they are too diverse.

    But the Proxy is a whole different story. You can tune against it because it's reliable and close by. Generally speaking your traffic will take the same path to it every time - so the network is very reliable. Generally speaking the machine is reliable - so you can tune against it.

    The net result is that the smartest thing a guy can do is use the Proxy Server at all times and just exclude the sites that are faster without then with it (microsoft mostly). At that point you can test your RWIN settings in an effort to get the best one and it will be the best one 75% of the time because you've based your tuned settings on using the same network and machine - each and every time. This is as close as you can get to the 'best case' scenario I mentioned earlier which is your own private network connecting to one machine only.

    When you use the Proxy Server your home computer is connecting to it - every time. So even when you type in www.microsoft.com in your web browser - you aren't going to Redmond Washington - you are going to the Proxy Server. From that point it serves you the Microsoft content - not the Microsoft server. So you are getting all your data from one machine that is close to you on a well managed network and your data will more then likely take the same path to it every time. That consistency makes it the best metric for tuning your RWIN setting B)

    One more important thing... Every 'speed test' site out there will post their results in a different unit of measure which an apples to apples comparison impossible and leads to widespread confusion. The best way to test is to use IE and download a file from a good server (like Microsoft's) and report that figure. That way we are all on the same page and have an apples to apples comparison.

    For the record, I routinely see 500K (as reported by IE) on my standard residential line. Late last night I was seeing 800K at times for decent periods. That's smokin' fast. Also for the record, that's with an unmodified newly installed Windows 200 Operating System. No RWIN tweaks and no Proxy and those speeds came off Microsoft servers (the links I have on the Testing Page).

    Pretty cool eh? :)

    Anyway, I hope I haven't overwhelmed you with a long winded post but I've been through the 'speed tweak' thing so many times now it's becoming second nature :lol: ""

  7. Win2K? When you upgrading to Vista? Sheesh!
  8. bronks


    Man, I really gotta start looking at the date of crap I post.
  9. From the Tweak portion of DSL Reports.com


    Vista TCP tuning (tweaking) is NOT advisable. The Vista TCP stack does a reasonable job of tuning the receive window dynamically, there are no known registry tweaks that would optimize Vista better than its default configuration."
  10. Nice. But does XP with SP3 tune the TCP settings dynamically?
    #10     Aug 26, 2008