Building apps on Windows Azure –A whole different kind of scalability or...?

<p>There's an increased demand for scalable applications the pas few years. Companies are growing and so are their datasets and computing needs. This asks for solution where software can be scaled to immense sizes. If you ask me, this is the main reason we have cloud computing today and why it has become so popular.</p><!--more--><p>There is however some kind of sentiment that if you move your application to the cloud, it will scale to a huge size without you doing anything. This is where people are missing something really important. Building scalable applications isn't about moving it to a platform like Windows Azure. It's about making the right choices, choices that either make the application scale really well or fail miserably.</p> <p>As I discovered on monday during the pre-con on TechEd 2012, there are a few things you need to do to get the most out of your Azure installation.</p> <h2>The tale of turning the knob</h2> <p>One of the things you hear a lot is "Need more power? Just turn the knob and increase the number of nodes". Yes, this solves some problems in your application. But there's more. Scaling just the computer power increases the stress on your data tier and will ultimately cause queues on the database and query failures. </p> <p>Scaling a cloud application or any application needs to be done on the application as a whole. If you increase the compute power on the application tier, you also need to increase the power on the data tier. </p> <h2>Scaling databases on Azure</h2> <p>On any regular application you would scale a database by building a database server cluster. Increase the number of machines in the cluster and thereby increase the power available to process SQL queries/commands. This may work on a traditional application, but it is different on Windows Azure. </p> <p>Microsoft is running Windows Azure on commodity hardware, which means that the servers have limited room. There's no terabytes of disk space available on a single node. Instead the data is divided among many nodes in smaller portions. As a result you cannot build databases with more than 150 gigabytes of data in them. This means that you need a different technique of scaling the database beyond this limit.</p> <p>Azure offers database sharding to scale application beyond the 150Gb limit. Azure federations is the technique that allows administrators to partition databases into different shards. The partitioning is done using so called federation keys. These are columns in your database that are marked for federation. You can configure a range for a column to determine which set of records is going into which shard. Check out the weblog of the Azure team for <a href="http://blogs.msdn.com/b/windowsazure/archive/2011/12/13/building-large-scale-elastic-database-tiers-with-sql-azure-introducing-federations.aspx">more information about this feature</a>.</p> <p>It is important that you take enough time to think about how your are going to scale your application beyond 150Gb. Some data you want to be split up into different shards, some data is best kept central or maybe even replicated between the different shards. This means that a good database design is important for a successful cloud application. </p> <p><strong>Please note: </strong>Repartitioning your data can be done while the application is running. This may sound like you can always change the partitioning of your data afterwards. The caveat here is that you need to explicitly select a partition to be able to access a specific set of records. So while you can repartition, you may need to change logic in your application to effectively use the new partitioning. </p> <p>By applying sharding to your data tier, you can vastly increase the amount of power available to your application on the data tier. Choose the correct partitioning and you can use hundreds of SQL database nodes to distribute the load, making the scaling possibilities immense.</p> <h2>Scaling compute power more effectively</h2> <p>With database sharding and turning the knob for increased compute power, you can get pretty far in scaling the application. There are however plenty of things that can still limit the scale of your application.</p> <p>The following technique is one that can be used effectively to make your solution scalable. Draw out the components that make up your application and determine which groups of components can be duplicated. A single group of components that can be duplicated is called a scale unit. By placing a scale unit on a single instance you can scale out your application by simply activating another instance containing of that scale unit. Keep in mind that your application must be built in such a way that it is able to address multiple instances of a scale unit. </p> <p>Apart from defining scale units in your application architecture, you can also apply the following tips to make the application scale better:</p> <ul> <li>Apply service oriented architecture patterns like autonomous services. This decreases the number of dependencies, thus increasing the chance that you can scale your application more effectively. <br> <li>Use a centralized configuration mechanism, this decreases the amount of configuration needed for an instance of your application. Thus making it possible to scale faster in case the demand is increasing at a fast pace.</li></ul> <h2>Other techniques to make your application scale better on Azure</h2> <p>A good architectural design of the application is the most effective technique to make your application scale better on Azure, There's also a few other things you can do to make your application scale better and give users a better experience.</p> <ul> <li>Make use of geo distribution. Check where the audience of your application lives. Do they live in one area or all over the world? If the latter is the case, consider deploying your application in different data centres around the world. This will lower the latency and provide a better experience for users. <br> <li>Use the CDN for distributing files. Especially when you have users all over the world. Again this decreases the latency for users and it reduces the load on your compute instances.</li></ul> <h2>Final thoughts</h2> <p>The cloud changes the game in some ways, but there always remains the role of the architect and the developer to come up with a proper design of the application. Using Windows Azure is no excuse for doing a lame-ass job designing the application just because you seem to have unlimited resources. Resources cost money, so a good design will not only scale better, but will ultimately save you a lot of money.</p> <p>Having said that, the platform is quite fun to design for, so if you haven't done so, <a href="https://www.windowsazure.com/nl-nl/pricing/free-trial/">try it out</a>. You will discover that Azure will make building large scale apps a lot easier than it used to be before because of all these free infrastructural components.</p>

