How does azure websites with EF migrations ensure integrity when updating

Viewed 579

The scenario is simple: using EF code first migrations, with multiple azure website instances, decent size DB like 100GB (assuming azure SQL), lots of active concurrent users..say 20k for the heck of it.

Goal: push out update, with active users, keep integrity while upgrading.

I've sifted through all the docs I can find. However the core details seem to be missing or I'm blatantly overlooking them. When Azure receives an update request via FTP/git/tfs, how does it process the update? What does it do with active users? For example, does it freeze incoming requests to all instances, let items already processing finish, upgrade/replace each instance, let EF migrations process, then let traffics start again? If it upgrades/refreshes all instances simultaneously, how does it ensure EF migrations run only once? If it refreshes instances live in a rolling upgrade process (upgrade 1 at a time with no inbound traffic freeze), how could it ensure integrity since instances in the older state would/could potentially break?

The main question, what is the real process after it receives the request to update? What are the recommendations for updating a live website?

3 Answers

I was watching a "Fundamentals" course on Pluralsight and this was touched upon. If you have 3 sites, Azure will take one offline and upgrade that, and then when ready restart it. At that point, the other 2 instances get taken off-line and your upgraded insance will start, thus running your schema changes.

When those 2 come back the EF migrations would already have been run, thus your sites are back.

In theory then it all sounds like it should work, although depending upon how much EF migrations need running, requests may be delayed.

However, the comment from the author was that in this scenario (i.e. making schema changes) you should consider if your website can run in this situation. The suggestion being that you either need to make your code work with both old and new schemas, or show a "maintenance system down page".

The summary seems to be that depending on what you are actually upgrading, this will impact and affect your choices and method of deployment.

Related