Back to Blog
Software

Still Running a Separate Server per Customer? Multi-Tenant SaaS Architecture and Data Isolation Design

Running a separate server and codebase for each customer multiplies the cost of every patch. This guide covers three data isolation models, RLS-based tenant isolation, configuration-driven customization, and a phased migration path.

POLYGLOTSOFT Tech Team2026-10-257 min read0
Multi-TenancySaaSData IsolationArchitectureOn-Premise to SaaS

How Per-Customer Deployments Inflate Operating Costs

Shipping a B2B product as a separate server for each customer feels simple at first. But costs grow in step with your customer count. Branch the code to satisfy one client and you end up fixing the same bug in several branches. Every security patch has to be rolled out server by server.

Say you have 20 customers and each server takes 30 minutes to deploy and verify. That is 10 hours per patch. At four patches a month, you spend 40 hours on deployment alone. Add version drift across customers, and reproducing bugs and handling support tickets gets harder too.

Signs it is time to consider multi-tenancy:

  • You have more than 10 customers, and most use the same core features
  • You maintain three or more customer branches that never get merged back
  • More customers are stuck on old versions than are running the latest
  • Three Data Isolation Models

    | Model | Isolation | Cost | Best for |

    |-------|-----------|------|----------|

    | Shared DB, shared schema (tenant_id) | Low | Lowest | Many small customers, fast growth |

    | Schema per tenant | Medium | Medium | Tens to hundreds of tenants, per-customer backups |

    | Database per tenant | High | Highest | Finance, public sector, contractual physical separation |

    No single model is always right. A realistic setup runs most customers on a shared schema and gives only large, heavily regulated customers a dedicated database. With schema-per-tenant, remember that migration time grows with the number of tenants once you reach the thousands.

    Enforcing Tenant Isolation in Code

    The most common incident in a shared-schema system is a missing `WHERE tenant_id = ?` that exposes another customer's data. Relying on developers to remember it every time will not prevent this.

    Two Lines of Defense

  • Application layer: Resolve the tenant from the request's credentials, and let ORM middleware add the tenant filter to every query automatically
  • Database layer: Apply a PostgreSQL Row Level Security policy such as `tenant_id = current_setting('app.tenant_id')`. With connection pooling, set the value with `SET LOCAL` inside a transaction so it doesn't carry over to the next request
  • By default, RLS doesn't apply to the table owner. Either enable `FORCE ROW LEVEL SECURITY` or connect through a dedicated application role.

    Boundaries Beyond the Database

    Prefix cache keys with `tenant:{id}:`, split file storage by tenant path and access policy, and enforce tenant filters on search indexes. Teams often isolate the database and forget about the cache or file storage.

    Handling Customer Differences Without Branching

    Absorb customer requirements through configuration, not code branches.

  • Tenant settings: Keep differences like logos, number of approval steps, and notification channels in a settings table
  • Feature flags: Turn plan-specific features or customer pilots on and off
  • Extension fields: Store customer-specific attributes in JSON columns or custom field definitions
  • Set a clear rule: if a request would help other customers, build it into the product. If only one customer needs it, handle it outside the core through APIs and webhooks. That keeps your core code clean.

    Noisy Neighbors and Operations

    When one tenant runs a huge spreadsheet import or a heavy report, other customers on the same resources slow down.

  • Cap API request rates and concurrent batch jobs per tenant
  • Move heavy users to dedicated databases or worker pools
  • Support backup and restore per tenant, plus data export and deletion when a contract ends. On a shared schema, test in advance how to restore a single tenant without rolling back the whole database
  • A Phased Migration Roadmap

  • Start with new customers: Offer the multi-tenant version to new customers first and confirm it is stable
  • Migrate near-standard customers next: Move customers with little customization first
  • Leave heavily customized customers for last: Convert their differences into settings and flags, migrate them, then shut down their dedicated servers one by one
  • Migrate to Multi-Tenancy with POLYGLOTSOFT

    Through our subscription development model, POLYGLOTSOFT supports every stage: choosing an isolation model, RLS-based data protection, settings and feature-flag design, and migrating existing customers. There is no large upfront budget, and you can adjust the scope month by month. Send us a requirements document describing your current architecture and customer base, and we will review the best migration path with you.

    Need Technical Consultation?

    Our expert consultants in smart factory, AI, and logistics automation will analyze your requirements.

    Request Free Consultation