Archives For Web Role


Opening Ports on Cloud Services

There are scenarios that warrants us to open ports of the Windows Firewall. Imagine an application that coordinates work across many compute nodes. The workload coordinator needs to know and manage each compute node.

The diagram above, depicts a Virtual Machine that has direct access to instances of a Cloud Service without going through a Load Balancer. Both the Virtual Machine and Cloud Service are deployed to a Virtual Network on Microsoft Azure. Using Internal Endpoints in this scenario, would not yield the desired configuration. Endpoints are defined at the Cloud Service boundary and are IP addresses belong to the Data Center’s Network Address Space. Therefore, In order to allow the Virtual Machine to communicate over specific ports to individual Cloud Service instances, we need to use PowerShell and a Startup Task to configure the Windows Firewall. Continue Reading…


Configuring Internal Endpoints

There are many scenarios where Internal Endpoints make sense. Imagine a web application that needs to communicate with a middle tier. The communication between both Cloud Services does not need to leave Microsoft Azure networks. The diagram above depicts a scenario where a Web Role has access to a middle tier Cloud Service without going through the public Internet.

Role instances running in a Cloud Service on Microsoft Azure communicate through internal and external connections that vary depending on the type of communication that is needed. An internal endpoint can connect by using a protocol of HTTP, TCP or UDP.

The configuration of an Internal Endpoint is done through the Service Definition. Below is the template used to describe what can be done in terms of Endpoint configurations.  Continue Reading…


Configuring Elevated Privileges

There are various scenarios that require us to execute applications with elevated privileges. It’s common for this requirement to surface during lift and shift efforts.

This configuration is done in the Service Definition file. It requires us to specify the Runtime Execution Context to elevated.

Runtime Configuration Template

This template uses the ProgramEntryPoint as an EntryPoint. Roles also support NetFxEntryPoint.

<Runtime executionContext="[limited|elevated]">
   <Environment>
     <Variable name="<variable-name>" value="<variable-value>">
      <RoleInstanceValue xpath="<xpath-to-role-environment-settings>"/>
    </Variable>
  </Environment>
  <EntryPoint>
     <ProgramEntryPoint commandLine="worker.cmd" setReadyOnProcessStart="true" />
   </EntryPoint>
</Runtime>

Continue Reading…


image Recently, Windows Azure Webjobs were introduced to Windows Azure Web Sites. Webjobs are background tasks that come in 3 different flavors (Manual, Triggered and Continuous). These jobs can be used to execute tasks such as database maintenance, RSS aggregation and queue processing. As new features rollout for Windows Azure Web Sites, it’s reasonable to ask whether Cloud Services are still relevant.

I see Cloud Services as a flexible scale unit, where I can spread compute intensive workloads over an echo-system of Role instances. As always, with great power (flexibility) comes great responsibility (we need to care about details).

Continue Reading…


Have you tried forcing an unexpected reboot?

Imagine a Worker Role that continuously polls a Windows Azure Storage Queue. It probably got it’s configuration settings when the Role instance started and it might not use the CloudConfigurationManager to refresh its configuration for every pull. This is where the Changing and Changed events come in. They allow you to build a strategy to deal efficiently with configuration changes.

Details

The Changing event and the Changed event are used together to identify and manage configuration changes to the service model. By using the Changing event, an instance can respond to a configuration change in one of the following ways:

  • Accept the configuration change while it is running, without going offline.

  • Set the Cancel property of RoleEnvironmentChangingEventArgs to true to take the instance offline, apply the configuration change, and then bring the instance back online.

By using the Cancel property, you can ensure that the instance proceeds through an orderly shutdown sequence and is taken offline before the configuration change is applied. During the shutdown process, Windows Azure raises the Stopping event, and then runs any code in the OnStop method.

You have a limited amount of time to accept or cancel the Changing event. Make sure your event handler can return in a timely manner.

