Building a Real-Time SaaS Analytics Dashboard with Multi-Tenant Architecture | Global Success Story | SoniNow

Limited TimeLearn More

Back to All Analysis
SaaS Blueprints

Building a Real-Time SaaS Analytics Dashboard with Multi-Tenant
Architecture

Client

Duration

Impact

Massive Scale

Security

Hardened

Building a Real-Time SaaS Analytics Dashboard with Multi-Tenant Architecture

The Challenge

The SoniNow Solution

The Challenge

A B2B SaaS startup providing customer engagement analytics for ecommerce brands had a problem that was both enviable and existential: their customer base had grown 4x in under a year, and their legacy analytics dashboard was buckling under the weight. What started as a single-tenant, PostgreSQL-backed reporting interface was now expected to serve 180+ tenants concurrently, each ingesting millions of customer interaction events daily.

The legacy system — a monolith built on Ruby on Rails with a shared PostgreSQL database — was delivering query response times averaging 8-12 seconds during peak hours. Page load times for dashboard views regularly exceeded 20 seconds. Customers were complaining. Churn risk was climbing. The engineering team had spent six months attempting incremental fixes — adding indexes, caching query results, vertical scaling on RDS — but each fix only bought a few weeks of breathing room before traffic growth overwhelmed it again.

Architecturally, the core challenge was multi-tenancy. Different tenants had wildly different data volumes — a mid-market retailer might generate 50,000 events per day while an enterprise customer generated 5 million. The shared database meant that a heavy query from one tenant could degrade performance for everyone, creating a "noisy neighbor" problem that was impossible to isolate without fundamentally rethinking the data architecture.

The startup's CTO described the urgency: "Our dashboard latency was becoming a dealbreaker in enterprise sales conversations. Prospects would sit through a demo, see the spinning wheel, and ask if we had a 'more enterprise-ready' version. We knew we had to rebuild or risk losing our entire upmarket expansion strategy."

Our Approach

SoniNow partnered with the startup's engineering leadership to design a multi-tenant analytics platform from the ground up. Our approach centered on three architectural pillars: data isolation, real-time ingestion at scale, and sub-second query performance.

Pillar 1: Tenant-Isolated Data Architecture. We adopted a hybrid multi-tenancy model using database-per-tenant for enterprise customers (those with >500K daily events) and a schema-per-tenant model for mid-market customers. This gave enterprise clients full data isolation while keeping operational overhead manageable for smaller tenants. The routing layer — a custom middleware built on Node.js — dynamically directed queries to the appropriate database or schema based on tenant tier.

Pillar 2: Real-Time Event Ingestion Pipeline. We replaced the batch ETL process that ran every 4 hours with a streaming architecture built on Apache Kafka and Kafka Streams. Events from customer integrations (webhooks, JavaScript snippets, mobile SDKs) flowed into Kafka topics, were enriched and validated in real-time, then written to ClickHouse — a column-oriented OLAP database chosen specifically for its blazing-fast analytical query performance.

Pillar 3: Pre-Aggregated Materialized Views. Rather than querying raw event data on every dashboard load, we built a materialized view layer using ClickHouse's AggregatingMergeTree engine. Pre-computed aggregates at hourly and daily granularity covered 95% of dashboard queries. The remaining 5% — custom ad-hoc queries — were sandboxed and routed through a dedicated query pool to prevent any single tenant's exploratory query from impacting production performance.

The Solution

The implementation took 14 weeks and involved a complete re-architecture of the data ingestion, storage, and serving layers while maintaining zero downtime for existing customers.

The frontend dashboard was rebuilt as a React application with Next.js server-side rendering for initial page loads and WebSocket connections for real-time data updates. Charts rendered using a custom SVG rendering engine optimized to handle datasets with 10,000+ data points without frame drops. Dashboard filters and date range changes triggered incremental API calls that typically returned within 50-150ms.

The API gateway — built on GraphQL with Apollo Federation — aggregated data from multiple backend services while enforcing per-tenant rate limits and query complexity controls. Each tenant had a dedicated query concurrency limit, preventing any single customer's dashboard usage from degrading performance for others.

On the data infrastructure side, the Kafka cluster ran with 6 brokers across 3 availability zones, handling 5 million+ events daily with sub-100ms end-to-end latency from ingestion to ClickHouse availability. ClickHouse itself was deployed as a cluster of 4 nodes using replicated tables for high availability, with data retention policies set at 90 days for raw events and 24 months for pre-aggregated data.

A tenant provisioning automation system was built using Terraform and Kubernetes custom controllers, allowing new enterprise tenants to be onboarded with dedicated database instances in under 15 minutes, down from the previous 2-day manual process.

Results

The new analytics platform transformed both the product experience and the business trajectory:

  • Dashboard query response time dropped from 8-12 seconds to under 200ms — a 98% improvement
  • Page load times for the primary analytics view went from 20+ seconds to under 1.5 seconds
  • Event ingestion latency improved from 4-hour batch windows to real-time (<500ms end-to-end)
  • Enterprise sales conversion rate increased by 35% within two quarters of launch
  • Customer churn rate dropped by 60% among customers who had previously complained about performance
  • Infrastructure cost per tenant decreased by 45% compared to the vertically scaled legacy monolith
  • System reliability improved from 99.5% to 99.97% uptime

"The SoniNow team didn't just fix our performance problem — they future-proofed our entire analytics platform. Our enterprise customers now reference the dashboard speed in their renewal conversations. That kind of product-market fit acceleration is invaluable."
CTO, Customer Engagement Analytics SaaS

Ready for similar results?

Whether you're scaling a SaaS product, modernizing a legacy analytics stack, or building a multi-tenant platform from scratch, SoniNow delivers production-grade architecture that performs at scale. Contact SoniNow to discuss your analytics infrastructure needs.

Key Outcomes

The Results.

Architecture Stack