A Multi-tenancy Aware Architectural Framework for SaaS Application Development

In the era of cloud computing, multi-tenant based Software as a Service (SaaS) applications have been widely identified as the next generation of cloud applications. SaaS allows multiple user organizations to customize an application in a reliable and secure manner. However, this customization is a complex and error prone exercise. In response, researchers and practitioners have come up with SaaS architectures based on frameworks, platforms and modelling approaches to ease the complexity of SaaS application development. However, these methods and tools have not focused on aspect of development methodology being tuned to support long-term maintenance of the SaaS application. This paper presents an architectural framework for SaaS application development that incorporates long-term maintenance requirements arising from multi-tenancy of the application. It consists of a methodology coupled with a tool chain, which brings multi-tenancy aware features to develop SaaS solutions that meet critical architectural requirements. It also includes a UML 2.0 based Profile named SaaSML for designing of main components, a skeletal framework to position these components and a methodology for benchmark evaluation of key design criteria.


Introduction
Software as a Service (SaaS) business model is impacting the software industry on how customers acquire business functionality and solutions [1].In this model, application functionality is delivered through an online subscription model.A customer does not take ownership of the software, but instead rents a total solution that is delivered remotely.SaaS has been widely identified as the next generation of cloud applications [1].This allows multiple users of di erent organizations (Whom we call as tenants) to use the same software in a reliable and secure manner.Users will be given the liberty to customize the application according to their needs by changing user interfaces, work-flows and business processes [2].With the SaaS model, customers can reduce up-front support costs; because they no longer need to support multiple platforms and versions [3].The end user's customized solution is hosted over the Internet giving customers the opportunity access the service on demand basis [4].
For SaaS architectures, multi-tenancy is considered as the main design principle when developing SaaS software [5].Multi-tenancy can be defined as a single instance of the software running on the vendor's servers, serving multiple tenants.With a multi-tenant architecture, a software application is designed to virtually partition its data and configuration so that each client organization works with a customized virtual application instance.Multitenancy may be the most significant paradigm shift that an architect accustomed to designing isolated, single-tenant applications has to make in the era [5].This requires an architecture that maximize the sharing of resources across tenants, but that is still able to differentiate data belonging to different customers.
In single-tenant software, challenges like configuration and versioning are solved by creating a branch in the development tree and deploying a separate instance.In a multi-tenant software, this is no longer acceptable, which means that features like these must be integrated in the application architecture, which inherently increases the code complexity and therefore makes maintenance more difficult [3].Wrong architectural choices might ENGINEER 22 ENGINEER 2 degrade the quality attributes of the multitenant SaaS application over its evolution.

Related Work
Software Architects from Microsoft and Salesforce.com have said that meta-data driven architectures are the core logic that gets applied within multi-tenant SaaS applications [5], [6], [7].Within a layered architecture of a SaaS web application, the components within each layer can be conceptually virtualized into tenant compartments and they will be governed by tenant specific and shared meta-data based XML or runtime specific objects.Salesforce.com allows changing application behaviour in the runtime by changing some of these meta-data structures.Changed e ects can be felt immediately to tenant users through this.
Force SOA requires loose coupling of services, which requires extensive planning and analysis to be done by the Software Architect to ensure the right SOA components and constructs to be placed to get a high degree of performance, scalability and security [10], [11].
An SOA based framework on a series of model engines, model templates, and model description files can be used to come up with a multi-tenant architecture using modelling as an approach [12].Here the execution platform and the core engine remains as the core modules of the architecture.Execution platform is mainly for service execution management and core module engine is the core business and controlling layer for managing models.Once an end user organization gets registered, a model description file will be created and saved.Model description files will contain SaaS multitenant-aware features on di erent layers.Mainly XML based model description files are used to describe the menu details per user and Extensible Stylesheet Language Transformations (XSLT) engine is used to generate HTML.Based on versions of this model description files, SaaS features will get active on certain tenants.As the number of tenants increase, the complexity of the model description files will increase and maintenance will become more di cult in the long run.
An approach name vSaaS in iVIC platform, which is considered a virtual computing environment for Hardware as a Service (HaaS) is proposed for SaaS applications [13].The required software is deployed on iVIC platform to ensure it is accessible through remote streaming approach.The disadvantage of this approach is that only standard software is provided to all users with no customization options.Remote streaming applications tend to take more bandwidth compared to HTTP based ENGINEER web applications.Limitations within virtualize platform may bring in scalability issues for individual software installed.As for this report, remotely installed software virtualization will not be taken into consideration.
Web Services Conversation Language (WSCL) is used to express the views of tenants within SaaS applications [14].Here the business logic can be described in a conversation manner and the model used is composed of a business model and tenant model.The two parts involved in the conversation have the same interaction; but individualized operations.Through guidelines in the conversation manner, WSCL expresses the procedure for obtaining the relevant tenant model and business model in the runtime.As the tenant needs increase, changes to the models will impact on the WSCL files.This will make maintenance a di cult engineering task.
Summary of the SaaS application development architectural approaches are discussed below in Table 1.As the tenant needs increase, changes to the models will impact on the WSCL files.This will make maintenance a di cult engineering task.

