Azure – A scalable solution to multi-tenant Urls in IIS

azureiis-7.5multi-tenancysubdomain

We have developed a multi-tenant ASP.NET application. When a customer registers, they get their own subdomain to use for their site (e.g. tenant1.ourapp.com).

The process of setting up the customer's site needs to be configuration free.

Currently we have it set up like so:

  • 1 x Dedicated IP Address for Website
  • DNS A Record for *.ourapp.com to dedicated IP
  • Single website in IIS (7.5) handling all requests to dedicated IP

The rest is handled by our application (inspecting url and loading tenant specific config etc.).

The big question is how can this scale? Let's say that I wanted to only host 50 tenant instances per physical website in IIS. I now have the problem that the original site is handling all requests for ourapp.com (thanks to the wildcard dns record).

We're also looking at Azure so a solution that works for both a standalone server and Azure would be golden!

Best Answer

I would slightly alter your architecture:

Windows Azure comes with a load-balancer built-in. Install all your websites onto a single Webrole that can be spread across multiple instances. Configure your multi-tenant application to route the requests internally based upon the source/customer/url.

If you are truly multi-tenant, you will have a single code-base. The content that is seen by the user is dependent upon their context/user-id/etc. This way, you have one application, everyone shares the resources of your instances in a round-robin way, and no single server can stand in a way of failure.

Putting 50 sites on one server, another 50 sites on another server, etc.. is the "old" non-cloud way of dealing with things. Your server goes out, and 50 customers are down. And not have the agility/scalability when one of the customers becomes "too hot" for a single server.

Related Topic