Ad Tech Multi-Tenancy: A Spectrum of Isolation Architectures on AWS

CK CK 3788 
Created at
Updated at  
337 0 0

Ad tech platforms serve hundreds to thousands of customers simultaneously: advertisers, agencies, publishers, networks. Each customer (tenant) expects isolated data, isolated compute resources, and isolated audit trails. Multi-tenancy is the architectural choice to share infrastructure (databases, servers, message queues) efficiently while maintaining logical and physical isolation. The challenge is preventing noisy neighbor problems—one tenant's expensive query or burst of traffic must not degrade another's performance—and enforcing fine-grained access control.

Three approaches span a spectrum: shared cluster with tenant tagging and row-level security (RLS) at the database layer, per-tenant logical schemas or databases within shared infrastructure, and per-tenant cells (complete physical isolation: dedicated cluster, database, message queues). The choice depends on customer base size, SLA strictness, and cost tolerance. A startup serving 100 agencies uses shared cluster with RLS; a mature platform with 10,000 SMB advertisers might use per-schema isolation; a mega-platform with demanding enterprise customers operates per-tenant cells.

Ad Tech Multi-Tenancy: A Spectrum of Isolation Architectures on AWS

This case explores isolation strategies, noisy-neighbor mitigation, tenant-aware billing/metering, and audit isolation using AWS services (Aurora PostgreSQL, DynamoDB, ECS Fargate, ElastiCache, AWS Cloud Map, IAM).

Ad Tech Multi-Tenancy: A Spectrum of Isolation Architectures on AWS

 

Key Requirements

Functional Requirements

  • Logical isolation: Tenant A cannot see Tenant B's data (campaigns, conversions, reports) via any query or API.
  • Rate limiting: Tenant A's workload (QPS, concurrent connections, storage growth) does not impact Tenant B's SLO.
  • Multi-tenancy abstraction: Queries automatically filtered by tenant_id; developers should not need to remember "WHERE tenant_id = ?" in every query.
  • Tenant lifecycle: onboard new tenant (create schema/DB, assign ID, configure quotas), offboard (archive data, verify deletion).
  • Billing/metering: track usage (API calls, storage, compute) per tenant for chargeback or revenue recognition.
  • Audit trail: tenant-specific logs; audit access to any tenant's data.
  • Fair resource share: under contention, quota-based allocation prevents starvation.

Non-Functional Requirements

  • Tenant count: support 100–100,000+ tenants without linear cost growth.
  • Noisy neighbor resilience: one tenant's runaway query must not block other tenants' requests. p99 latency impact <10%.
  • Query isolation: tenant-specific queries, indexes, and query plans do not interfere.
  • Storage growth: one tenant maxing out storage quota should not affect others' provisioning.
  • Failover / disaster recovery: tenant data must not be lost or leaked during failover.
  • Compliance: GDPR right-to-forget, CCPA deletion, SOC 2; tenant data fully erasable without affecting other tenants.

 

 

Simplified Architecture

Ad Tech Multi-Tenancy: A Spectrum of Isolation Architectures on AWS

 

 

Architecture Proposals

Option 1: Shared Cluster with Tenant_ID Tagging + RLS + Rate Limiting

All tenants share one Aurora PostgreSQL cluster, one ElastiCache Redis cluster, and one ECS Fargate service pool. Each row in a multi-tenant table includes a tenant_id column. Aurora Row-Level Security (RLS) enforces tenant filtering at the database layer: role-based policies automatically filter queries. Application-level middleware (running on ECS Fargate) injects tenant_id into request context and JWT claims. Rate limiting (Redis-backed, per tenant) enforces quota on API calls, concurrent connections, and query resource consumption.

Ad Tech Multi-Tenancy: A Spectrum of Isolation Architectures on AWS