Approach
As the approach to develop SaaS applications, we propose a methodology using SaaS architectural framework based on tenant-aware services defined within XML files.Third party web application frameworks with specialized capabilities within di erent layers were integrated as components to solve SaaS challenges.Model Driven Architecture (MDA) based tool was incorporated to allow Software Engineers to generate models and express di erent architectural viewpoints on functional requirements and design decisions.MDA tool artifacts will be placed within the SaaS application framework that will be used at di erent layers of the web application.
MDA is a software design approach that provides a set of guidelines for the structuring of specifications, which are expressed as models  UML is a large and a complex language and it provides mechanisms to allow extensions via stereo-types [20].UML profile can be defined as an extension of the UML standard language with specific elements.Since standard UML 2.0 doesn't fully cater the exact modelling needs or problems of SaaS multi-tenant architectures, a new UML based profile will be introduced to model SaaS applications called: Software as a Service Modelling Language (SaaSML).Based on SaaSML diagrams, Eclipse EMF tool will be used to generate Java code from UML diagrams where Java classes supporting the SaaS framework will be developed as SaaS application business components and multitenant based domain models.Using this approach, we ensure that the SaaS application can be developed and maintained within a short time frame using SaaSML models.Evolution of the SaaS application will be done by changes on the models which will reflect on the application code and XML file.

Multi-Tenant SaaS Architectural framework Overview
A general form of SaaS architectural goals and constraints are discussed in the Table 2.

SaaS framework strategy to solve SaaS Challenges
Table 3 explains the framework strategies adopted to tackle SaaS challenges

Process View
The process view describes the how SaaS metadata services which get triggered within the application.Here a web request-thread based place holder (ThreadLocal) was used to keep tenant configuration data.A login module was developed to authenticate tenant users and check if the tenant billing subscription is valid.If the authentication is approved, a web session will be created and tenant configuration data will be stored within it.Later on subsequent web requests, the tenant configuration data will be stored within ThreadLocal variable.During rest of the thread execution, objects related tenant specific needs will get called within different layers.This process work-flow allows tenant based dynamic behaviour to be triggered at runtime.ENGINEER

Deployment View
The deployment view will resemble the hardware and web server software layers that the SaaS application will be deployed on.It needs to support scalability aspects defined within SaaS Architectural goals.It should also allow integration between different services and access services within the SaaS application to outsiders on a secure and robust manner.Figure 5 shows the main deployment components of the application.Here the SaaS client application will be a browser, mashup, plugin or desktop application that will make use of the SaaS application.Currently we have chosen Amazon EC2 based Linux box with Apache Tomcat6 as the deployment environment for the proto-type SaaS application.Using Eclipse EMF framework, the UML2.0 based SaaSML diagrams will be used to derive the SaaS application domain model and business components.The Java code that is generated through this approach will be based on Eclipse ECore API.This code will mainly consist of Java Interfaces.The implementation of these interfaces can be modified with the use of a Java Emitter Template (JET).Depending on the SaaS application deployment environment, the usage of underline infrastructure services and third part libraries will vary.The generation of Java classes which are dependent on the infrastructure services and third party libraries, can be done using Java Emitter Templates integrated with the EMF framework.

Database
Here ECore models are converted to technology specific Java implementations.This will help Software Engineers to extend the application to multiple platforms even with a common PIM model based on SaaSML.
Usage of SaaSML based MDA approach is shown in Figure 7. Using SaaSML MDA based approach; code generated through SaaSML diagrams can be re-used on other SaaS applications as libraries.Extension to initial Java classes can be enforced through Java Emitter Templates which are knowledgeable on components.

How to couple external business components to the SaaS application?
There could be cases where a proven business logic written for specific business domains, which needs to be coupled within the SaaS application without developing modules from scratch.Let's assume a scenario where third party libraries which handle CRM based billing needs to be coupled within the SaaS application.In such a case, the SaaSML -Billing and Metering diagram needs to be modelled considering these external components or third party libraries.A PSM based JET Ecore Models need to be used to generate Java source compatible for the billing API.With this approach SaaS application framework based billing and metering sources (that can be coupled with the external billing API) can be generated.

How to reuse SaaSML components of one SaaS application in another?
Based on SaaSML models, platform specific Java sources can be generated using MDA approach.These sources can be used within the SaaS application to represent SaaS functionality.Assume a new requirement comes to re-use the SaaSML Java sources within a di erent SaaS application.In such a case, the previously generated SaaSML models can be reused again, but the platform specific transformation can be avoided by integrating previously generated components.
JET templates and ECore models can be used to generate sources which will make use of reusable component as an external business component.Re-usable SaaSML components can be placed within di erent Maven Projects that can be mapped as a dependency with other SaaS application Maven projects.With this approach, SaaSML components can be re-used within other SaaS applications.

