Definition

What Is Multi-Tenancy? Single vs Multi-Tenant, Explained

One deployment, many customers, and no customer can see another's data. Here's how multi-tenancy works, the three ways to isolate tenants, and what changes when you add chat.

Single-tenant vs multi-tenant

Single-tenant

Multi-tenant

Who shares the deployment

No one; one customer per instance

Many customers on one instance

Cost per customer

Higher; infrastructure per customer

Lower; infrastructure is shared

Data isolation

Physical, by default

Logical, enforced in code or the database

Updates

Rolled out per customer, often on their schedule

One release reaches every tenant

Customization

Deep, including custom versions

Configuration and feature flags

Noisy-neighbor risk

None

Needs per-tenant quotas and rate limits

Onboarding a customer

Provision a new stack

Create a tenant record or app

Best for

Strict compliance or very large customers

Most SaaS products

What is multi-tenancy?

In a multi-tenant system, one deployment of an application serves many customers at once. Each customer is a tenant: a company, a school, a team workspace, a store on an e-commerce platform. Tenants share the code, the servers and often the database, but each one sees only its own users, data and settings.

NIST's definition of cloud computing describes the same idea as resource pooling: computing resources serve many consumers "using a multi-tenant model" and get reassigned as demand changes.

The opposite is single-tenant: each customer gets its own copy of the application and its own infrastructure. That's easier to reason about and more expensive to run, which is why most SaaS products are multi-tenant and reserve single-tenant setups for their largest or most regulated customers.

How multi-tenancy works

1. Every request carries a tenant

The app works out which tenant a request belongs to, from a subdomain (acme.example.com), a claim in the user's token or an API key. That tenant ID travels with the request through every service.

2. Every query is scoped

Data access filters by tenant ID. In a shared database you can enforce this in the database itself, for example with PostgreSQL row-level security policies, so one forgotten WHERE tenant_id = ? doesn't leak another customer's rows.

3. Configuration lives per tenant

Feature flags, branding, limits, webhooks and retention rules are stored per tenant, so one customer's settings never change another's.

4. Usage is metered per tenant

Shared infrastructure still needs per-tenant numbers for billing, quotas and spotting the one customer who is using everyone's capacity.

Multi-tenant isolation models

Where you draw the isolation line is the main design decision. AWS and Microsoft both document the same spectrum in their SaaS guidance.

  • Shared database, shared schema. All tenants' rows sit in the same tables with a tenant_id column. Cheapest to run and simplest to update, with the weakest isolation. AWS calls this the pool model.

  • Shared database, schema per tenant. Each tenant gets its own set of tables inside one database. Isolation is clearer, but every migration runs once per schema.

  • Database per tenant. Each tenant has its own database, sometimes its own full stack. Strongest isolation, simple per-tenant backup, restore and data location, highest cost. AWS calls this the silo model.

Many products mix them, which AWS calls the bridge model: small customers share a pool, while large or regulated customers get a silo.

Multi-tenant chat for SaaS platforms

If your product serves many businesses and you add chat or calling, the chat layer has to respect the same tenant lines as the rest of your app.

  • No cross-tenant contact. A user at one customer should never find, message or call a user at another. User search, group lists and presence all need tenant scoping.

  • Per-tenant settings. One customer wants a profanity filter and file sharing off; another wants neither. Moderation rules, notification templates and webhooks differ by tenant.

  • Per-tenant usage. Monthly active users, concurrent connections and call minutes need to roll up per customer so you can bill or cap them.

  • Onboarding by API. New customers sign up at any hour, so creating their chat space has to be automated.

The two common approaches mirror the database models: tag users and conversations with a tenant ID inside one chat app, or give each tenant its own isolated chat app and manage them all from one account.

Limits and pitfalls

  • Noisy neighbors. One tenant's traffic spike slows everyone in a shared pool. Set per-tenant quotas and rate limits.

  • One missing filter leaks data. In a shared schema, a single unscoped query exposes other tenants. Enforce scoping in a shared data layer or the database, and test for cross-tenant access.

  • Everything needs a tenant key. Caches, search indexes, queues, logs and file storage need tenant scoping too, along with the main database.

  • Migrations multiply. With a schema or database per tenant, every migration runs once per tenant, and a failure halfway leaves tenants on different versions.

  • Enterprise asks. Large customers may ask for their own database, their own encryption keys or a specific data region. Plan a path from pool to silo before the first deal needs it.

  • Single-tenant restore is hard in a pool. Restoring one tenant's data from a shared backup, without touching anyone else, takes tooling you build in advance.

Rule of thumb: start pooled, enforce tenant scoping below your application code, and keep a silo option ready for the customers who will pay for it.

Multi-tenant chat with CometChat

If you're a SaaS platform adding chat or calling for each of your customers, CometChat's multi-tenancy maps each customer to its own isolated chat app.

One isolated chat app per customer, one bill

In CometChat, an app is a self-contained chat environment with its own users, groups, messages, roles and configuration, and its data is isolated from other apps. With multi-tenancy enabled, you create an app for each customer through the App Management APIs, choose its region (us, eu or in), and configure extensions, webhooks and widgets in code. Every tenant app draws on the base app's quotas (MAU, PCC, and voice and video minutes), usage is billed together, and you can generate a consolidated usage report from the base app. Multi-tenancy is enabled per account on plans that support it, through CometChat's team.

Explore multi-tenant chat · Read the multi-tenancy docs

Frequently asked questions

What is the difference between single-tenant and multi-tenant?

Single-tenant gives each customer its own instance of the application and its own infrastructure. Multi-tenant runs many customers on one shared instance and separates their data logically. Multi-tenant is cheaper and simpler to update; single-tenant gives stronger isolation and more room for customization.

What is a tenant in multi-tenancy?

A tenant is one customer of a shared application, usually an organization with its own users, data and settings. In a B2B SaaS product, each company account or workspace is a tenant.

Is multi-tenant architecture secure?

It can be, if isolation is enforced everywhere data lives: databases, caches, search indexes, file storage and logs. Most multi-tenant data leaks come from a query or cache key that forgot the tenant ID, so enforce scoping centrally and test for cross-tenant access.

What is an example of multi-tenancy?

A team chat tool where every company gets its own workspace on the same servers is multi-tenant. So is a learning platform where each school sees only its own teachers, students and classes.

Which multi-tenant database model should I use?

Most teams start with a shared schema and a tenant_id column because it is cheapest and easiest to run. Move specific tenants to their own schema or database when they need stronger isolation, their own backups or data in a particular region.

Related terms