The process we followed basically consisted of working through the old code base line by line and converting it to the appropriate Dot Net code. In some cases it was simply easier to run the old site, grab the generated HTML and work backwards from there.
We worked very hard for 3 months and I personally spent many weekends and 18 hour days on the project. On the last two days before going live someone made an innocent looking change to the code that went unnoticed...
When we finally took the site live, it broke spectacularly in production. We ended up having to cut back to the legacy site and the client was fairly unhappy.
Jumping forward a few days, we managed to get the site running and all seemed well until we noticed that the number of clients reaching the website that actually bought something (the conversion rate) was a lot lower than the legacy site. We threw as many people as we could find at the site as testers but we just couldn't see anything wrong.
In a last desperate attempt, before giving up, we installed Inspectlet on the site. Inspectlet allows you to play back the session of a user and see what they saw when using your site. Within an hour we managed to spot a recurring pattern of behaviour in a certain group of users. We fixed the bug and suddenly the conversion was back to normal.
What we did right
Deploy at any time of day
It is crucial that you have the ability to update your site as many times in a day as you want and at any time of day. Sometimes we deployed 10 times a day as we fixed minor bugs.You also need the ability to roll back if you got it wrong. Previously we adopted an approach of only ever rolling forward and just fixing any problems and moving on. On a high traffic public site you need to be able to recover very quickly before you go and find that bug.
Using a VIP swap on Azure cloud services gave us the ability to do deployments with zero downtime. In order to be able to do this we didn't use session state at all. This meant all our users weren't kicked off the site every time we deployed. If you need to keep track of logged in users, you can use JSON Web Tokens instead of user sessions.
Backwards compatible database scripts
In order to move from one version of the website to another with zero downtime, your database needs to be compatible with the old as well as the new version of the website. We ended up writing two scripts in some cases.One script to run now. The resulting database needs to support the current version as well as the future version of the site. This is to allow updating the database while the old version is running, rolling forward to the next version, as well as rolling back if you need to.
Another script to run later. Once you are confident that there is no chance of rolling back to the previous version, it is then safe to run the final script that breaks compatibility with the previous version.
No comments:
Post a Comment