Evaluation
Evaluation of the SaaS application was done by comparing it with Force.com& ApprendaCloud based SaaS applications.The aim of this whole exercise was to compare the implemented SaaS features against a similar product to understand its ranking (comparatively).As for the SaaS product evaluation, we used an AHP technique for prioritizing the product features and expert judgement based scoring of the products [24].The ranked sum of weighted scores in descending order gives the ranking of the products as shown in Table 4.The SaaS prototype application carried a ranking of 0.378 (low), ApprendaCloud application carried a ranking of 0.477 (medium).and Force.comapplication carried a ranking of 0.622 (high).This shows that even a quickly developed prototype application using the proposed methodology can be competitive with established applications from globally recognized SaaS providers.A performance study on the prototype application was carried out using JMeter based stress testing tool with sample data sets which represented two Tenant users with different customizations.Tool was used to record workflows of the two types of tenant users and they were simulated in an iterative manner within JMeter Test Plan to generate maximum of 100 concurrent transactions per second on the SaaS web application.Acceptable response time was taken as 5 seconds and throughput as 20 at minimum.By analyzing concurrent user threads (refer Figure 8), response time (refer Figure 9) and throughput (refer Figure 10) over a predefined time duration, we didn't see any performance bottlenecks and felt the prototype application performance is acceptable.Further testing is required to identify suitable deployment environments considering high performance and scalability aspects.Using ATAM we have evaluated the SaaS prototype application.Performance is considered a key sensitivity point which will get impacted by the dynamic configuration options adopted within the framework.

Future Work
Further improvements on the performance side of framework are required based on the evaluation.Extracting modular artifacts from the SaaS framework and porting them to support di erent PaaS environments would be a challenging research.SaaS framework modelling tools for migration between di erent data modelling options can also be considered as a future research topic.

Conclusion
In Results showed that even a quickly developed prototype application, using the proposed methodology can be competitive with [15],[16],[17].MDA allows developing applications and writing specifications, based on a platform-independent model (PIM) of the application or specification's business functionality and behaviour[18].Figure1represents these models as boxes, and their transformations as arrows.MDA tools are used to develop, interpret, compare, align, measure, verify and transform models or meta-models [18],[19].Unified Modelling Language (UML) has been successfully applied in Software Engineering as a general purpose modelling language[20].

Figure 1 -
Figure 1 -Models and transformations in MDA SaaSML is based on UML and involves modelling tenant blocks instead of modelling classes, thus providing a vocabulary that's suitable for Software Engineering on SaaS based web application.A tenant block encompasses software components within di erent layers of the web application.As specified in Figure2, SaaSML reuses a subset of UML2.0.Therefore SaaSML includes ten diagrams based on UML2 Usecase, Class and Object diagrams.SaaSML can be easily understood by the Software Engineering community, due to its direct relation with UML2.SaaSML makes it possible to generate a UML2 based specifications for Software Engineering teams, dealing with the realization of multitenant systems with cloud based hardware and software.Knowledge is thereby captured through models stored in a single repository, enhancing communication within the Software Engineering team.In the long term, tenant blocks can be reused as their specifications and models enable suitability assessment for tenant based customization projects.SaaSML structure diagrams are discussed: "Core Usecase diagram" is a Usecase diagram to model core solution of the SaaS application."Tenant Org Usecase diagram" is a Usecase diagram to model tenant specific customization."Core Domain diagram" is a class diagram to model core solution of the SaaS application."Tenant Org Domain diagram" is a class diagram to model different tenant specific customizations.The "User Hierarchy diagram" is an Object diagram considering authorization User Rights and standard user hierarchies within a tenant organization.The "Tenant User Provisioning diagram" is a component diagram which represents the User repositories (Eg: Ms Exchange/Gmail) which require integration as services.The "Billing Plans and Metering diagram" is a class diagram which represents the SaaS services, billing plans and metering options.The "SaaS Deployment diagram" is a deployment diagram that identifies the required hardware and software considering SaaS application deployment."SaaS Global Settings" is an Object diagram which represents the global settings that needs to incooperated into the SaaS application.The "SaaS Governance Rules diagram" is a based Class diagram which represents rules which needs to ENGINEER be taken governance aspects to derive SLAs against Billing Plans.

Figure
Figure 8 -Graph that represents concurrent user sessions (threads) Vs Test duration

Table 4 -Ranking of products Factor Attributes Score of Force .com app Score of Appre ndaCl oud app Score of SaaS Proto- type
this Journal paper, authors have proposed a SaaS architectural framework that allows MDA based tools to be used in developing SaaS solutions.SaaSML based UML profile was introduced to capture SaaS functional requirements and derive UML2.0 based diagrams to generate modular software components.A prototype SaaS application was developed as a proof of concept.It was evaluated against Force.com& ApprendaCloud based SaaS applications using AHP technique.