1
votes

I have a Azure Worker Role which has a /janitor route. This route shows counters and logs for this instance. When I make this role have two or more instances, I have no control which instance I'm accessing. My question is: how do I reliably access a particular instance of a role from public ip?

I'm aware of Instance Level Public Ip. That's not what I want because it requires some extra setup.

What I want to do is similar to what Remote Desktop client (mstsc.exe) does. I opened one Remote Desktop Connection to each of the individual instances. I noticed they both access same public IP and port of my worker role but somehow mstsc.exe manages to get two individual screens, one for each instance. mstsc.exe seems to be multiplexing the two server screens at TCP level. This is fancy, I don't want to go that far.

All I want is to issue HTTP requests to each individual instance. Is there any way to do that? E.g. an HTTP header, like X-Azure-Instance-Id=???.

1
split the route with instance id, and create a separate Worker role, for a different instance. 1 worker role per instance. - Aniket Inge
what an instance actually does is take your application and put it into another VM, behind a load balancer. hence you have no control over which instance request gets routed to - Aniket Inge
Yep, I know that each instance is a separate VM. How do I do the route split? - Igor Gatis
are you accessing the route over web? (asp.net mvc perhaps?) - Aniket Inge
Over web. Using my own http server. - Igor Gatis

1 Answers

1
votes

The way RDP does it is by having a RemoteForwarderAgent.exe and RemoteAccessAgent.exe on each instance. The RDP file that mstsc.exe uses to connect embeds a cookie that identifies the instance to connect to. When you initiate the RDP connection the connection will go randomly (via the load balancer) to any instance and will be connected to RemoteForwarderAgent.exe. The RemoteForwarderAgent will read the cookie and then internally make a connection via RemoteAccessAgent using an InternalEndpoint to the instance specified in the cookie. You could setup something similar for your route, but I suspect that is more work than you actually need.

The easiest option is to use InstanceInputEndpoint - http://msdn.microsoft.com/en-us/library/azure/hh180158.aspx. This will allow you to reach each instance on a unique port, so to query the /janitor route on a specific instance you would make a request to http://myservice.cloudapp.net/janitor:81 (where "81" is the InstanceInputEndpoint port for the specific instance you want to connect to). This does require a little bit of extra setup (an extra line in your .csdef, and some logic for the client to determine the port number), but not nearly as much as an instance level public IP.