\u003C/a>\n\nThe most recent changes were all in the name of redundancy:\n\n\u003Cul>\n \u003Cli>move to dual \u003Ca href=\"http://haproxy.1wt.eu/\">HAProxy\u003C/a> routing instances\u003C/li>\n \u003Cli>add a third Stack Overflow server to the HAProxy rotation to handle steadily growing site traffic\u003C/li>\n \u003Cli>push our static content (\u003Ca href=\"http://sstatic.net\">sstatic.net\u003C/a>), which is shared amongst all Trilogy sites, to five different servers\u003C/li>\n \u003Cli>take advantage of our datacenter's ability to deliver dual switched connections to the internet\u003C/li>\n\u003C/ul>\n\nThe last part is in reference to \u003Ca href=\"http://blog.stackoverflow.com/2009/10/stack-overflow-outage/\">an unfortunate recent switch outage at PEAK\u003C/a>, our datacenter provider. It was handled swiftly, but now there is no longer a single point of failure upstream of us at \u003Ca href=\"http://www.peakinternet.com/business/hosting/colocation-dedicated#\">PEAK\u003C/a> -- we're being served by two different switches on two different internet connections. Kudos to PEAK for not only handling this rapidly at the time, but also more permanently fixing it in a way that makes it less likely to happen \u003Cem>next\u003C/em> time.\n\nWhat motivated a lot of this was a little scare we had about a week ago. The single server that hosted our single HAProxy instance and the sstatic.net content experienced some kind of bizarre, one-time, and still-unexplainable (edit: \u003Ca href=\"http://blog.stackoverflow.com/2010/01/six-whys-or-never-trust-your-network-switch/\">now explained\u003C/a>) networking issue. This sounds minor, and it should have been, but it was a major bummer in actuality because \u003Cstrong>having that \u003Cem>one\u003C/em> server become unavailable on the network effectively took out every single site we run\u003C/strong> with the exception of Careers. We sure lost the server lottery on that one.\n\n\u003Ca href=\"http://www.shipmentoffail.com/fails/2008/01/star-wars-fail/\">\u003Cimg src=\"http://stackoverflow.blog/wp-content/uploads/2017/02/TfgnD.jpg\" alt=\"\" />\u003C/a>\n\nNot good, obviously.\n\nWe redoubled our efforts to become more redundant. We recently added a sixth 1U web tier machine so \u003Ca href=\"http://blog.stackoverflow.com/2009/12/stack-overflow-rack-glamour-shots/\">our server rack\u003C/a> is now completely full. We have \u003Cstrong>way, way more server power than we need\u003C/strong>. That's 6 very capable web tier boxes and 2 beefy database tier boxes all told. Each ready and willing to dynamically share whatever load we want them to. We just had to figure out how to do it.\n\nWe're big fans of \u003Ca href=\"http://haproxy.1wt.eu/\">HAProxy\u003C/a>, which \u003Ca href=\"http://blog.stackoverflow.com/2008/10/podcast-27/\">the guys at Reddit turned us on to\u003C/a>. It has been working flawlessly for us in \u003Ca href=\"http://blog.stackoverflow.com/2009/09/load-balancing-stack-overflow/\">load balancing Stack Overflow\u003C/a> between two -- and now \u003Cem>three\u003C/em> -- servers. We currently use \u003Cstrong>IP-hash based routing\u003C/strong> to determine which server visitors to stackoverflow.com end up on. This helps improve local server cache hit ratios, as users \"stick\" to the same server for as long as they hold the same IP address. (No, we don't use a shared server farm memory cache like Memcached or Velocity quite yet.) While this works, it does lead to some slightly imbalanced loads, particularly when single-IP whales like Google thunder through your neighborhood. We found that going from two to three servers produced a surprisingly large improvement in server load balance, even with our less-than-optimal IP hash routing choice.\n\nHAProxy is a proven solution for us. But we needed some way of using \u003Cem>two\u003C/em> HAProxies -- on two different servers.\n\nGeoff did some research and came up with \u003Ca href=\"http://www.linux-ha.org/wiki/Heartbeat\">Heartbeat\u003C/a>, which is a part of \u003Ca href=\"http://www.linux-ha.org/wiki/Main_Page\">Linux-HA\u003C/a>. This works by \"sharing\" one IP between two machines (in this case, two Linux virtual machines). It dynamically switches the IP from one server to the other when the heartbeat times out. We now have this set up and it works brilliantly; shut down one of the two VMs and within two \u003Ccode>ping -t\u003C/code> cycles, that IP address is automagically and seamlessly switched to the other VM. There is a very brief interruption of service during this switchover, but it's no more than a few seconds.\n\nWe also moved our \u003Ca href=\"http://sstatic.net\">sstatic.net\u003C/a> shared content from living on a single webserver, to living on five different webservers. Our dual HAProxy instance is also responsible for routing sstatic.net traffic -- as visitors request sstatic.net files, those requests are served in perfect round-robin fashion by whichever of the 5 webservers HAProxy sees as alive at the moment.\n\nGiven that these HAProxy instances are super-critical not only to Stack Overflow but every site in the trilogy (because they serve shared static content), \u003Cstrong>we need constant reassurance that they're healthy\u003C/strong>. We already use \u003Ca href=\"http://www.pingdom.com/\">Pingdom\u003C/a> as an external monitor and alert service for our existing websites, so we added our HAProxy instances to the mix with an aggressive ping schedule. If something bad happens to either HAProxy instance, we should know about it within a few minutes.\n\nThere might have been some momentary interruptions in service while we set this all up, so our apologies for that. But the net result is a more resilient, more reliable Stack Overflow and friends for you!\n\nWe know the importance of building a secure, reliable network. Companies are continuously searching for the network experts to manage this crucial task. Check out our listings for the latest \u003Ca href=\"https://stackoverflow.com/jobs/developer-jobs-using-networking?utm_source=so-owned&utm_medium=blog&utm_campaign=dev-c4al&utm_content=c4al-link\" target=\"_blank\" rel=\"noopener\">network engineer jobs\u003C/a>.","html","2010-01-14T12:00:00.000Z",{"current":384},"stack-overflow-network-configuration",[386,394,399],{"_createdAt":387,"_id":388,"_rev":389,"_type":390,"_updatedAt":387,"slug":391,"title":393},"2023-05-23T16:43:21Z","wp-tagcat-background","9HpbCsT2tq0xwozQfkc4ih","blogTag",{"current":392},"background","Background",{"_createdAt":387,"_id":395,"_rev":389,"_type":390,"_updatedAt":387,"slug":396,"title":398},"wp-tagcat-company",{"current":397},"company","Company",{"_createdAt":387,"_id":400,"_rev":389,"_type":390,"_updatedAt":387,"slug":401,"title":403},"wp-tagcat-server",{"current":402},"server","Server","Stack Overflow Network Configuration",[406,412,418,424],{"_id":407,"publishedAt":408,"slug":409,"sponsored":375,"title":411},"e10457b6-a9f6-4aa9-90f2-d9e04eb77b7c","2025-08-27T04:40:00.000Z",{"_type":10,"current":410},"from-punch-cards-to-prompts-a-history-of-how-software-got-better","From punch cards to prompts: a history of how software got better",{"_id":413,"publishedAt":414,"slug":415,"sponsored":12,"title":417},"65472515-0b62-40d1-8b79-a62bdd2f508a","2025-08-25T16:00:00.000Z",{"_type":10,"current":416},"making-continuous-learning-work-at-work","Making continuous learning work at work",{"_id":419,"publishedAt":420,"slug":421,"sponsored":12,"title":423},"1b0bdf8c-5558-4631-80ca-40cb8e54b571","2025-08-21T14:00:25.054Z",{"_type":10,"current":422},"research-roadmap-update-august-2025","Research roadmap update, August 2025",{"_id":425,"publishedAt":426,"slug":427,"sponsored":12,"title":429},"5ff6f77f-c459-4080-b0fa-4091583af1ac","2025-08-20T14:00:00.000Z",{"_type":10,"current":428},"documents-the-architect-s-programming-language","Documents: The architect’s programming language",{"count":431,"lastTimestamp":12},0,["Reactive",433],{"$sarticleModal":378},["Set"],["ShallowReactive",436],{"sanity-RHfPQnZgZBB6zrfIGwlTwVYq_SxSW3uQ7X50ra7MG8k":-1,"sanity-comment-wp-post-3664-1756291035135":-1},"/2010/01/14/stack-overflow-network-configuration"]