Monday, 16 July 2012

Cloud–Application Migration Experiences

Just finished a public facing capital markets portal migration to cloud.  A quick background the application provides advisory services in capital markets to about 100k users and architecturally built on the Microsoft stack of ASP.NET MVC 3 , Entity FW , WCF , Sql Server and involved the complexity of a service bus built on ESB toolkit for integrating with third party application for pure data pull & BI and dash boarding capability used were third party. Additionally a lot of third party controls used. Source Code Repository and Build Management was Team Foundation Server. The application evolved over a period of 3 years and deployment standpoint a DC and fully functional DR. The DC had roughly 4 Web Front End Server(inclusive of Reporting) , 2 Application Server, 2 Database Server clustered in an Active / Passive Model.
Agile was followed and overall estimation initially had been at 18 weeks with 4 releases. The actual completion took 22 weeks 3 major releases and 3 minor releases.
Cloud another disruptive technology, my heartfelt sympathies for developers. I too am a part of the same brigade. Cloud is indeed the biggest disruptive technology which has come in. The developers are at yet another unlearn and learn curve. This one is strangely different from the last one been Web where the developer had to move out of the client server era into a 3 tier one which pretty much got the developers to learn html, client side and server programming and whole variety of incremental education coming in. Cloud presents a new challenge following are some of my thoughts. What I’m penning down is what has journey been through this the pain areas and blind curves.
The application that we have written is about 3 years in functioning and an n-tiered applications. These application run in the companies data centers controlled by the infrastructure folks, now the applications are hosted in an unknown location depending on which deployment model of cloud we are targeting the re-architecting can vary from a complete rewrite to simple migration.  The complete application had to be re architected piece meal wise to suit the customer needs based on feature priority.
The First choice ideally would be to move the application to PAAS (ex: Azure or Amazon), some key considerations which need to be taken into account are
    • Decomposing the architecture into web and worker role. The web and worker role are stateless and loosely coupled which means rewriting the communication across the web and worker some example are rudimentary queues.
    • State Management is an area which needs special attention. Thumb Rule: Everything in cloud is stateless.There are multiple strategies on how to manage state in cloud common cache etc..
    • Third party controls are not welcome , Have addressed the work around’s this.  Some applications which really required the third party controls not web these are business specific were hosted on VM i.e Persistent VM offering by Azure, which allowed us to install whatever was required and keep the state. These VM were easily accessible to the other web and worker role VM.
    • MVC Revamp: If one is using MVC frameworks which by the way is the defacto standard for web based application today, the wiring between the controller and view may need to be looked back into. The model which is existential surface for objects has to be stateless. The database is no more relational not a compulsion one can still end up using relational but the motto is go No Sql. The datastore can vary anything from blobs, table (not relational store), hadoop or a relational store. This means a new Object Cloud Store Mapper framework.  Written an Object to Cloud Store Mapper framework will soon be sharing it as open source. The framework can work across multiple types of storage provided by Amazon, Azure , on Premise Database Server. CQRS Pattern had been implemented for faster reads.I think it helped.
    • Services Layer: If the application has a well defined services layer which serves the integration need there is good news all PAAS offering have a good enough Service Bus.
    • Identity Management:  Most PAAS have well defined authentication and authorization policies with federated choices like  authenticating with an on premise Active Directory, LDAP, Facebook, Google… The application needs small effort to support the cloud identity management.
    • Storage:  The storage options in the cloud are many ranging from non relational blobs, tables, hadoop to relational Sql Azure.
    • Data Migration: From on premise sql to sql azure was straight forward.
    • Resources Accountability:  A close watch on the code written is needed in terms how much Compute, Memory, Network & Storage(CMNS) static code analysis can assist in code clean up. Every useless instruction which gets execute is compute. The costing model on the cloud is based on CMNS.
    • User Interface: This is a big area, Although not cloud a lot has changed in this area in last 2 years, with introduction of various device types the tablet, the smart phone and browser innovations to HTML 5, Metro style UI the list is endless. The new mantra in UI is interactive designs this can change the programming model largely. HTML 5 alone has brought such innovative stuff discussed later.  The User Interface has been redesigned with more interactive design to suit multiple form factors. UI needed special consideration.
    • Microsoft Application Blocks for Azure: Auto Scaling ,Transient Fault Handling Block
    • Source Code Repository:  Have used GIT and seem to work exceptionally well does the job, There was no need to go in for some expensive tool like Team Foundation Server. The GIT server was tweaked to support some IDE experience. The source code of the same can be shared.
    • Test and Staging Environment- To cut risk both these environment were setup on Azure. Had to tweak GIT to work along these environment. Performance Testing for the application was kind of crazy I still haven’t got a handle on this. I’m assuming everything will work ok its cloud after all infinite compute & storage. Still working on it will update when we close this.
I’m trying to see if I can share the artifacts and source code for framework as open source. Lets hope.