Introduction
Multi-tenant architecture has seen widespread adoption in cloud computing. Before the dawn of the cloud, most of the businesses used single-tenant architecture. This pattern didn’t scale well and added to Software provider’s maintenance costs.
In this newsletter, I’ll discuss the actual meaning of multi-tenant architecture, it’s benefits, & a real-world analogy. We will explore how multi-tenant won over the single-tenant architecture in the cloud environment.
Pre-Cloud era & Single-tenant system
Let’s assume that we are in the early 2000s when the cloud was in its infancy. Let’s say you are developing a B2B software to manage payroll of different companies. What do you think you would need to start the business & provide solutions to your customers?
You would need three important things - compute, storage and network to run your software. For running your application, an on-premise server would be needed. You would purchase a secondary storage device to store customer’s data. And a computer network using which the customers would communicate with application servers.
Every customer would have its computer managing the application and data. Customer’s application and data would be isolated from each other. In a nutshell, this is how the single-tenant system worked.
Pitfalls of Single-tenant systems
What do you think are the downsides of using the above approach?
Cost - We are unaware of the customer’s data and application usage patterns. One of our customers may have a thousand employees using our software. Another customer may have only a handful of employees using it. This would lead to a waste of lot many resources. For eg: Purchasing a storage device of 1 TB when we don’t expect to store more than 1 GB.
Single Point of Failure - If the server of one company goes down, all the users of that company will be impacted. This will result in significant downtime & poor user experience.
Scalability - With the growth in our customer base, the storage & compute requirements will also rise gradually. How would we scale? By deploying many instances of server per client. If the client’s demand shrinks, it would lead to resource wastage.
Multi-tenant system
A multi-tenant system works by sharing resources among many clients. Every client is isolated from each other. The clients are charged as per the resource usage. This results in efficient utilization of computing resources.
Let’s consider an analogy with a building containing multiple apartments. Family or individual can purchase one or more apartment and become tenants. Every tenant has a key to the house it owns. A tenant can welcome his friends or family members in the building. Furthermore, one tenant can’t enter another tenant’s house directly without authority.
The building provides resources such as water, electricity, swimming pool or gymnasium. These resources can be shared by every tenant. Tenants in the building are charged as per their resource usage.
How Multitenancy works in Cloud
Cloud provides like Amazon AWS, GCP or Azure are support multitenancy. Customers of Cloud vendor share the resources with each other. For eg:- Netflix & Airbnb may share servers to run their application. But, there is a demarcation on sharing of tenant’s data. Hence, Netflix can’t access Airbnb’s data and vice-versa.
Cloud provider maintain configuration per tenant. Usage of storage and computing power is controlled by the configuration. Cusotmers can leverage containers to run self-contained bundles of services, libraries, & system settings. Containers make application system or host agnostic.
Further, using serverless computing, customers can chose to get billed as per their usage of compute power. In serverless model, clients are not assigned physical servers. In this model, the application is broken down into smaller blocks known as Functions. These Functions are then run on-demand. The model is also known as Function-as-a-Service or FaaS.
Almost all modern websites are cloud based. Hence, a person can access their gmail account upload & send content using multiple devices.
Benefits of Multitenancy
Multitenancy overcomes the limitations imposed by single tenant system in the following ways :-
Cost optimization - Customer of a cloud provider only pays for the time it uses the resources. The same applies to data storage. Costs increase linearly with the growing requirements for storage space. It overcomes the fixed cost model in single tenant system.
Resource utilization - Multitenancy improves the resource utilization. A single tenant system results in lot of maintenance overhead as there is one machine per tenant.
Scalability - Customers can auto scale their systems on demand. Single tenant system offers rigidity in scaling
Downsides of Multitenancy
Security - Since many tenants share resources, it’s essential to add a layer of isolation between them. The system must be carefully designed taking security into account. Any security loophole may expose data of one tenant to another. Thus, resulting in loss of privacy. Regulations prevent companies from storing their customer’s data in a shared infrastructure.
Noisy Neighbour problem - One tenant may consume huge amount of computing power or storage space. This may hinder the performance of other services. Its essential for the Cloud provider to properly configure their resources for every tenant.
Nicely Explained.
Links to how the same servers are shared between multiple clients can be useful to newbies.