Pros:

  • Cost efficient: single Aurora cluster, ElastiCache, ECS Fargate fleet; minimal operational overhead.
  • Simple scale-out: add tenants without provisioning new infrastructure.
  • Uniform deployment: updates, patches applied once to benefit all tenants.
  • Resource sharing: idle tenant does not reserve resources; spare capacity used by active tenants.
  • IAM-driven access: JWT claims map to IAM roles; tenant isolation via IAM permission boundaries.

Cons:

  • Noisy neighbor risk: expensive query from Tenant A consumes CPU/disk I/O, slowing Tenant B.
  • Query plan interference: one tenant's large JOIN query can cause PostgreSQL planner to choose suboptimal plans for other tenants' queries.
  • Storage contention: if Tenant A's storage quota not enforced at DB level, could fill cluster disk, breaking all tenants.
  • Debugging complexity: logs, metrics for all tenants mixed; must tag and filter.
  • Shared resource limits: one tenant hitting connection limit (Aurora max_connections configurable, typical 5,000) blocks others.

Failure Modes & Mitigations:

  • Tenant A's expensive query: implement query timeout (e.g., 30 seconds) at application layer; kill runaway queries via Lambda. Per-tenant query budget (CPU cost units/hour) tracked in CloudWatch.
  • Connection pool exhaustion: Tenant A opens 50 connections, leaving limited pool for others. Mitigate: enforce max_connections per tenant in application (e.g., Tenant A max 25, others 5 each) via PgBouncer on ECS.
  • RLS bypass: developer forgets to apply RLS policy to new table. Mitigate: policy-as-code in Terraform; default-deny RLS on all tables; deny SELECT by default, require explicit grant.
  • Storage disk full: Tenant A's audit log grows unbounded. Mitigate: enforce storage quota per tenant (10 GB default) via S3 archival Lambda trigger; alert at 80%, block writes at 100%.

When to Choose:

  • Tenant count <500 and relatively homogeneous (similar query patterns, storage size).
  • SLA tolerant of occasional latency spikes (p99 <500 ms acceptable).
  • Operations team small; cannot manage per-tenant infrastructure.
  • Cost per tenant must be minimal (startup mode).


 

Option 2: Per-Tenant Schemas or Databases (Logical Isolation)

Shared Aurora PostgreSQL cluster; each tenant gets dedicated schema (or separate database). Data is logically isolated at the schema level. Tenant_id no longer needed in every table; isolation enforced by schema-level permissions. Rate limiting still shared cluster-wide via ElastiCache, but each tenant's queries run in separate schema with dedicated indexes and statistics. Aurora supports up to 1000+ schemas per cluster.

Ad Tech Multi-Tenancy: A Spectrum of Isolation Architectures on AWS

Pros:

  • Query plan isolation: Tenant A's queries do not interfere with planner for Tenant B; each schema has independent statistics.
  • Cleaner access control: Postgres roles per tenant; GRANT only on schema_42 to tenant_42_role.
  • Easier debugging: tenant A's tables, indexes isolated; monitoring more transparent.
  • Index customization: Tenant A can add custom indexes without affecting others.
  • Data migration: moving tenant to different infrastructure simpler (dump schema, restore elsewhere).

Cons:

  • Storage overhead: per-tenant schema overhead (system tables, constraints). 1000 tenants × 1 MB schema metadata ≈ 1 GB wasted.
  • Connection contention: shared pool; still vulnerable to noisy neighbor stealing connections.
  • Maintenance complexity: schema migration (e.g., adding column) requires batching across tenants; cannot be instant.
  • Shared query cache: Aurora query cache (prepared statements) shared; one tenant's queries can evict another's from cache.
  • Still single database failure: outage affects all tenants; no isolation at cluster level.

