Multi-Tenant Architecture in a Nutshell

Multi-Tenant Architecture in a Nutshell

Thanks to the original writer and article :

https://medium.com/nerd-for-tech/multi-tenant-architecture-in-a-nutshell-78dafe7dc847


Multitenancy explained in simple words

We’re going to use a straightforward comparison to describe the idea of multi-tenancy. Let’s say you have to go to the bank. Ask about any service your bank offers, such as cash withdrawal, credit, insurance, or any other. You don’t speak to other clients. You might not even run into any. This is essentially how multiple tenancies operate. Users in a cloud have access to the same server, but their level of access and the capabilities they may utilize vary. Their data, business logic, usage history, and any other information are all completely isolated at the same time.


Use Cases

Multi-tenant architecture best suits the following types of applications:


  1. SaaS (software as a service) or AaaS (applications as a service)
  2. PaaS (Platform as a Service)
  3. IaaS (Infrastructure as a Service)
  4. For all other applications where multiple clients use the same stack of algorithms. The main functionality is either the same or modular, and it can be tailored to any of the client’s needs.

What is multi-tenant architecture definition?

An example of a software design that allows for tenant isolation while allowing them to use the same infrastructure, database, or computer resources is the multi-tenant architecture. Despite using the same software, the tenants are completely anonymous, have no access to one another’s data, and maintain complete confidentiality regarding their own data. Each tenant may have varying levels of access, and this may also affect the functionality and will be able to configure unique functionality and use the same app with various features in this way.


Key differences between single-tenant and multi-tenant models

Isolation

single-tenant: A separate app, infrastructure, and database for each tenant?multi-tenant: A single app and shared resources for all tenants


Security

single-tenant: Full isolation for a potentially more secure app

multi-tenant:?Tenants may share the same database, so additional security steps should be taken by the vendor

Scalability

single-tenant: Complicated scalability implementation as every tenant uses a separate app

multi-tenant:?Quick scaling; easy to add or remove features and resources

Customizability

single-tenant: Tenants can customize their apps according to their needs

multi-tenant:?Limited customization opportunities


Data Management in Multi-Tenant Applications

Depending on the way of storing data, there may be different multi-tenancy database solutions:


Single database + single schema

No alt text provided for this image

One database schema contains data of all tenants

Caring about the tenants’ data separation is the most important in this case. Add database indexes like?TenantID?or?ClientID?to partition tenant rows.

Benefits

  • Upkeep of a single database is simple (compared to other options)
  • You are free to add as many new clients as you like (adding is as easy as typing a new record in the table).


Cons

  • There isn’t a lot of flexibility for a variety of consumers who could need various data usage habits.\
  • When a client who is not typical arrives, crutching and patching are required.
  • You run the risk of wasting time and energy trying to segregate the permissions correctly.
  • Backup and recovery could result in new issues. A table is difficult to drop and recreate since it holds information from previous clients. It is really annoying to have to seek for and replace necessary rows.

Single database + multiple schemas

No alt text provided for this image

Multiple tables are required in this scenario to store data from different clients. Schemas become ‘namespaces’ that incorporate specific tables, procedures, and permissions.

Benefits

  • Upkeep of a single database is simple (compared to other options)
  • You are free to add as many new clients as you like (adding is as easy as typing a new record in the table).


Cons

  • There isn’t a lot of flexibility for a variety of consumers who could need various data usage habits.
  • When a client who is not typical arrives, crutching and patching are required.
  • You run the risk of wasting time and energy trying to segregate the permissions correctly.
  • Backup and recovery could result in new issues. A table is difficult to drop and recreate since it holds information from previous clients. It is really annoying to have to seek for and replace necessary rows.

Separate databases

No alt text provided for this image

Another possible model is when the code and data are shared conceptually (and possibly physically) between clients (through a common user interface and business logic).

Benefits

  • One-click extensibility.
  • Only a new storage needs to be set up in order to add a new client, Scaling is easy to do.
  • Client databases on various servers might be supported by Customization.
  • Each client’s settings can be modified (and even move the storage to a different DBMS)
  • basic backups.
  • The other components are unaffected even if one fails.

Cons

  • It was expensive. A single server can only accommodate a certain amount of storage. More equipment will probably be required (much more than when everything is kept in one spot). Remember that extra gear entails the need for more administrators, server room space, and power costs. It was expensive.
  • The data is spilled into the swap file when your server hosts numerous locations and the overall volume is more than the RAM space, making access to the hard drive extremely slow.

