It seems like the main challenge is handling the load balancer. In Windows Azure, a
role (not individual instances) is set up to receive traffic that comes to a given port. If you want some of the instances of your role to take web traffic and some to not, you need a way to remove certain instances from the load balancer.
I think you can actually do this... but you'll have to set those instances (the ones acting as workers) to the "Busy" state. Take a look at the RoleEnvironment.StatusCheck event. If you implement a handler for that event and respond by calling SetBusy()
on the passed in argument, you should be taken off the load balancer for a short period of time. I think if you keep responding this way, you can stay off the load balancer indefinitely.
So what I'm suggesting is having your role be a web role (configured to take traffic), and have the instances manage their participation by setting themselves as Busy when they don't want to take traffic. You'll still need some sort of orchestration so each
instance knows which "role" it's supposed to perform. Depending on how you're going to trigger this, it could be as simple as a table with columns "instance ID" and "role."
A downside of this approach is that the role instances that are acting as workers will have a "Busy" state, which makes it hard to tell if they're functioning properly (e.g. in the portal UI).
All of this said, Brent's answer may be better, which is to simply not pursue this strategy. Instead, have
every instance act as both.