TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: How do big web sites roll out new versions?

110 pointsby Bluem00over 16 years ago
The operations of <i>big</i> websites fascinate me. Sites such as http://highscalability.com/ give an glimpse into the architecture of Amazon, Twitter, and other large systems, but leave out the operations side. So, can anyone explain how they deploy new versions of their sites? For instance, I can't imagine Amazon choosing to go down for even a minute, so what do they do? Am I wrong? Thanks!

12 comments

gaiusover 16 years ago
They'll take a few webservers and their associated middle tier boxes out of service on their front-end loadbalancers, wait for all the sessions to migrate/fail over to others, upgrade them and put them back into service. The loadbalancers will be smart enough to do affinity (put this customer onto this pool of servers if possible). At any one time after the roll-out begins, x% of the customer base will be on the new code where x-&#62;100 if things go well, or if something unexpected happens, (100-x)% of customers will never even see it, and the rest (x &#60;&#60; 100) will see only a glitch before the loadbalancers swing them back across onto the old code.<p>In apps like this the policy is to only <i>add</i> columns to tables and new tables, never to remove anything, so the database can be upgraded hot, and the old code can continue to run on it, only the new code will see any new columns/tables.
评论 #411775 未加载
评论 #411365 未加载
评论 #411614 未加载
评论 #411682 未加载
seldoover 16 years ago
For a moderate-sized upgrade, the description given by gaius is pretty accurate. Working at Yahoo, I've been around for a couple pretty huge property changes, and then the deployment process is very different.<p>Basically, hardware is much cheaper than downtime, and very big web companies have lots more money. So we don't swap out old servers gradually: instead we buy and set up an entirely new set of servers, deploy to them several weeks in advance of the planned launch, and run QA against these production-level boxes. Then, when we are ready to "launch", all we're really doing is a relatively low-risk DNS change: all the potentially tricky deployment issues having been ironed out beforehand.<p>After a couple of weeks/months of operation on the new hardware, if there have been no major problems, the old boxes are decommissioned -- either re-imaged and put back into service to expand capacity, or more often taken out of service entirely (I've no idea what we do with old boxes when we stop using them, funnily enough).
评论 #411556 未加载
评论 #411696 未加载
评论 #412376 未加载
brianmover 16 years ago
You roll out incrementally, and keep interfaces between components backwards compatible for all versions presently out and any you may need to roll back to, if you possibly can.<p>When you cannot, I, personally, believe in partitioning traffic across concurrent versions. This can be done dynamically or statically -- really it depends on the nature of your system, in general something will stand out as obviously right for your situation.<p>To take an example, if your service is primarily user centric, you can partition the system by user and roll out accordingly. Let's say you have four interacting systems: a font end proxy which understands the partition boundaries, an appserver, a caching system, and a database -- pretty typical.<p>The front end proxy in this system is shared by all users (this need not always be true as you can do subdomain and dns games, but that is a different major headache), but everything behind it can be dedicated to the partition (this is not necessarily efficient, but it is easy).<p>Now, let's say we need to make a backwards-incompatible,coordinated change to the appserver and databases associated with the partition. As we cannot roll these atomically without downtime we pick an order, let's say appserver first. In this case we will wind up rolling two actual changes to the appserver and one to the databases.<p>The appserver will go from A (the initial) to an A' which is compatible with both A and B databases, then the databases will go from A to B, and the appservers from A' to B. You'll do this on one small partition and once done, let it bake for a while. After that, you'll roll the same across more. Typically going to exponentially more of the system (ie, 1 partition, 2 partitions, 4 partitions, 8 partitions, etc).<p>This means you have a, hopefully short lived, interim release of one or more components, which is probably grossly inefficient, but you wind up in a stable state when complete. The cost of doing this is not pleasant, as you basically triple QA time (final state, interim state, two upgrade transitions) and add a non-trivial chunk of development time (interim state). That said, this is why most folks just take the downtime until the cost of the downtime is greater than cost of extra development.<p>This is, of course, a pain in the ass to coordinate. It is easy to do with relatively small big systems (less than a few hundred servers, say, assuming you have good deployment automation), and probably the pain of coordinating is still less than the pain of baking component versioning into everything... for a while.<p>An alternate model, which requires significantly more up front investment, is to support this in a multi-tenant system where you don't (for upgrade purposes) dedicate a clone of the system to each partition. Instead you can bake version awareness into service discovery and dynamically route requests accordingly.<p>A very traditional (of the blue-suited variety) is to use an MQ system for all RPCs and tag versioning into the request, then select from the queue incorporating the version. This makes the upgrade almost trivial from a code-execution point of view, and can even help with data migration as you can queue up updates during the intermediate state database and play a catch-up game to flip over to the end state database. This is the subject for a blog post, though, rather than a comment, as it is kind of hairy :-)
Tangurenaover 16 years ago
Here is basically what one of our big financial clients [1] does twice per year:<p>Integration, or sytem testing had taken place over the previous 1-2 month period.<p>They have 2 large datacenters, let's call one "production" and the other one "disaster recovery" (abbreviated "DR"). Between these and the internet are some large routers (the Cisco ones that cost about what a house costs). At the beginning of "migration" the routers are switched to point from production to DR, so that all internet traffic points to DR.<p>At this time, the servers are being updated with the new code. This can take some time, especially if large databases need to be restored as part of the migration, or if the update scripts take a long time. There are a lot of servers involved, a ballpark is about 100 servers: some Sun, some WinTel, some IBM mainframes. Some mirrored, some clustered, some all by their little old lonesome. Some applications are Java, some .NET, and some Cobol[2].<p>Approximate timeline [3]:<p>People start dialing into the main conference call about 5:30PM eastern [4].<p>Switch to DR about 6pm eastern.<p>Code in production is migrated/installed, servers rebooted if necessary. Done about 9-11pm eastern.<p>Testing [5] starts and continues until about 3AM.<p>GO/NO-GO decision is made sometime between 3 and 4AM[6].<p>Rollback if necessary.<p>Switch routers to point to production at 6AM.<p>Preliminary postmortem report generally done by 2PM.<p>If no rollback, then repeat the following evening for DR.<p>Notes: 1 - They're a Fortune 100 company, I'm not telling who they are.<p>2 - That I'm aware of. It would not surprise me at all that there are a number of other "brands" of servers or programming languages involved.<p>3 - The actual timeline is usually a spreadsheet that's at a minimum, 50 pages long, plus about 10 more pages of first, second and third contacts in case something bursts into flames.<p>4 - It is common to have 100+ people monitoring the main conference line, and 1-2 dozen other conference lines used for individual components/products. One has to be awake and alert in case you're "called out" on the conference line.<p>5 - In general, because the main URL/URI/Hostnames are now pointing to DR, hosts files are changed so that configuration files don't get edited.<p>6 - Sometimes the decision gets delayed until almost 6AM if there are some problems.
cheez80over 16 years ago
i remember reading somewhere that ebay changed the background color of their homepage from gray to white, gradually, over 6 months, as not to alienate customers who were used to the gray. can't provide links, and sorry because this isn't really related. i just thought that was interesting. :)
评论 #411621 未加载
jonursenbachover 16 years ago
When I worked at a fairly large "adult dating" website, we would:<p>1) Up the code from our development environment to our staging server.<p>2) Personally test the shit out of it. We didn't have any QA people, so have fun finding your own bugs after looking at the same screen for X minutes/hours/days/weeks.<p>3) When all is good, have one of the senior developers run our sync script which would rsync the code off of our staging server to our master production server into a directory called something like: live_20081228.<p>4) Log into the master production server and run another sync script that would copy the code from the folder created in step #3 into the live directory. Sync script would then sync that directory to all of our other production servers.<p>5) If there's problems: 5a) Immediately roll back 5b) Pray that you still have a job.<p>The process, overall, was pretty terrible and allowed for a lot of problems to arise (which happened regularly).
aristusover 16 years ago
From their whitepapers you get the sense that much of the point of Amazon Dynamo, Google Protocol Buffers and BigTable, YAHOO PNUTS and UDB, Facebook Thrift objects, etc is to release big systems from the tyranny of the SQL schema.<p>When you can run multiple versions of code against the same dataset, upgrading the application layer one bit at a time becomes much easier.
tlrobinsonover 16 years ago
Here's a couple of interesting videos, obviously very specific to the particular apps:<p>"Developing Erlang at Yahoo" <a href="http://bayfp.blip.tv/file/1281369/" rel="nofollow">http://bayfp.blip.tv/file/1281369/</a> - Talks about the transition of Delicious from Perl to Erlang, including live migrations of the DB.<p>"Taking Large-Scale Applications Offline" <a href="http://www.youtube.com/watch?v=cePFlJ8sGj4" rel="nofollow">http://www.youtube.com/watch?v=cePFlJ8sGj4</a> - in particular, the section on "Versioning and phased rollouts: what to do when you can't assume all servers have the same code"
评论 #412385 未加载
bjclarkover 16 years ago
It's totally different for different types of sites. Facebook is different than Amazon is different than Yahoo is different than Flickr.<p>In general, I'd say, most sites data is sharded or clustered. Amazon, I'm guessing, basically has many many different instances of their app running on different clusters all over the world (multiple clusters per datacenter). So they upgrade a cluster at a time, and their databases all synchronize with others of the same version.<p>Facebook's data is, obviously, sharded by network. So any given cluster runs x number of networks. Upgrades are then, again i'm guessing here, rolled out network by network. The data layer can be different from network to network.<p>Most of the time though, updates to large scale services aren't changing db schemas or making huge changes to the data layer, so it's as simple as updating the code and rebooting some app servers.<p>(Obviously I don't know exactly how they do it, cause I don't work at any of these places, but deploying it's that hard of a problem to solve)
评论 #411354 未加载
pmjordanover 16 years ago
Gradually. Except in very rare circumstances, not every visitor has to see the changes immediately. The main challenge is consistency of the data model, which should be separate from the presentation layer anyway, in an MVC-stylee. If you can upgrade the data model without affecting existing versions of the presentation layer, your presentation layer can be rolled out gradually.
wesleyover 16 years ago
Haven't done anything of the like, but perhaps using something like apache mod_proxy to redirect visitors to machines that are already updated?
评论 #411402 未加载
SingAlongover 16 years ago
Well, when Google App Engine comes into play, this problem isn't big. They have something called versioning (in the admin panel) which allows you to change the app to the next version or revert back to an old version.<p>From an amateur POV: But when usual servers come into play, I have had no clue abt big ones.<p>Infact a couple of months back, when my home server had a burst of traffic from my mobile app, it couldn't handle it (256kbps connection, 256MB ram with a 1.3 GHz P3 processor. well suited to serve a high bandwidth mobile app of 1000 users and also for constantly collecting data from APIs). But due to sudden traffic outburst, I had to string a friend's comp to mine.<p>My procedure: I first stopped updating data from APIs to my DB and kept it static. No updating the DB. Copied it to my friend's fast comp. I had my computer interfaced with a mobile which accepts input from the user mobile phones. That was the app's requirement. So I had an advantage of lining up requests right there in the mobile phone while I was switching the server. That trick should help if you are developing a mobile app on a very limited resource (a hobby project).