Why choose Multi-Tenant Architecture for a SaaS application?
Cloud services and applications are a key trend in software development. They reduce costs and bring the user experience to the next level. Estimated by Gartner, they will become the principal sources of revenue bringing $110.5 billion in 2020 and expected to rise to $143.7 billion by 2022. The cloud platforms or applications can be not only a standard web application created to support a single business, but also designed to help multiple companies at the same time or accessed by various users in the cloud. Depending on the end goal, the software can be created as a Software as a Service (SaaS). SaaS is a broader family that also includes Platform as a Service (PaaS) or Infrastructure as a Service (IaaS).
In this article, I focus on SaaS platforms. The story that I will drive for further discussion is around creating a web application that can support multiple organizations at the same time. The users belonging to these organizations need to access web applications over the internet and need to store their data on the servers. One of the main decisions when creating a SaaS platform to support such a case is to decide how the data storage and computing power should be separated amongst organizations.
Tenant, single-tenant, and multi-tenant
Let’s define terms that will be used for further discussion. A tenant is a group of users belonging to the same customer accessing the web applications. Importantly to note, the group of users is treated as a single entity, and therefore it is charged as one customer. Therefore Single-tenant applications are designed to support only one customer at the time. On the other hand, multi-tenant applications are web applications that support multiple tenants — customers’ users at the same time.
To put the formal definition in the business world, a tenant represents a single organization or business, which uses the given software.
In a single-tenant architecture, the software and infrastructure serve one customer. This means each customer owns an independent data and code base that is developed. The server and infrastructure are not shared between software instances, which allows full customization. We could compare a single-tenant SaaS architecture to a neighbourhood of detached houses. Each customer owns an instance of such a house (meaning software instance, web application) and is able to personalize it independently or without any impact on other instances owned by other clients.
In a multi-tenant architecture, the same instance of the software is shared to be used by different clients. Each of the customers that use the software, shares resources (e.g., computing, web servers, databases) with other customers, but is allowed to have isolated data space. Here, a centralized administration maintains a common codebase application and runs common instances of the application for the multiple tenants (organizations or businesses). We can compare a multi-tenant architecture to a high-rise building. With ready floor plans, the owners of each of the flats within the building are allowed to make minor customizations to the look of the flat. The structure and functionality of each flat are not changed between different flat owners.
Let’s look at the specific differences between single and multi-tenant architecture:
Types of multi-tenant identification
Within the multi-tenant architecture we can also distinguish three main types when it comes to authentication method:
Manual selection before authentication
Show up when a new field on the login form is present. This is the field where the user would manually type in their organization and then enter their email and password as usual.
Manual selection after authentication
Here users have first to authenticate using their username and password. Then they proceed to a page where they select their organization from a list. Then the user goes to the main part of the application.
Automatic selection by subdomain
This is the most accessible type of multi-tenancy to manage, but it is an advanced feature. Here, when the user wants to log into the application, they simply open the page in their browser and authenticate. Users do not see the entire process of authentication going on in the background.
Benefits of SaaS multi-tenant Architecture
With every solution come advantages and disadvantages. Since we know how the two are different from one another, let’s discuss the benefits of a multi-tenant Saas Architecture.
Lower cost per each client
Multi-tenant architecture helps to reduce the costs of investment in the long run. Since the services, applications and databases are shared the charges are lower than in single-tenant architecture. The system is fixed, so the investment cost is more economical. In multi-tenant architecture, individuals are using the same application and database, which lowers the costs of development and maintenance for all of them. What is more, the architecture does not require new software resources or change in code. No charge is necessary when onboarding a new tenant.
Updates for all customers
It is easy to make upgrades since they have to be done at one centralized point. All system updates are pushed to all users immediately. This is a great time-saving benefit.
Multi-tenant SaaS models share all resources among all customers. Because of that, computing power and storage are effortless to upgrade. Every software or hardware resource improvement instantly affects all customers with a little amount of work.
Higher efficiency
Multi-tenant SaaS architectures offer speed and reliability. Since code, elements of the technology stack and databases are shared, it is easier to optimize speed, utilization and response time. Because of the nature of the architecture, most optimizations will improve the system for every individual. What is more, customers never have to add more server capacity.
Adding new customers is painless
Adding new customers has always been a big challenge for software vendors. Multi-tenant applications offer the benefit of an automated signup process. Tasks like setting the default data and configuration of the application are all automated. The configured domain and the sub-domain can also be automated.
Easy maintenance
The multi-tenant architecture is developed in a way to make it easier for the vendors to maintain their application. Because the code and all data structures are shared, any addition to codebase whether a bugfix or a new feature — all of them are pushed to all customers at once.
Security
Multi-tenant architectures are built with security in mind. Applications with such a model ensure that security will be on the same level for all — past, present and future customers. Since from a technical point of view everyone is using the same application, all security measures are always applied to everyone.
Cons of SaaS multi-tenant Architecture
On the other hand, we cannot look past the disadvantages of choosing this solution. We should be aware that it might not 100% suit our needs due to it being:
More complex
Because multi-tenant architecture artificially separates data between tenants, it always comes with additional complexity caused by logic building the separation.
Prone to longer downtime
Multi-tenant architecture is supported by large databases that require software and hardware downtime regularly. This can cause availability issues for customers. If one of the clients experiences some problems there is a good likelihood that others will as well.
Performance is the same for everyone
Since every tenant uses the same instance of the application, it is not possible to give one tenant more computing power than the other. Although it is possible to increase overall application performance if two clients of very different scales will use it, the application will need to be scaled to the one with the highest requirements.
Summary
Taking everything into account, a multi-tenant SaaS architecture offers more long-term benefits both in terms of development and investment than a single-tenant one. It gives excellent data capacity and a higher ceiling for businesses. That is why most SaaS services operate on multi-tenancy. In comparison to a single-tenant architecture, it is cheaper, it is easier to maintain and update and makes use of resources more efficiently. What is more, multi-tenant software is secure and easily scalable.
If you want to know How to design a Saas Application, read our post here. And if you are looking for a Multi-Tenant SaaS development partner, contact our best development team.
Originally published at Why Choose A Multi-Tenant Architecture For SaaS App.