Why should I use a LoadBalancerProbe instead of subscribing to the RoleEnvironment.StatusCheck event?

I fiddled with the azure line options to balance the load between several webroles.

I found three possible ways to do this.

the first would be to do nothing at all and allow the default execution (round robin) to complete the task.

the second possibility would be to define a custom LoadBalancerProbe in the ServiceDefinitionFile, which I tried and did not work: from my understanding, the aspx user page is called every time the status in the role is checked. Depending on the http response code, the role changes status to busy. - but this never happens. Also, I really couldn't find examples for defining a custom LoadBalancingProbe.

So I was looking for an alternative way to do this.

Now iam subscribes to the RoleEnvironment.StatusCheck event, which allows me to implement some logic and, depending on the results, establish that the state of the role is busy and available.

My questions: 1) Assume that a custom LoadBalancerProbe works as described in MSDN, what is the difference between subscribing to StatusCheckEvent and using a custom probe?

2) Why is my custom load balancer not working? - iam is just testing with the azure emulator at the moment and iam understands that traffic is still routed to webrole instances, although they are configured to be busy in the emulator. But my user probe does not change the status of webroleinstances at all.

Here is a very rudimentary code that should, as far as I know, set the status of webrole instance_n_0 to busy.

public class LoadBalanceController : Controller { public ActionResult Index() { WebOperationContext woc = WebOperationContext.Current; if(RoleEnvironment.CurrentRoleInstance.Id.ToLower().Contains("_0")) { woc.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.ServiceUnavailable; }else { woc.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.OK; } return View(); //not relevant } 

Ive also configured my servicedefinition file and set Route to redirect to this controller / action when calling healthcheck.aspx defined in a custom probe.

 <LoadBalancerProbes> <LoadBalancerProbe name="WebRoleBalancerProbeHttp" protocol="http" path="healthcheck.aspx" intervalInSeconds="5" timeoutInSeconds="100"/> </LoadBalancerProbes> ... <InputEndpoint name="EndpointWeb" protocol="http" port="80" loadBalancerProbe="WebRoleBalancerProbeHttp"/> 

Route:

  routes.MapRoute( name: "HealhCheck", url: "healthcheck.aspx", defaults: new { controller = "LoadBalance", action = "Index", id = UrlParameter.Optional } ); 
+8
azure load-balancing
source share
1 answer

Not sure why custom probe doesn't work, but for differences. A health check event allows you to declare whether an instance is available, but you do not have the flexibility regarding how often this is called. In addition, you cannot start a separate service that listens on a user port (or port type).

You have much more flexibility with custom probes, because you can create any type of port listener to determine the health, even a single exe.

With virtual machines, this is the only method for verifying health, because virtual machines do not have a guest agent that does not perform health checks.

0
source share

All Articles