Tuesday, May 17, 2011

Windows Azure Tip: Go Beyond 5 Endpoints per Role, beyond 25 per Deployment

A few months ago, I blogged about the impact Remote Desktop has on your Windows Azure Deployment. The basic premise was simple: Remote Desktop consumes one endpoint on each of your roles. And, if you only had one role in your deployment, you’d actually lose two endpoints on your role, because of the Remote Desktop Forwarder. Given the restriction of 5 endpoints per role, having only three usable endpoints could be limiting if, say, you were trying to host a public-facing website (port 80), secure website (port 443), and a few WCF services (port 8000, and then… what???), all in a single role.

This brings me to today’s tip: Go beyond 5 endpoints in a role

The way deployments are set up, there was a maximum of 25 total endpoints:

  • Five total roles per deployment
  • Five endpoints per role

While there’s still an endpoint total in effect, there’s been a subtle change to role definitions, which went into effect some time in March. In fact, if you look at the What’s New in Windows Azure MSDN Library page, you’ll see the subtle change mentioned, under the March 31, 2011 update summary:

A recent update has changed the manner in which endpoints can be distributed among roles in a hosted service. A service can now have a total of 25 input endpoints which can be allocated across the 5 roles allowed in a service. For example, you can allocate 5 input endpoints per role or you can allocate 25 input endpoints to a single role. Internal endpoints are limited to 5 per role. Input and Internal endpoints are allocated separately.

For internal endpoints (meaning inter-role communication only), nothing changes – only five per role. However, with input endpoints (meaning public-facing ports), you can divide the 25 up any way you want across your roles.

Just for fun, I wanted to see what would happen if I went with all 25 input endpoints, along with five internal endpoints per role, across 5 roles.

Here’s part of my web role’s endpoint definition, with 25 input endpoints and 5 internal endpoints.

30endpoints

I added 4 more roles (all worker roles), with 5 internal endpoints apiece:

worker-role-5-endpoints

I published this to Windows Azure, and was able to see my website on each port. The default.aspx page shows the total endpoint count for my webrole, along with the port number for Endpoint15, which is read from the role environment with this simple code:

txtInstanceCount.Text = RoleEnvironment.CurrentRoleInstance.InstanceEndpoints.Count.ToString();
txtEndpoint15.Text =
RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["Endpoint15"].IPEndpoint.Port.ToString();




I also enumerated the total endpoint count across the entire deployment.



The output shows that these ports, indeed, exist and are active. Take a good look at my total endpoint count!



lotsofports-webpage


What this shows is:




  • 25 input endpoints on my web role, plus 5 internal endpoints on the same role


  • 5 internal endpoints each on the 4 worker roles, adding another 20 endpoints.


  • A grand total of 50 endpoints in my deployment!



If anyone’s ever tried publishing to Windows Azure in the past, with more than 5 endpoints per role, you received a deployment error. This app published with no issues. Here’s a snapshot of the portal, with everything humming along:



lotsofports-portal



Disclaimer: I did not wire up all the endpoints to services. I’m assuming everything will work, since it published with no errors. Feel free to disprove this.



So, as you’re planning your Windows Azure role usage, you can breathe a bit easier if you were bumping into endpoint limitations. Enjoy!

5 comments:

  1. But... have you tested that those ports are available from outside Azure? Of course you can add as many as you please to a Role, but... will the load balancer map all those ports to your internal instance? :P

    ReplyDelete
  2. @Anonymous - Absolutely - all ports are available for your use. In fact, since I posted this, things have improved even more: You can now have 25 Input endpoings (externally-visible) and 25 Internal endpoints (internally-visbile for inter-instance communication) across a single deployment. Check out this MSDN article, which goes into much more detail: http://msdn.microsoft.com/en-US/library/gg433033.aspx

    ReplyDelete
  3. Is there some reason we can't get more input endpoints? Running an FTP server for example you need lots of input endpoints (ports) for passive connections, 25 is very limiting.

    Any idea if the 25 limit is going to raised again soon?

    Great article, thanks

    ReplyDelete
  4. Unfortunately I don't know what the plans are for increasing endpoint count. If something gets announced, I'll be sure to blog about it.

    ReplyDelete
  5. HI David,

    Could you please let me know any word around to implement passive mode in Azure Worker role with an endpoint at port 21,which accepts all FTP connections from client.

    I got to know that there is issues since the worker role are beyond the azure load balancer.

    COuld you please throw some light on this issue if you have idea about this

    ReplyDelete