Failure Modes & Mitigations:

  • Tenant A maxes storage quota: Aurora disk fills, all tenants blocked. Mitigate: per-schema tablespace (separate EBS volume), enforce quota at tablespace level, alert before hit.
  • Tenant A's DDL locks schema: ALTER TABLE on Tenant A's campaigns blocks schema operations. Mitigate: use CONCURRENTLY option; schedule DDL during low-traffic windows; use EventBridge for coordinated maintenance.
  • Connection pool starvation: Tenant A opens 30 connections; others starve. Mitigate: PgBouncer connection pooling on ECS, per-tenant connection limits.

When to Choose:

  • Tenant count 500–5,000 with moderate isolation requirements.
  • Can manage per-schema backups, migrations.
  • Operations team 2–5 people; can automate schema provisioning via Terraform.
  • Need query plan isolation but not full physical isolation.


 

Option 3: Per-Tenant Cell (Full Physical Isolation)

Each tenant (or cohort of <10 top tenants) gets dedicated infrastructure: Aurora PostgreSQL instance, ElastiCache Redis cluster, ECS Fargate service, Kinesis Data Streams topic. Tenants in different cells never share compute or storage. Only metadata (AWS Cloud Map service registry), billing systems (DynamoDB), and control plane (Route 53) are shared. This is the most operationally complex but provides complete isolation.

Ad Tech Multi-Tenancy: A Spectrum of Isolation Architectures on AWS

Pros:

  • Perfect isolation: Tenant A's hardware failure, DoS, or runaway query zero impact on Tenant B.
  • Custom SLA: each cell can have different Aurora backup frequency, failover policy, Kinesis shard count.
  • Scaling knob: Tenant A's growth does not affect capacity planning for others.
  • Debugging clarity: all metrics, logs, queries isolated; easy to correlate events to tenant.
  • Compliance: Tenant A in EU (eu-west-1), Tenant B in US (us-east-1); deploy cells in correct region; KMS keys per tenant.
  • Data residency: each tenant's data stays in specified region; satisfies regulatory requirements.

Cons:

  • Operational burden: managing 100+ Aurora clusters, monitoring, patching, backups per cell.
  • Cost: each cell 3–5x cost of shared cluster; provisioning N cells costs linear in N.
  • Idle waste: small tenant in dedicated cell wastes capacity; must enforce minimum tenant tier.
  • Data transfer: cross-cell queries, reporting impossible without moving data; eventual consistency model.
  • Deployment complexity: infrastructure-as-code (Terraform, CloudFormation) with multi-region failover must be automated.

Failure Modes & Mitigations:

  • Cell provisioning takes hours: slow onboarding. Mitigate: template infrastructure via Terraform modules; 15-min provisioning SLA.
  • Data replication lag across cells: batch reporting queries hit stale data. Mitigate: eventual consistency acceptance; separate read-only Aurora replica in reporting region with hourly sync.
  • Cost explosion for small tenants: 1000 micro-tenants × $5,000/mo per cell = $5M/mo unviable. Mitigate: multi-tenant shared cluster for low-tier; cells only for enterprise.

When to Choose:

  • Tenant count <100 but each is enterprise (high SLA, compliance, custom integration).
  • Geographic distribution required (data residency, latency).
  • Tenant isolation for competitive or security reasons critical.
  • Operations team >10 people; infrastructure-as-code maturity high.


 

Comparison Table

DimensionShared + RLSPer-SchemaPer-Cell
Operational OverheadLowMediumHigh
Cost per Tenant$100–500/mo$500–2,000/mo$5,000+/mo
IsolationLogicalLogicalPhysical
Noisy Neighbor RiskHighMediumNone
Tenant Density10,000+1,000–5,000<100
Query Plan InterferenceYesNoNo
Scale-Out (add tenant)Instant1–5 minutes (Terraform)15–30 minutes (CloudFormation)
Debugging EaseHard (mixed CloudWatch logs)MediumEasy
Compliance/AuditModerate (RLS policies)Good (schema-level)Excellent (isolated KMS keys, logs)
Multi-Tenant ScalingYes (vertical limit ~5,000)Yes (~2,000 limit)No (cells independent)


 

Recommendation