Welcome in 2012, the year of clouds

<p>The one sentence I keep saying to my co-workers, friends, family and all others is this: Welcome to 2012! It is the sentence I use to tell someone that he should lighten up and accept that things have changed. We're not in 1999 anymore.</p> <p>On that note I'd like to show you around on the latest incarnation of my weblog. I've moved the whole thing to the cloud in less than 10 minutes. That includes a full restore of the data (well, full, the important stuff is there, just a few links are missing) and the installation of a bunch of modules and my custom theme.</p> <p>How is that all possible? Read on!</p><!--more--><h2>Windows Azure, my old friend</h2> <p>The Windows Azure platform has been around for a while now and I have been looking into it a few times. The problem however always has been the price. It's too expensive for me. I am not going to pay 90 dollars to host a weblog when I can do the same thing on a virtual machine somewhere else for just 17 euros. </p> <p>Up until a few weeks ago, the price was my excuse not to move to the cloud. That all changed when Microsoft launched the new Azure websites feature. A cheap way to host your website in the cloud with all the Azure goodness of a proper control panel and installation possibilities. You cannot excuse yourself for the price, it's just 5 dollars per month. Way cheaper than the traditional hosting I had. </p> <p>As soon as I saw the offer of a 90 days trial I subscribed myself and went ahead to try out the new features Azure has to offer. </p> <h2>The pure awesomesauce of Azure websites</h2> <p>Azure websites is a new feature on Windows Azure that smells a little like Microsoft Web Matrix. You can either choose to create a site with no files or choose a product from the gallery and deploy that on a site. At this point the gallery is filled with loads off good open source products you can use to build websites. There's wordpress, dotnetnuke, drupal and more of that kind of products. </p> <p>Creating a new website is done through the new management portal. Select websites on the left-hand side of the screen and click the new button at the bottom of the screen. </p> <p><a href="http://fizzylogic.azurewebsites.net/wp-content/uploads/2012/06/image.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://fizzylogic.azurewebsites.net/wp-content/uploads/2012/06/image_thumb.png" width="298" height="180"></a> <a href="http://fizzylogic.azurewebsites.net/wp-content/uploads/2012/06/image1.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://fizzylogic.azurewebsites.net/wp-content/uploads/2012/06/image_thumb1.png" width="298" height="180"></a></p> <p>The new option offers a number of things you can do. You can create a website quickly using the quick create option. This reserves an URL for your website, but doess nothing after that. When using the quick create option you have to manually deploy your website. The next option is create with database, this option allows you to deploy a website together with the site. Again, the actual content you need to deploy afterwards. </p> <p>The final option, and in my opinion the best, is the <em>From gallery </em>option. This allows you to select a standard product giving you an instant productivity boost.</p> <p><a href="http://fizzylogic.azurewebsites.net/wp-content/uploads/2012/06/image2.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://fizzylogic.azurewebsites.net/wp-content/uploads/2012/06/image_thumb2.png" width="298" height="180"></a> <a href="http://fizzylogic.azurewebsites.net/wp-content/uploads/2012/06/image3.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://fizzylogic.azurewebsites.net/wp-content/uploads/2012/06/image_thumb3.png" width="298" height="180"></a></p> <p>This is what makes Azure websites so great. I can simply create a new website based on something standard. I don't have to worry about things like, will it work in the cloud, configuration options, deploying databases, etc. I don't see any other hoster around that offers such a flexibility at the price of just 5 dollar a month. You cannot beat that.</p> <h2>Migrating my old stuff</h2> <p>Okay, so I didn't really migrate my website one-on-one. The reason being that I don't want to poke around with MySQL backups that I possibly cannot restore into the cloud because of version differences. The old MySQL installation was kind of weird and I have had problems before.</p> <p>I still was able to migrate my stuff, because of Wordpress export/import functionality. It imports pictures, posts and comments in one go. Very neat! And because the deployment functionality on Azure configured the weblog just right I was able to import my old theme and modules without problems. </p> <h2>Conclusion</h2> <p>All things included it took me less than 10 minutes to move my weblog to the cloud. Giving me a costs reduction of exactly 12 euros. Did I mention it's now scalable too? Not that I will use that function any time soon, but I'm happy to have it. </p>