You may want to cancel the Changing event if:

  • Your role instance does not support configuration changes while it is running, and requires recycling in order to apply the change.
  • Your role instance is performing work that should not be disrupted by a configuration change, and needs to proceed through the shutdown sequence before applying the change.

The RoleEnvironmentChangingEventArgs class provides a Changes property that returns a collection of the configuration changes that are about to be applied to the instance. Objects in this collection can be one of the following types:

Continue Reading…


R5336 By default, public endpoints are load balanced and there are times when we need to take a Role instance off the load balancer. Fortunately, the Windows Azure team has made this possible.

In order to relieve Role instance from too much stress cause by too many requests. You can throttle inbound requests by telling the load balancer that the Role is busy. This can allow the Role to stabilize and get back to normal.

Continue Reading…


ads_longpollA little while ago the Windows Azure team introduced the message pump pattern to Service Bus Message Bus SDK and it got me thinking about how I could leverage this from any web enabled client.

I wanted to create a long polling REST service that would allow me to extend the message pump pattern over a protected REST service. This is my proof of concept and should not be used in production without a little exploration.

A long poll means that a client makes a request to the server. The server then delays the response until an event occurs. Keep in mind that this is especially useful when you want to communicate events to clients through firewalls. Furthermore, this is a great way to reduce the number of requests made by clients. On the other hand, long poll requests eat up resources, therefore you will need to load test your endpoints in order to identify their limits.

Continue Reading…


IMG_2010_05_26_000018719_DxOIf your Cloud Service is composed of many Web Roles, Worker Roles or Virtual Machines, then you may be looking to cut your operational costs. When designing a Windows Azure solution, details like the way you consume Windows Azure services, are especially important. Using too many resources can generate surprising monthly bills! Consequently, it greatly influences whether the application survives its infancy.

Web & Worker Role Definitions

web role: A web role provides a dedicated Internet Information Services (IIS) web-server used for hosting front-end web applications.

worker role: Applications hosted within worker roles can run asynchronous, long-running or perpetual tasks independent of user interaction or input.

Utilizing The Full Potential of Your Cloud Services

In this example, data flows from an input queue, to converter Worker Roles that put messages on a persistence queue. The persistence Worker Role then reads from the persistence queue and inserts the data into a Windows Azure SQL Database.

Since the number of converter Worker Roles varies from 1 to 10, the persistence Worker Role has been put in place to protect the system from being throttled by the Windows Azure SQL Database Service.

Continue Reading…


In 2010 I bought a Kindle and it changed my life! Since then I’ve been catching up on books I should have read years ago. Back then, reading technical books meant carrying bulky/ heavy printed books in my bag. The day I got my first kindle, is the day I started reading again!

Since then, I read quite a few books! Below are some of the books that got me hooked on Windows Azure!

Continue Reading…


homer_simpson_clockA few weeks ago I wrote about using Quartz.Net to schedule jobs in Windows Azure Worker Roles. Since then I ran into a requirement that pushed me to create a wrapper around the Quartz.Net IScheduler. The JobSchedule has the responsibility of reading a schedule string from the CloudConfigurationManager and schedule a job.

The CloudConfigurationManager reads settings from the Role’s configuration file, which can be edited through the Windows Azure Management Portal under the configure section of your cloud services.

The following example will schedule a job which needs to be executed everyday at 6 AM, 8 AM, 10 AM, 12:30 PM and at 4:30 PM. The schedule is defined in the Role settings which can be edited through Visual Studio. To reach the Role settings, go to your Windows Azure Cloud Service project and find the desired Role configurations under the Role folder. Open the configuration editor by double clicking on the configuration file, then navigate to the ‘Settings’ tab. Click on ‘Add Setting’ and name the new setting ‘JobDailySchedule’ and set its value to 6:0;8:0;10:0;12:30;16:30;

The code from this Post is part of the Brisebois.WindowsAzure NuGet Package

To install Brisebois.WindowsAzure, run the following command in the Package Manager Console

PM> Install-Package Brisebois.WindowsAzure

Get more details about the Nuget Package.

Continue Reading…