Hybrid tiering strategy using AWS services:

Tier 1 (Free / Micro, <$100/mo): Shared Cluster with RLS

  • Single Aurora PostgreSQL cluster (shared across all Tier 1 tenants).
  • Tenant_id + RLS + ElastiCache rate limiting.
  • Storage quota: 1 GB, API quota: 10k calls/day.
  • SLA: best-effort, no uptime guarantee.
  • Scaling limit: ~5,000 tenants before p99 latency unacceptable.
  • Monitoring: CloudWatch metrics per tenant_id; SNS alerts on quota breaches.

Tier 2 (Pro / Standard, $100–2,000/mo): Per-Schema or Per-Database

  • Dedicated schema within shared Aurora cluster (or separate Aurora instance per 10 tenants).
  • Storage quota: 100 GB, API quota: 1M calls/day.
  • SLA: 99.5% uptime commitment.
  • Scaling limit: ~2,000 tenants on single cluster; beyond, shard into multiple clusters (geographic or cohort-based) via Route 53.
  • Monitoring: dedicated CloudWatch dashboards per schema; RDS Performance Insights for query optimization.

Tier 3 (Enterprise, >$2,000/mo): Per-Cell

  • Dedicated Aurora PostgreSQL instance, ElastiCache, ECS Fargate service.
  • Custom SLA, data residency (specify region), HA/DR policies.
  • Scaling limit: each cell scales to 1B+ impressions/day independently.
  • Onboarding: 2–4 weeks (compliance review, security audit).
  • Provisioning: AWS Cloud Map service registry + Route 53 health checks + automatic failover.

Transition logic:

  • Free tier automatically moved to Pro schema at 1GB storage or 100k daily API calls.
  • Pro tenants requesting >99.9% SLA or data residency constraints automatically provisioned to Enterprise cell.


 

Capacity & Performance Notes

Shared Cluster (RLS, Option 1):

  • Aurora PostgreSQL instance: 32 vCPU, 128 GB RAM, 2 TB EBS gp3.
  • ElastiCache Redis: single-node cache.db.r6g.xlarge (4 vCPU, 26 GB RAM).
  • ECS Fargate: 5–10 tasks (2 vCPU, 4 GB RAM each).
  • Density: 5,000 tenants with 100 MB avg storage each = 500 GB data (50% utilized capacity).
  • Per-tenant rate limits: 100 concurrent connections (PgBouncer: 10–20 per tenant), 10,000 API calls/day (100 req/sec per tenant).
  • Query latency: p50 20 ms, p99 100–200 ms under quota enforcement.
  • Cost: ~$10,000/month Aurora + ElastiCache + ECS + operations = ~$2/tenant/month.

Per-Schema (Shared Cluster, Multiple):

  • Cluster pool: 5 Aurora clusters × 32 vCPU each.
  • ElastiCache: 5 Redis clusters (one per Aurora cluster for affinity).
  • ECS Fargate: 20 tasks (4 vCPU, 8 GB RAM each).
  • Density: 1,000 tenants per cluster; 5 clusters = 5,000 tenants total.
  • Per-tenant rate limits: 50 concurrent connections, 100,000 API calls/day.
  • Query latency: p50 15 ms, p99 50–100 ms (less RLS filtering overhead).
  • Cost: ~$50,000/month clusters + ops = ~$10/tenant/month.

Per-Cell (Enterprise, Option 3):

  • Single cell: 1 Aurora instance (16 vCPU, 64 GB RAM), 1 ElastiCache (cache.db.r6g.large), 4 ECS Fargate tasks.
  • Cost: ~$5,000–15,000/month per cell depending on size.
  • Single cell can handle 1–10 enterprise tenants or 1 very large tenant.
  • AWS Cloud Map: $0.50/service + $0.10 per million requests (negligible cost).

