Learning about Windows Azure
[This is a blog post related to the PHP on Azure competition.]
I’ve spent the last few days reading about Windows Azure, mostly just trying to get a feel for what features it has and how I could use them in an application. The competition rules suggest that entrants “can earn extra points by using other parts of the Windows Azure platform” and the more I get to learn, the better, so I’m going to try to make use of as much of Azure’s functionality as possible.
Though I haven’t yet decided what application I’ll be writing it’ll probably be some sort of a CMS – it’s the genre of web app I’m most familiar and its likely I’ll get more done in the short time frame I have if I stick to what I know best. As a result I’ve been looking at Azure’s feature list and thinking “how I can map this platform feature to a feature of a CMS?”
I found plenty of resources which helped me get an overview of Azure, and which I’m sure I’ll continue to use as I progress. The most helpful were:
- Maarten Balliauw’s exhaustive Sitepoint article
- Josh Holmes’ blog (plenty of posts concerning PHP on Azure)
- Brian Swan’s blog (loads of good Microsoft/PHP content, including lots of Azure-related posts)
The Sitepoint article does a great job of summarising what Azure offers a PHP developer. As I was reading it I kept thinking “Ooh, that’d come in handy for this” or “That’d make so-and-so easy…” – here’s my reaction to some of the topics covered in the article.
Platform as a Service
The article starts by explaining that unlike, for example, Amazon’s EC2, which is an example of Infrastucture-as-a-Service, Windows Azure is a Platform-as-a-service. This essentially means that a developer using Azure doesn’t need to worry about maintaining the server, and just has to focus on deploying and configuring the applications that run on it. This sounds good to me; while my experiences of EC2 have been mostly good, there is a lot of work involved with getting servers into a state where they are usable. This can be mitigated somewhat by creating build scripts, but even then these have to be maintained, while managing server security is another headache that I’d be glad to be rid of. I’m optimistic that Azure will prove itself to be very hospitable, though I suppose there’s a chance that it’ll be too inflexible for more demanding applications that require atypical server configurations.
Blobs, Tables and Queues (oh my…)
Judging by how often they’re mentioned in the articles I’ve read, these three features seem to be what Microsoft deem the most valuable. All three will play their part in a highly scalable application, which is one of the advantages of the platform. Blobs can be leveraged to provide resources (images, downloads and the like) through a Content Delivery Network, accessed via a REST API – this is very relevant to a CMS, so I’ll definitely be taking advantage of this feature.
Table storage is a document-oriented non-relational database in the same vein as MongoDB or CouchDB. While I imagine the application will use relational databases, hopefully there will be an opportunity to use Table storage; perhaps to hold the content itself. I don’t have a lot of experience with this type of database so it’ll be a good chance for me to learn something.
Queues are very exciting; a built-in way to pass processor-heavy tasks off to worker machines. I can immediately think of a few ways a CMS could make use of this feature: generating PDFs of pages; creating ZIP files of multiple downloads; analysing uploaded files for automated tagging and classification; computing internal analytics… there are plenty of scenarios where queuing could be invaluable. This feature interests me the most.
Microsoft have provided SQL Server support, albeit in a modified fashion, through SQL Azure. I’ve used SQL Server frequently over the last 4 years but have always preferred to use MySQL since until recently it’s been better supported by PHP through both highly maintained PDO drivers, and the mysqli client library. That has changed in the last year or so with Microsoft’s SQL Server Driver for PHP, and this will be my first chance to make use of that driver. It’s likely that I’ll employ Doctrine 2′s database abstraction layer since it has support for the driver, and it’ll make my application more portable in future – plus I’ve been looking for an excuse to put Doctrine 2 through its paces, having used Doctrine 1 extensively.
Windows Azure Platform Appfabric
Appfabric is a substantial element, comprising many components including Access Control, Caching, and Service Bus, which allows applications and services to communicate even through restrictive firewalls. Access control is a way to perform user authentication through federated identity services such as Active Directory, Microsoft Live, Yahoo!, Facebook and Google, which will be useful to web 2.0 style social applications that often delegate user identification. If it’s straightforward enough to do (and Microsoft say that it is) I may manage user authentication in this way; the web certainly doesn’t need another authentication device.
I’m unclear as to whether the caching system can currently be used; this article mentions only .NET applications, and suggests that it is only available for preview, which is a shame. If it isn’t, then there are other options available for caching – simple file-based caching, which will probably be too slow (and isn’t very scalable); the Wincache extension, which uses shared memory, which will be faster; or perhaps I’ll be able to implement a Memcached solution.
While I think Service Bus is a neat idea, I’m not sure whether my application will require communication with other network devices – it seems to be more relevant to applications concerned with restrictive networks.
I’ve read plenty about Windows Azure this week, and am quite excited about what it can offer a PHP application; some of the features make it almost too easy to dream up application functionality! Next I need to design my application, and get my development environment set up to work with Azure and its tools.