Building SaaS Solutions on Windows Azure
Steve Marx
Who am I?
- Early Windows Azure team member
- Chief Cloud Architect for Aditi
- Also founded site44.com, building SaaS
(but not on Windows Azure)
Self-Promotion Warning
Agenda
- Defining Software as a Service
- SaaS architectures and multi-tenancy
- SaaS billing and metering
SaaS: a Working Definition
software delivered over the internet, billed on a subscription basis
- Steve Marx, today
SaaS Multi-tenancy
SaaS is commonly multi-tenant
- Resources are shared among users
- Sometimes users belong to (customized) tenants
Multi-tenancy Tradeoffs
-
Multi-tenant
- Pros: resource-efficient, low operational cost
- Cons: difficult implementation, isolation challenges
-
Single-tenant
- Pros: easy to implement (particularly for migrations), isolated
- Cons: less efficient, more things to manage
Multi-tenancy and N-Tier Architecture
N-tier architecture:
- Client – typically single-tenant
- Service(s) – multi-tenant or not
- Data – multi-tenant or not
For each tier, multi-tenancy means sharing resources
Multi-tenancy in Identity
Approach boils down to one of:
- Log users in, look up their tenant
- Users go directly to tenant and log in
Access Control and Active Directory Federation help.
Multi-tenancy in Services
Three options these days:
-
Web Sites
- Shared model good for single-tenant
- Dedicated model similar to cloud services
-
Cloud Services
- Good isolation boundary
- Costly and non-trivial to spin up new services
-
Virtual Machines
- In fact, these are cloud services
Web.config:
<authentication mode="Forms">
<forms loginUrl="https://smarxte12.accesscontrol.windows.net:443/..."
timeout="2880" />
</authentication>
LoginController.cs:
[HttpPost]
[ValidateInput(false)]
public ActionResult Index(string wresult)
{
...
FormsAuthentication.SetAuthCookie(...);
Multi-tenancy in Data: WA Storage
-
One account per tenant
- Best isolation
- Limited number of accounts per subscription
-
One partition per tenant
- Typically easily to implement
- Good performance isolation
- Limited management and security isolation
- External/no isolation
Multi-tenancy in Data: SQL
-
One database per tenant
- Good performance isolation
- Can be expensive
-
One table per tenant
- Helps query isolation
- A bit awkward to implement
-
Federation (horizontal partitioning)
- Good security isolation
- Good scalability
- Some performance isolation
var container =
blobs.GetContainerReference(
User.Identity.Name);
return View(
container.ListBlobs()
.OfType<CloudBlob>()
.Select(b =>
b.Uri.AbsoluteUri +
b.GetSharedAccessSignature(...)));
SaaS Business Models
General strategy:
- Figure out your costs.
- Charge more than that.
A few popular approaches:
- Tiered pricing plans (e.g. freemium)
- Flat rate, optionally with usage caps
- Utility billing
Who Runs the Service?
Single-tenant model gives you two options:
- You run the service and bill your customer.
- Your customer runs the service. (And optionally, you manage it.)
How to Bill
-
Store – discovery plus billing
- Windows Azure Marketplace
- Mobile app stores
- Windows Store
-
Payment processor
Billing Considerations
- Ease of integration
- Discoverability from a marketplace
- Customer UI (viewing bills, dispute resolution, etc.)
Things to Measure
- Don't try to count CPU cycles
- Possibly count VM hours
- Possibly count bandwidth
- Possibly count data size
How to Measure
-
Log what you need to measure
- Use built-in Diagnostics
- Roll your own
-
Use WA storage analytics/logging
- Can help with bandwidth measurements
- Measures capacity, but only at account level
-
Use billing data (last resort)
- Delayed
- Not easy to consume
Bonus: Site44 Architecture and Business Model
Multi-tenant everything:
- Scaled-out caching tier (Varnish)
- Scaled-out web server
- Structured database (DynamoDB)
- Replicated in-memory database/cache (Redis)
Freemium with capped usage
Summary/Advice
- Decide about per-tier tenancy, considering:
- cost
- isolation requirements
-
Decide on a business model, considering:
- your costs
- what customers want
- what you can measure
- Use Windows Azure where possible
Questions?
Ask now or contact me later: