I’ve been experimenting with Windows Azure the past few days. It’s great to see C# again and Visual Studio is such a great IDE. I went through the tutorials and built the Guestbook application from the documentation. There are two basic roles in the Azure Cloud Service. First, there’s a web role project that is basically an ASP.NET (C#) application defined to run on the Azure Cloud. Secondly, there’s a worker role project in the solution that handles the backend processing for the application. In this case, the worker role is resizing images to thumbnails. The web role and the worker role pass tasks between each other using a queue (Microsoft.WindowsAzure.CloudQueue.Client). This was an easy way to separate the front end code from the back end code. The web role can continue to handle user requests without waiting for the image to be processed.
Web Role: ASP.NET application accessible via HTTP / HTTPS endpoint and is commonly the front-end for the application.
Worker Roles: Background processes for the application.
You can have one or multiple web and worker roles within the same Azure service.
Basically, the example works like this…
- User posts message and path to image
- Web role grabs image and stores it in blob storage
- Web role puts job on queue to resize image to thumbnail (image is rendered in the form in normal size)
- Worker role checks queue for new messages until it finds the instruction to resize the thumbnail
- Worker role resizes image
- Web role refreshes page (image is resized via partial refresh)
This was a great starting point for learning Azure. It made use of the blob storage, table storage, and queues. I’m going to update the example and mirror the Guestbook post to insert data into Salesforce.com. I’ll post the source code and the URLs when that’s complete.