1

Lets say i have an Azure Web Role with 3 instances. Is there a way for me to directly access each role via a URL change?

Im trying to test the endpoints of the instances individually-- thus my inquiry.

Edit

I am not looking for how to down one of the instances, i'm looking for how to ping an endpoint on each of the instances individually.

David Makogon
  • 69,407
  • 21
  • 141
  • 189
Micah
  • 10,295
  • 13
  • 66
  • 95

2 Answers2

1

Input endpoints are load-balanced, so you can't really direct traffic to one single instance.

Having said that, there are a few workarounds:

There's a health-check event you can set up a handler for. In all but one of your instances, you could set the instance's busy-flag, taking it out of the load balancer. To pull this off, you'd need some type of pub/sub (service bus queue?) mechanism to broadcast messages to the instances, letting them know whether to include or exclude themselves from the load balancer. you'd do something like:

RoleEnvironment.StatusCheck += RoleEnvironment_StatusCheck;

Then...

void RoleEnvironment_StatusCheck(object sender, RoleInstanceStatusCheckEventArgs e)
{
    if(someMagicConditionToRemoveFromLB)
        e.SetBusy();
}

Another option would be to have something like ARR running in a separate web role instance, providing custom load balancing.

Maybe you could come up with other workarounds, but in general, web/worker load balancing isn't set up for direct-instance access.

David Makogon
  • 69,407
  • 21
  • 141
  • 189
0

To add to what David indicated you can set up InstanceInput endpoints on the roles as well. This creates an endpoint on another port that will send traffic directly to one instance. You can do this and point the local endpoint port to 80 and thus get the ability to address individual instances externally; however, this likely isn't something you want to keep around. You can do this as a test and then remove the endpoints with an in place upgrade that just removed the instanceinput endpoints. Note that during this type of upgrade you may loose connectivity as endpoints are updated.

MikeWo
  • 10,887
  • 1
  • 38
  • 44