Skip to content

Design Trade-offs of a Multi-Tenant IoT Platform: How Much Isolation Is Enough ​

Multi-tenant IoT architecture diagram

Turning a single-tenant IoT platform into a SaaS looks like "just add a tenant_id field" — until you actually start, and every layer asks the same question: how much isolation is enough?

Three Tiers of Data Isolation ​

ApproachIsolationCostBest for
Shared tables + tenant_idWeakLowestSMB customers, standardized features
Separate schemaMediumMediumCustomers with customization needs
Separate databaseStrongHighestLarge customers, compliance-sensitive industries

What makes IoT scenarios special is that the data comes in two layers: business data (device profiles, alerts, users) is small in volume but complex in structure, while time-series data (telemetry) is huge in volume but simple in structure. There's no need for a one-size-fits-all approach — a common pragmatic choice is shared tables for the business database plus tenant-tagged time-series data, with tenant filtering uniformly injected at the query layer.

The Hidden Costs of Shared Tables ​

If you choose the cheapest option — shared tables — the bill arrives in these places:

  • The authorization defense lives in code: every SQL statement, every cache key, and every message subscription must carry the tenant context; a single miss anywhere is a horizontal privilege-escalation vulnerability. Inject it uniformly with an ORM interceptor/plugin rather than relying on developer discipline;
  • Noisy neighbors: when one tenant's tens of thousands of devices report in a burst, shared resources (connection pools, thread pools, write bandwidth) get squeezed and every other tenant jitters along. You need per-tenant rate-limit quotas;
  • Backup and deletion: exporting a single tenant's data or deleting it on account closure means "carving" rows out of shared tables — no small amount of work under GDPR-style compliance requirements.

Tenant Awareness at the Connection Layer ​

The MQTT access layer is no exception: device authentication must resolve which tenant a device belongs to, and Topic permissions must be isolated per tenant — a device of tenant A must never be able to subscribe to a Topic of tenant B. It's best to configure the broker's ACL rules once with wildcards plus a tenant prefix, rather than writing a rule for every device.

My Recommendations ​

  1. Early stage: shared tables + strict tenant-context injection, with "isolation correctness" covered by automated test cases;
  2. When a large customer arrives: deploy a dedicated instance for them (separate database + separate broker cluster) — isolation through configuration;
  3. Tag time-series data by tenant from day one; it has the lowest migration cost.

The essence of multi-tenant design is not technology selection, but finding the balance between commercial pricing and technical complexity: the stronger the isolation, the higher the per-customer cost. Make isolation an optional tier and let it become part of your pricing system.

Last updated:

Recent Update

FastBee | fastbee.cn