August 8, 2012

Scalability : Architecting for the Cloud - A Different Ball Game

Architecting an application has always been a challenge for the very fact that any mistakes done at this level can have catastrophic effects on the whole application. Several applications/ products have gone through lot of rework, re-engineering and in some cases have been sunset purely because of the short comings in its architecture.

Cloud computing all together provides a different dimension of designing, developing and deploying your applications. Along with this comes lot more challenges for an Architect to make the right decisions that can help them build a concrete scalable architecture.

While there are several aspects involved in architecting a solution, in this article we will focus on the - Scalability aspect. We will look at how each of the layers in an application can be designed for scalability and how cloud computing can be leveraged to achieve the same. We will also touch upon performance aspects wherever it is required.

One of the biggest advantages offered by cloud computing is the scalability factor. In a traditional model architects used to spend considerable amount of time in designing scale-up and scale-out solutions. This is also due to the fact that significant investments are being made on the hardware platform and hence, they want to be absolutely sure that the investment stands good for the coming years.

Lets look at each of the layers and how cloud computing can help you achieve this factor

Application Scalability
Cloud Computing simply takes off this overhead from the Architect/Organization by providing on-demand (elastic) computing resources on the fly. The role of the architect now is to determine the right cloud vendor who can offer the level of scalability expected by the product. Cloud computing resources are available in different units like Extra Small, Small, Medium, Large, Extra large there by providing high level of flexibility to upgrade or add any number of units. Some of the cloud vendors provide Auto Scalability feature which allows you to even set a threshold value, and once the value is crossed new hardware is provisioned and the application instance is automatically launched on the new hardware. For example: Amazon platform provides Cloud Watch and Azure provides Azure Watch - for Auto Scalability. The Architects will now have to focus only on the scalability especially on the ability to scale out within the application code.

One important point to be considered in application scalability is the state maintenance of the application and more importantly to avoid usage of internal memory for any persistence. Hence, it becomes necessary to adopt a distributed caching mechanism for persist any data that needs high performance and quicker access. Azure offers azure fabric cache and Amazon offers elastic cache for achieving the same.

Database Scalability
Majority of the leading cloud providers offer a no-sql database which offers unlimited scalability. If the application expects large volume of data it is better to opt for this as it moves the pain of designing and coding for scalability away from the developers. However, choosing a no-sql database has its own complexity in programming as it compels the developer to take care of querying, updating - data as well as managing the relational consistencies. Hence, the architect has to weigh the need of scalability vs ease of programming to choose a solution.The cloud providers also offer a flavor of RDBMS such as SQL Azure and Amazon RDS. In this case the architects/developers need to take care of data sharding/ partitioning to achieve scalability. Cloud providers would eventually bring in the features to make this seamless like for example SQLAzure federation (once it is released) will take away the complexity of sharding from the developers. Till then the application architecture needs to handle this.

Data intensive and process intensive operations
Some of the cloud providers offer features to effectively compute data intensive processes for example elastic map reduce from Amazon offers the service to cost-effectively process large amount of data with higher performance. Azure for instance has separate role called worker roles which should be used to process long running jobs in asynchronous manner. The application architecture should identify data intensive and process intensive jobs and utilize such frameworks.

Static Content Delivery
Cloud providers provide content delivery network using which static content can be delivered from closest geo location. This can boost the performance of rendering media files, images and any static content. The providers take care of the availability of the contents by automatic replication across multiple geographic locations so that the content gets delivered from the closest geo location. Cloud Front and CDN are the technologies provided by Amazon and Azure respectively to support static content delivery.

Few more best practices:
Design application to minimize bandwidth requirement both inbound and outbound for better performance and cost. For example, avoid chatty interfaces while exposing web services, use compression techniques to compress large pages.Group your instances so that they are collocated to achieve better performance and save cost. For example in azure you can provide the affinity group to keep your instances together.

Understand and analyze the limitations (if any) of the cloud provider before making your final decision. For ex: SQL Azure supports only 50GB per database. While this may not be a constraint for many applications its important for an architect to be aware of this information.

No comments: