SaaS Architecture
SaaS Architecture
SaaS Architecture
Page 1 of 20
Introduction
Software as a service. The words are on everyone's lips. The pages of software industry publications are full
of articles about software as a service (SaaS)articles that use words like "revolution" and "horizon" (as in,
"on the"). Everyone knows (or thinks they know) what it is, roughly, and everyone knows it's going to be
big. Yet few people would say they can really define it, and even fewer know how to build it.
So, if SaaS holds such promise for the future of application delivery, why isn't there more guidance
available to help people actually achieve it?
We believe that SaaS is going to have a major impact on the software industry, because software as a
service will change the way people build, sell, buy, and use software. For this to happen, though, software
vendors need resources and information about developing SaaS applications effectively.
http://msdn2.microsoft.com/en-us/library/aa479069(printer).aspx
3/14/2008
Page 2 of 20
This is the first in a series of papers from Microsoft dedicated to demystifying SaaS and providing practical,
real-world guidance for architecting SaaS applications. This paper serves as an overview of SaaS, its
challenges, and its benefits for those who are interested in offering SaaS. Future papers will explore many
of these topics in detail.
This paper begins by asking just what software as a service is, exactly, and it explains the conceptual shifts
that prospective SaaS vendors must experience in order to understand how it differs from traditional, onpremise software. Next, we'll look at the SaaS business model, to see how software as a service can be
monetized in the real world.
Because this is an architectural paper, the largest section addresses the architecture of a SaaS application.
We present a four-level maturity model that explains and puts into perspective some key attributes of
SaaS: configurability, multi-tenant efficiency, and scalability. We'll examine the components of a high level
SaaS architecture, and then take a closer look at a typical challenge the SaaS architect facesthat of
providing a mechanism for extending the data model of a multi-tenant application.
Lastly, we'll take a brief look at some of the operational issues involved in supporting a SaaS application
after deployment.
services are often large, customizable business solutions aimed at facilitating business processes such
as finances, supply-chain management, and customer relations. These services are typically sold to
customers on a subscription-basis.
l Consumer-oriented services, offered to the general public. Consumer-oriented services are
sometimes sold on a subscription-basis, but are often provided to consumers at no cost, and are
supported by advertising.
This paper focuses on the architecture and business issues involved in developing line-of-business
applications, and the concepts and examples herein are presented in that context. However, issues such as
multi-tenant customization and extensibility, data scaling, and isolation issues also occur (and in fact tend
to be easier to resolve) in the consumer space, so developers of consumer-oriented SaaS offerings may
benefit from reading it as well.
http://msdn2.microsoft.com/en-us/library/aa479069(printer).aspx
3/14/2008
Page 3 of 20
Moving from offering on-premise software to offering software as a service requires software vendors to
shift their thinking in three interrelated areas: in the business model, in the application architecture, and in
the operational structure (see Figure 1).
be sold.
Realizing the benefits of SaaS requires shifts in thinking on the part of both the provider and the customer,
and it's up to the provider to help the customer make this shift.
http://msdn2.microsoft.com/en-us/library/aa479069(printer).aspx
3/14/2008
Page 4 of 20
Transferring IT Responsibilities
In a typical organization, the information technology (IT) budget is spent in three broad areas:
l SoftwareThe actual programs and data that the organization uses for computing and information
processing.
l HardwareThe desktop computers, servers, networking components, and mobile devices that
availability of the system, including technical support staff, consultants, and vendor representatives.
Of these three, it is the software that is most directly involved in information management, which is the
ultimate goal of any IT organization. Hardware and professional services, though vital and important
components of the IT environment, are properly considered means to an end, in that they make it possible
for the software to produce the desired end result of effective information management. (To put it another
way, any organization would gladly add software functionality without extra hardware if it could do so
effectively, but no organization would simply add hardware without an anticipated need to add software as
well.)
In an IT environment based around on-premise software, the majority of the budget is typically spent on
hardware and professional services, leaving a minority of the budget available for software (see Figure 2).
http://msdn2.microsoft.com/en-us/library/aa479069(printer).aspx
3/14/2008
Page 5 of 20
http://msdn2.microsoft.com/en-us/library/aa479069(printer).aspx
3/14/2008
Page 6 of 20
Figure 4. Typical budget for an SaaS environment (accounting for hardware and professional
services costs)
http://msdn2.microsoft.com/en-us/library/aa479069(printer).aspx
3/14/2008
Page 7 of 20
A large brick-and-mortar bookstore might carry about 130,000 different titles on its shelves. Yet, according
to Anderson, the majority of Amazon.com's book sales come from outside its top 130,000 titlesin other
words, most of the books that Amazon.com sells are titles that wouldn't even be carried by a traditional
walk-in bookstore.
Vendors of complex line-of-business (LOB) software solutions face a similar market curve (see Figure 6).
http://msdn2.microsoft.com/en-us/library/aa479069(printer).aspx
3/14/2008
Page 8 of 20
customers that have always been inaccessible to traditional solution vendors, because it has never before
been cost-effective to serve them (see Figure 7).
Effectively targeting these smaller customers requires another shift in thinking for vendors who are
accustomed to a sales process that depends on personal contacts and vendorcustomer relationships; most
vendors won't be able to provide personal service to a much larger customer base at price points that such
a base will support. Selling SaaS is like selling mobile phone ringtones, or downloadable music: it should be
possible for a customer to visit your website, subscribe to your service, pay with a credit card, customize
the service, and begin using it, all without human intervention on the part of the vendor. This doesn't mean
that you have to eliminate the more personal approach for larger customers with more extensive needs.
But designing the sales, marketing, provisioning, and customization processes from the ground up to work
automatically makes it possible to offer an automated approach as a choiceand has the happy side effect
of simplifying the work that your own support personnel must perform in order to accomplish the same
tasks on behalf of a customer.
Application Architecture
Our working definition of software as a service is: "Software deployed as a hosted service and accessed
over the Internet." Depending on how one defines words such as software and access, this definition can
encompass a lot of things perhaps too many. To an application architect, certainly, it doesn't really shed
any light on what exactly makes a SaaS application work, the thing that makes the difference between a
successful SaaS application and an unsuccessful one. A line-of-business application with a decade-old code
base mated to a jury-rigged HTML front end may fit the broad definition of software as a service, but most
such applications run into problems when they are unable to scale well or cost-effectively. To define what
might be called a mature SaaS application, therefore, we must introduce some additional criteria.
http://msdn2.microsoft.com/en-us/library/aa479069(printer).aspx
3/14/2008
Page 9 of 20
Level I: Ad Hoc/Custom
The first level of maturity is similar to the traditional application service provider (ASP) model of software
delivery, dating back to the 1990s. At this level, each customer has its own customized version of the
hosted application, and runs its own instance of the application on the host's servers. Architecturally,
software at this maturity level is very similar to traditionally-sold line-of-business software, in that different
clients within an organization connect to a single instance running on the server, but that instance is wholly
independent of any other instances or processes that the host is running on behalf of its other customers.
Typically, traditional clientserver applications can be moved to a SaaS model at the first level of maturity,
with relatively little development effort, and without re-architecting the entire system from the ground up.
Although this level offers few of the benefits of a fully mature SaaS solution, it does allow vendors to
reduce costs by consolidating server hardware and administration.
http://msdn2.microsoft.com/en-us/library/aa479069(printer).aspx
3/14/2008
Page 10 of 20
Similarly to the first maturity level, the second level requires that the vendor provide sufficient hardware
and storage to support a potentially large number of application instances running concurrently.
management benefits of a shared approach means offering your application to the consumer at a
higher cost; however, under some circumstances, it may be worth it to meet other needs. In addition,
customers may have strong legal or cultural resistance to an architectural model in which multiple
tenants share access to an application, even if you can demonstrate that it does not place confidential
data at risk. Ultimately, of course, you'll need a business model that shows how your application can
make money at whichever maturity level you've targeted.
l Architectural modelCan your application be made to run in a single logical instance? If you are
http://msdn2.microsoft.com/en-us/library/aa479069(printer).aspx
3/14/2008
Page 11 of 20
approach.
l Operational modelCan you guarantee your service level agreements (SLAs) without isolation?
Carefully examine the obligations imposed by any existing SLAs that you have with customers, with
regard to considerations such as downtime, support options, and disaster recovery, and determine
whether these obligations can be met under an application architecture in which multiple unrelated
customers share access to a single application instance.
High-Level Architecture
Architecturally, SaaS applications are largely similar to other applications built using service-oriented design
principles (see Figure 10).
Metadata Services
In a mature SaaS application, the metadata service provides customers with the primary means of
customizing and configuring the application to meet their needs. Typically, customers can make
configuration changes in four broad areas:
l User interface and brandingCustomers often appreciate the ability to modify the user interface to
reflect their corporate branding, and therefore SaaS applications typically offer features that allow
customers to change things such as graphics, colors, fonts, and so on.
http://msdn2.microsoft.com/en-us/library/aa479069(printer).aspx
3/14/2008
Page 12 of 20
l Workflow and business rulesTo be of use to a wide range of potential customers, a business-
critical SaaS application has to be able to accommodate differences in workflow. For example, one
customer of an invoice tracking application may require each invoice to be approved by a manager; a
second customer may require each invoice to be approved by two managers in sequence; a third may
require two managers to approve each invoice, but allow them to work in parallel. When appropriate,
customers should be able to configure the way in which the application's workflow aligns with their
business processes.
l Extensions to the data modelFor many data-driven SaaS applications, one size definitely doesn't
fit all. Even with relatively simple, task-specific applications, customers may chafe under the
restrictions imposed by a static, unchanging set of data fields and tables. An extensible data model
gives customers the freedom to make an application work their way, instead of forcing them to work
its way. Later in this paper, you'll learn a bit more about how a customer-extensible data model is
architected.
l Access controlTypically, each customer is responsible for creating individual accounts for end
users, and for determining which resources and functions each user should be allowed to access.
Access rights and restrictions for each user are tracked by using security policies, which should be
configurable by each tenant.
To provide customers with flexibility in configuring the software as necessary, these options are organized
into hierarchical configuration units known as scopes, each of which contains options for making changes in
each of the four areas listed above. Every customer has a top-level scope that it can configure as needed,
and the customer may establish one or more scopes underneath the top level in an arbitrary hierarchy. A
relationship strategy determines how and whether child nodes inherit and override configuration settings
from parent nodes.
For example, a typical customer that purchases enterprise-wide access to your application may have
several business units with distinct needs, all of which must follow certain company-wide standards, but
also must be able to configure some aspects of the application individually. Within each business unit as
well, there may be organizational groups that have their own special configuration needs. For each of these
identified organizational units, the customer can establish a scope that gives the group access to the
configuration options that it may set or change.
Unlike traditional vendor-customized line-of-business applications, SaaS applications are much more likely
to be configured by customers themselves. Designing the configuration interface is therefore almost as
important as designing the interface for end users. Ideally, customers should be able to configure the
application through a wizard, or through simple, intuitive screens that present all available options without
causing information overload, and that clearly distinguish between options that can and cannot be changed
within a given scope.
Security Services
As important as security is in any software context, the nature of SaaS makes security both a paramount
concern for customers, and a high priority for application architects. Following some basic guidelines can
help ensure that tenants remain in control of their private data.
Authentication
The SaaS provider typically delegates to each tenant the responsibility for creating and maintaining its own
user accounts, a process known as delegated administration. Delegated administration creates a situation
in which the customer is responsible for creating individual user accounts, but the vendor has to
authenticate them. To accommodate this delegated-administration model, SaaS designers use two general
approaches for handling authentication: a centralized authentication system, or a decentralized
authentication system. The approach that you choose will have ramifications for the complexity of your
architecture and the way end users experience the application, and you should consider what your business
model says about the needs of the application, customers, and end users when making a decision.
In a centralized authentication system, the provider manages a central user account database that serves
all of the application's tenants. Each tenant's administrator is granted permission to create, manage, and
delete user accounts for that tenant in the user account directory. A user signing on to the application
provides his or her credentials to the application, which authenticates the credentials against the central
directory and grants the user access if the credentials are valid (see Figure 11).
http://msdn2.microsoft.com/en-us/library/aa479069(printer).aspx
3/14/2008
Page 13 of 20
http://msdn2.microsoft.com/en-us/library/aa479069(printer).aspx
3/14/2008
Page 14 of 20
This is an ideal approach when single sign-on is important, because authentication is handled behind the
scenes, and it doesn't require the user to remember and enter a special set of credentials. The
decentralized approach is more complex than the centralized approach, however, and a SaaS application
with thousands of customers will require individual trust relationships with each of the thousands of tenant
federation services.
In many cases, the SaaS provider may want to consider a hybrid approachusing the centralized approach
to authenticate and manage users of smaller tenants, and the federated approach for larger enterprises
that demand, and will pay for, the single sign-on experience.
Authorization
Typically, access to resources and business functions in a SaaS application is managed by using roles that
map to specific job functions within an organization. Each role is given one or more permissions that enable
users assigned to the role to perform actions in accordance with any relevant business rules (see
Figure 13).
http://msdn2.microsoft.com/en-us/library/aa479069(printer).aspx
3/14/2008
Page 15 of 20
Figure 14. Example of root scope permissions vs. child scope permissions
As a best practice, your application should include a default set of roles, permissions, and business rules
that are available to all tenants, and it should allow individual tenants to customize these rules and create
more rules through a useful and intuitive user interface.
http://msdn2.microsoft.com/en-us/library/aa479069(printer).aspx
3/14/2008
Page 16 of 20
http://msdn2.microsoft.com/en-us/library/aa479069(printer).aspx
3/14/2008
Page 17 of 20
corresponding to the record ID, and returns them to be treated as ordinary field data. Obviously, data in
the custom data table cannot be typed, because it is likely to contain data in many different forms for
different customers. To work around this limitation, a third column can optionally hold a data type
identifier, so that the data can be cast to the appropriate data type once it is retrieved.
This approach makes the data model arbitrarily extensible, while retaining the cost benefits of using a
shared database. The main disadvantage is an added level of complexity for database functions, such as
searching, indexing, querying, and updating records. This is typically the best approach to take if you
anticipate that your customers will require a considerable degree of flexibility in extending the default data
model, but that they won't require data isolation.
When developing an extensibility approach for your data model, remember that any extension implemented
by a customer will require a corresponding extension to the business logic (so that the application can use
the custom data), as well as an extension to the presentation logic (so that users have a way to enter the
custom data as input and receive it as output). The configuration interface that you present to the customer
should therefore provide mechanisms for updating all three, preferably in an integrated fashion. (Providing
mechanisms by which customers may extend the business logic and user interface will be addressed in a
future paper.)
Scalability
Large-scale enterprise software is intended to be used by thousands of people simultaneously. If you have
experience building enterprise applications of this sort, you've gotten to know first-hand the challenges of
creating a scalable architecture. For a SaaS application, scalability is even more important: you'll have to
support the average user base of a single customer, multiplied by the total number of customers that you
have. For ISVs accustomed to building on-premise enterprise software, supporting this kind of user base is
like moving from the minor leagues to the majors: the rules may be familiar, but the game is played on an
entirely different level. Instead of a widely deployed, business-critical enterprise application, you're really
building an Internet-scale system that needs to actively support a user base potentially numbering in the
millions.
either on the client side, or in a distributed store that's accessible to any application instance.
Statelessness means that each transaction can be handled by one instance as well as any other; a
user may transact with dozens of different instances during a single session, without ever knowing it.
l Design the application to conduct I/O operations asynchronously, so that the application can perform
your computing resources, and it improves your ability to predict resource usage.
l Write your database operations in such a way as to maximize concurrency and minimize exclusive
locking. For example, don't lock records when performing read-only operations.
Of course, this is only the very briefest of examinations of the topic; volumes could be (and have been)
written about implementing a scalable architecture. For some additional guidance, see the Performance &
Scalability resources [ http://msdn.microsoft.com/practices/Topics/perfscale/default.aspx ] published by
Microsoft Patterns & Practices.
http://msdn2.microsoft.com/en-us/library/aa479069(printer).aspx
3/14/2008
Page 18 of 20
As databases serve more users concurrently and grow in size, the amount of time it takes to perform
operations such as querying and searching increases significantly. SaaS applications, which often use the
same databases to serve thousands of customers, are particularly susceptible to these types of
performance degradation, and therefore it's important to plan adequately for growth.
One fairly simple way to scale a database is through partitioning, dividing the data into smaller "chunks" in
order to improve the efficiency of queries and updates. Consider developing a partitioning strategy to
determine the best way to partition your data. For example, if an application has customers from around
the world, a geographic partitioning strategy might be appropriate, with data belonging to European
customers in one partition, data belonging to Asian customers in another, and so on.
In most situations, it is likely that database size will keep growing. Therefore, it is also important to have
dynamic repartitioning strategies in place, to ensure that already-partitioned data can be repartitioned in
order to keep up with performance and scale metrics.
Operational Structure
The third important shift in thinking has to do with the operational structure of the application: what it
takes to deliver the application to customers, and to keep it available and running well at a cost-effective
level. For many ISVs, which have never had to run a data center for their customers, this may be the most
unfamiliar aspect of SaaS. SaaS providers not only have to be experts in building software and bringing it
to market, they must also become experts in operating and managing it.
Resources such as the Microsoft Operations Framework (MOF) provide a great deal of relevant guidance for
maintaining system reliability, availability, supportability, and manageability. In addition to the common
operation issues that MOF is designed to address, SaaS presents some unique challenges of its own.
Shared Services
If you've had experience with an enterprise-level World Wide Web presence, you're already familiar with
the fundamentals of Web hosting and middleware services, in which an organization either hosts a site
internally, or contracts with an external provider for equipment co-location or full-service hosting, including
hardware, storage, and network bandwidth. The hosting service is responsible for the availability of the
site, but it is typically not otherwise responsible for the site's operation and maintenance.
Providing software as a service adds an additional layer to consider when making hosting arrangements
(see Figure 17). Depending on your business plan, you may need a metering and billing system in order to
do the following:
l Accurately track customers' usage, and bill them for time or resources used.
l Restrict or throttle access at certain times of the day, or in order to meet other criteria.
l Monitor site access and performance, to ensure that SLAs are being met.
l Perform other functions in order to ensure a seamless experience for your customers that meets or
exceeds expectations.
Collectively, the systems used to perform these functions are known as shared services.
http://msdn2.microsoft.com/en-us/library/aa479069(printer).aspx
3/14/2008
Page 19 of 20
collections) and customer management (which includes order entry, customer self services, customer
care, trouble ticketing, and customer relationship management).
As with traditional Web hosting, you will need to decide whether to build the shared services layer yourself
and self-host your application, or to contract with an external hosting company (known as a SaaS provider)
to provide it. SaaS providers offer a set of shared services to handle the business and operational issues
identified above.
Monitoring
The SLAs that you enter into with your customers will quantify the operational standards that you are
required to meet. SLAs are legally binding contracts, and failing to meet them can mean significant lost
revenue and damage to your reputation. Monitoring your application architecture for any sign of trouble is
therefore a vital tool for detecting problems, and fixing them before they result in significant outages or
performance degradation.
http://msdn2.microsoft.com/en-us/library/aa479069(printer).aspx
3/14/2008
Page 20 of 20
For an overview of the issues surrounding high availability, see "Service Management Functions: Availability
[ http://www.microsoft.com/technet/itsolutions/cits/mo/smf/smfavamg.mspx ] " on Microsoft TechNet.
Conclusion
There's plenty more to be said about each of the topics addressed in this paper, but hopefully, by this point,
you've read enough to begin developing a conceptual framework for understanding SaaS, and how you and
your customers may benefit from it. SaaS represents a new paradigm in software delivery, an architectural
model built on the principles of multi-tenant efficiency, massive scalability, and metadata-driven
configurability to deliver good software inexpensively to existing and potential customers. Adopting these
principles now can help put you well on the path to transforming the way you capture the long tail business.
For more information, please see Multi-Tenant Data Architecture [ http://msdn2.microsoft.com/enus/library/aa479086(printer).aspx ]
Acknowledgements
Many thanks to Paul Henry for his help with technical writing.
Feedback
The authors gladly welcome your feedback about this paper. Please e-mail all feedback to
[email protected] or [email protected] . Thank you.
http://msdn2.microsoft.com/en-us/library/aa479069(printer).aspx
3/14/2008