Iis – Strategy for zero downtime rollouts: what about the DB

arrdeploymentiis

We have an asp.net/MVC2 web app hosted on Amazon windows IIS7 that I would like to deploy updates to with as little downtime as possible.

Building on IIS ARR 3-site setup as described here Zero downtime uploads / Rollback in IIS I would like to come up with a way to deploy my database updates (MySQL on Amazon RDS) in a way that minimizes or eliminates downtime.

Is anyone doing anything like this? The app must be deployed against a db of the right schema version and we have a system that manages those changes during a rollout.

I can imagine using ARR to gracefully drain the live site and bring up the newly-provisioned site while simultaneously running the db migrations and having the new app hold processing of web requests until the db changes were done but that seems very hard to coordinate timing on and even harder to test, not to mention the issue of client timeouts if the process takes longer than the browser wants to wait.

Thanks!

Best Answer

Nobody has a great answer for this. You have to make backwards-compatible schema changes, however hard that may be.

Typically this means that your app can't just depend on one schema version, but needs to be able to support multiple schemas during the transition. (Your transactions should update both schemas, etc.)

Note that even NoSQL schema-less datastores don't solve this problem, but rather require you to solve it, in much the same way: if you have a key with N values, and you need to add a new value, your app needs to deal with the possibility that the key might not be updated yet.

Good luck!