Mastering SaaS Tenant Data Routing: Design, Implementation, and Best Practices
This session explains why SaaS applications need tenant data routing, compares multi‑tenant sharing models, details dynamic data source architecture, routing plugin design, tenant identifier propagation, and future sidecar solutions, helping developers choose appropriate isolation strategies, configure flexible data sources, and avoid cross‑tenant data contamination.
Course Overview
The Huawei Cloud Developer Alliance presents a technical series on SaaS application development, focusing on tenant data routing, architecture, and implementation. Experts guide developers on using Huawei Cloud capabilities to build and innovate SaaS applications.
Series Schedule
Episode 1: Typical Architecture of SaaS Cloud‑Native Applications
Episode 2: SaaS Application Technical Architecture Design
Episode 3: SaaS Data Routing Design and Implementation
Episode 4: SaaS Solution Sharing
Why Tenant Routing Is Needed
A qualified SaaS application must isolate tenant data while accommodating varying tenant costs and budgets. As business scale changes, selecting and implementing appropriate tenant data isolation methods becomes essential.
Tenant Routing Scenarios
When a tenant has dedicated application and data layers, data is naturally isolated and no routing is required.
When multiple tenants share application or data resources, proper data routing is needed to ensure isolation across shared layers.
Dynamic Data Source Architecture
Dynamic data sources are configured via YAML, grouping a primary and multiple replicas. Tenant‑to‑data‑source bindings can be defined separately, allowing flexible association, schema‑level binding, and independent modification of data source groups.
The dynamic data source group consists of multiple connection pools. It supports hot‑adding tenants, binding them to existing pools, and migrating tenants between shared and dedicated databases without downtime.
Tenant Identifier Propagation
Tenant identifiers are typically passed in request headers, cached at the session level, and cleared after request completion to prevent thread‑pool contamination.
Plugin Design and Future Sidecar
The current routing plugin is provided as an SDK, which is invasive‑light, low‑cost to adopt, and configurable. For larger tenant scales, a sidecar version is planned to overcome language barriers, offering resource allocation strategies, unified management, and visualized routing.
Course Summary
The routing plugin has low intrusion and simple configuration, suitable for modest tenant volumes. When tenant numbers grow, a comprehensive management system or sidecar solution becomes necessary to handle dynamic data source binding, routing policies, and cross‑language support.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Huawei Cloud Developer Alliance
The Huawei Cloud Developer Alliance creates a tech sharing platform for developers and partners, gathering Huawei Cloud product knowledge, event updates, expert talks, and more. Together we continuously innovate to build the cloud foundation of an intelligent world.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