Billing/Metering:

  • Storage: billed per GB; metered daily from Aurora table size, exported to DynamoDB for chargeback.
  • API calls: metered via ECS Fargate middleware counter; reset daily/monthly per tenant, logged to CloudWatch.
  • Compute: not directly billed (included in tier cost).
  • Example: Pro tier $500/month includes 100 GB storage + 1M API calls; overage $0.01/GB + $0.001 per additional 1000 calls.
Tags AWS Architecture Ad Tech Multi-Tenant Cloud Multi Tenancy Multi Tenant Design Noisy Neighbor Scalable Multi Tenancy Tenant Isolation Facebook X
Comments 0
Similar posts
  1. Measuring Ad Viewability: AWS Architectures for Programmatic Accountability
    479
  2. Predictable Ad Spend: Architecting Pacing at Hyperscale
    427
  3. Enterprise Data Lake Architecture based on AWS
    10,412
  4. Media sharing service architecture in AWS
    10,374
  5. AWS System Design Example - Instagram Architecture
    1,928
  6. Amagi CLOUDPORT Architecture based on AWS for FAST for channel playout on AWS
    1,330
  7. Product Marketing & Recommendation Architecture in AWS for e-commerce website
    10,747
  8. Teraform from the scratch
    1,362
  9. Web front-end architecture in AWS for e-commerce website
    370
  10. Web Application Hosting provides the reliable, scalable, secure, and high-performance infrastructure
    10,620
  11. Time series processing architecture in AWS
    10,561
  12. Synchronous online gaming architecutre in AWS - Highly Available, Scalable & Elastic to support Millions of Players
    10,424
  13. Secure and Scalable LAMP Service Architecture in AWS
    10,666
  14. Live streaming / Static Content & Media Service based on AWS
    10,663
  15. Large scale messenger service architecture in AWS - Slack case study
    11,675
  16. Large scale computing based on huge data sets in AWS
    10,616
  17. Image Moderation Chatbot - a serverless chatbot on AWS that monitors chat channels and removes images suggestive or explicit image
    10,431
  18. Financial services grid computing in AWS
    10,359
  19. File synchronization service architecture in AWS
    10,384
  20. Fault Tolerance & High Availability based on multi Availability zones in AWS
    10,821
  21. Disaster recovery solution in AWS for local applications
    11,182
  22. Content Distribution for VOD streaming services in AWS
    10,363
  23. Checkout service architecture in AWS for e-commerce website
    11,018
  24. Batch processing composed of job manager, job store and worker based on AWS
    10,454
  25. AWS Architecture for collecting Click-Through Events on Advertisement serving
    10,380
  1. The Two Clocks of Ad Server Architecture
    77
  2. Collecting Proof-of-Play from 100,000 Screens
    152
  3. Extracting Context from Live Video: The Architecture Got Simpler When We Stopped Building Features
    263
  4. The New Ad Stack Behind Live Sports Streaming: Inside SGAI, EABN, and the Standards Race to Fix Live Monetization
    671
  5. IAS IP Blocklist: Causes, Resolution, and Detection Strategies
    196
  6. What Is UniversalAdId? The Complete Guide to VAST Video Ad Tracking
    205
  7. End-to-End Contextual Video Processing Architecture for AdTech
    216
  8. UCP for AVOD: Standardizing Ad Monetization
    354
  9. Advertiser Universal Commerce Protocol (UCP) Readiness Checklist
    449
  10. SEO is dying, AEO is coming
    1,238
  11. Conditional AdSense Script Loading in Confluence
    1,422
  12. Architecting ML/LLM Ad Targeting with Kafka, Flink, FAISS, and Milvus
    284
  13. What is VAST? What is VMAP? How VAST/VMAP works?
    903
  14. Render Ad creatives using setSafeFrameConfig in Google IMA
    1,084
  15. AWS Real-Time Dashboards: Druid, ClickHouse, or Lambda?
    627
  16. Attribution's New Blueprint: Balancing Performance and Privacy
    507
  17. Ad Auction Architectures: A Publisher's Guide to Optimal Monetization
    686
  18. Ad Pacing Unpacked: Architecting Guaranteed Delivery
    367
  19. Brand Safety: AI-Driven Content Moderation on AWS
    737
  20. The Future of Programmatic Advertising: Privacy-First Strategies and Trade-offs
    523
  21. AI-Powered Ad Fraud Detection: Architectural Strategies
    337
  22. AWS Ad Exchange Disaster Recovery: Active-Active, Active-Passive, and Cell Strategies - Disaster Recovery
    1,361
  23. Architecting Ad Tech's Terabyte Log Pipeline - Log Aggregation
    331
  24. Ad Tech Edge Architectures: Reducing Latency and Offloading Work - Edge Computing
    338
  25. Achieving Zero-Downtime Deployment for Stateful Ad Servers
    1,232
  26. Ad Tech Circuit Breakers: Architectures for Resilient Bidding Engines - Circuit Breaker
    358
  27. Balancing Real-Time Ad Stats and Billing Accuracy - Eventual vs Strong Consistency
    647
  28. Scaling Sharded Databases: Taming Hot Shards with Dynamic Rebalancing
    552
  29. Navigating the Ad Tech Cold Start: Simple Solutions for a Complex Problem
    338
  30. Ad Tech Idempotency: Engineering for Reliability and Scale
    368