Types of multi-tenancy use cases

  • SaaS (Software-as-a-Service) or AaaS (Application-as-a-Service)?: A complete software solution that organizations purchase on a pay-as-you-go basis from a cloud service provider.
  • PaaS (Platform-as-a-Service):?A multi-tenancy development environment that users can use to deliver everything from simple cloud-based apps to cloud-enabled enterprise applications. Since the development environment is not hosted locally, developers can work on the application from anywhere in the world.
  • IaaS (Infrastructure-as-a-Service): A type of cloud computing service that offers essential computing, storage, and networking resources on demand, on a scalable basis. Each resource is offered as a separate service component, and teams only pay for a particular resource as long as they need it.
  • For any other application where multiple clients use the same stack of algorithms. The main functionality can be the same or modular and it’s tailored to any of the client’s needs.

Multi-Tenant Architecture: Pros and Cons

Here are the key advantages of multi-tenant architecture:


  • Lower costs: Multi-tenancy enables the serving of multiple tenants using a single instance, helping support the infrastructure. Since tenants share responsibilities over software maintenance, data center operations, and infrastructure, the ongoing costs are lower. It allows providers to offer SaaS software for a predictable annual or monthly subscription price.
  • Scalability and improved productivity for tenants: A multi-tenant architecture enables tenants to scale on demand. New users can access the same software instance, typically incurring an incremental subscription rate increase. Tenants do not need to manage software or infrastructure, freeing up their time for other important tasks.
  • Customization without coding: Most SaaS multi-tenancy vendors provide a high level of customization to ensure each tenant customer can customize the application according to specific business needs. It differs from custom development by minimizing risks and reducing work time and costs.
  • Continuous, consistent updates and maintenance:?Multi-tenant software providers are responsible for patches and updates. They apply new features and fixes without any effort required on the customer’s part. Unlike a single-tenant architecture that requires providers to update every software instance, multi-tenancy involves one update.

Here are notable drawbacks of multi-tenant architecture:

  • Vulnerability: A multi-tenant environment allows multiple access points for users, which can increase the threat of a security breach.
  • Complexity: Serving multiple clients in one instance of an application/database adds an extra level of complexity to the codebase and database maintenance.
  • Backup: A multi-tenant environment makes backup and restoration more complex, so not all providers offer reliable restoration services.
  • Less customization: A multi-tenant environment offers fewer customizations, so users have less control over the quality. There can be pressure to add customizations for individual tenants, especially if they are large organizations.
  • Global problems: If a technical problem occurs on the provider’s end, it can lead to issues for all users. This may apply to uptime, system upgrades, and other global processes.

Multi-Tenant Authentication

One of the main challenges when building multi-tenant applications is managing user identities:

  • Each user has credentials provided by their own tenant.
  • Users should be able to access their own data, but not other tenants’ data.


The authentication process is as follows:

  • Users log in to the application using their existing organizational credentials.
  • All users from the same organization belong to the same tenant.
  • When a user logs in, the application identifies the relevant tenant and provides access to it.

The authorization process is as follows:

  • When the application authorizes a user’s request (e.g., to view a resource), it must consider the user’s tenant.
  • Users can have assigned roles in the application (e.g., standard user or administrator). The customer organization, not the SaaS provider, should manage these role assignments.

How to Improve Multi-Tenancy Security

Use the following best practices to ensure a multi-tenant architecture is secure:

  • Effective Governance and Compliance Processes: Before you implement multi-tenancy, establish a privacy, security, and compliance policy that protects your tenant’s corporate and intellectual property or properly isolates tenants according to their sensitivity.
  • Enable Process Auditing:?Ensure that independent parties can audit the compliance of IT systems, especially those hosting applications and tenant data.
  • Ensure Effective Separation:?A cloud provider must enforce virtual infrastructure encryption policies and access controls to partition cloud deployments from each other and effectively isolate tenant data.
  • Monitor Data Sharing: Discover and monitor permission settings applied to shared files, including those shared with users outside your organization via web links.
  • Implement Data Loss Prevention (DLP):?this?can ensure that data stored in a tenant is not lost or stolen by attackers. It can also prevent downloads of sensitive data to personal devices.

Conclusion

I hope you’ve got enough information about multitenancy from this article


Here are the key takeaways from this article:

  1. The?multi-tenant environment?hosts isolated users that share computational, networking, and storage resources.
  2. When operating in multitenancy, you?benefit from?cost savings, increased resource utilization, reusable data processing elements, simple release management, and lower maintenance costs.
  3. On the other hand, you should be ready to face such?drawbacks?as complex development, high release risks, limited personalization, fragile security, lower performance, and complications in making changes.
  4. Think twice before applying to a multi-tenant scenario. But you can be sure while selecting it for?SaaS, PaaS, PaaS, IaaS, and other applications where core functionality is either the same for all users or strictly modular and can be easily tailored to typical clients’ needs.

要查看或添加评论,请登录

社区洞察

其他会员也浏览了