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.
I added 4 more roles (all worker roles), with 5 internal endpoints apiece:
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!
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:
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!