Recently updated
  1. Google OAuth Token Expiration: Causes and Solutions
    29
  2. Why 100% SEO Guarantees Better User Engagement and How to Achieve It in Your Service
    55
  3. Why SPF and DKIM Are Essential for Linux Email Servers?
    49
  4. How do I create animated background for Google Meet?
    22,891
  5. MaxMind GeoLite2 vs. DB-IP Lite vs. ip-api.com: Choosing the Right Free IP Geolocation Solution
    271
  6. Meet Valkey: Why Redis Changed Its License, Why Valkey is Better, and How to Use It as a Drop-in Replacement
    103
  7. How Rogue Web Scrapers Are Stealing My Content and Destroying My Server
    168
  8. Array of arguments passed to script in PHP
    97
  9. Invalid Auction Storms in Ad Tech
    106
  10. Building MRC-Compliant Instrumentation in Ad Tech: Implementation Steps and Key Challenges
    207
  11. Frequency Cap Architecture Overview
    526
  12. Vector Search in Relational Databases (RDBs): Trends & Usage Environments
    302
  13. What is RedisVL?
    114
  14. Designing a Skill Registry Architecture: Minimize Token Usage and Maximize AI Performance
    246
  15. TPU & GPU Cluster Management Tools
    257
  16. The Concept of Scaffolding in AI Agents
    244
  17. Beyond Static Pipelines: Architecting LLM Multi-Agent Systems for Autonomous Workflow Orchestration
    596
  18. AI-DLC vs. AI-SDLC: Model-Centric vs. System-Centric AI Development
    267
  19. Fine-Tuning Open-Weight LLMs: Training, Licensing, and Deploying Custom Models with Ollama
    353
  20. Inside the Next-Generation Streaming Architecture: Ultra-Low Latency, SGAI, and AI Codecs
    206
  21. Machine Learning: Training vs. Ranking
    229
  22. The Continuous Learning Machine: Designing a Loop That Actually Turns
    228
  23. The Next-Gen Low-Latency Standards: LL-HLS & MoQ
    202
  24. Designing a Data Curation System Around a Vector Database
    230
  25. Designing MLOps Architectures to Handle Seasonal Data Drift in EV Fleet Models
    200
  26. From 15 to 40+ FPS: Accelerating PyTorch Object Detection on Automotive ECUs
    232
  27. Understanding Data Lineage
    271
  28. System Requirements and Architecture: Intelligent Priority-Based Scheduler
    175
  29. GPU & LLM Cluster Infrastructure & Task Scheduling Architecture
    255
  30. Java Variant Type
    210