POSETTE 2024 is a wrap! 💯 Thanks for joining the fun! Missed it? Watch all 42 talks online 🍿
POSETTE 2024 is a wrap! 💯 Thanks for joining the fun! Missed it? Watch all 42 talks online 🍿
Many SaaS applications are multi tenant—especially B2B. So the apps have a natural dimension on which to distribute data: just shard by tenant_id—and for cases with no natural distribution key, you can use schema-based sharding. Our Citus database—implemented as an open source extension to Postgres—enables you to scale out Postgres to millions of tenants, without having to re-architect your application.
Most SaaS applications are inherently relational. By sharding on customer_id, Citus gives you the ability to scale out your SaaS database with full SQL coverage, so you don’t have to give up the relational semantics you need, like joins, foreign key constraints, transactions, ACID, consistency. By scaling out, your app gets much bigger memory, compute, and disk footprint—ensuring performance even in the face of growth. And since Citus is an extension to Postgres, you can leverage all of your existing expertise—plus all the Postgres reliability, rich data types (think: JSON and PostGIS), Postgres extensions (our favorites include HyperLogLog), and ongoing innovation in the amazing Postgres open source community.
So you want a database that can handle peak workloads and boatloads of concurrent users; act as a system of record and provide business analytics; offer high availability and provide elastic scale as your customer base triples in size. Check. The icing on the cake is for the database to integrate seamlessly with your frameworks like Rails, Django, Hibernate, and Sequelize. Because Citus is an extension to Postgres, we’ve been able to build on top of the robust, existing Postgres integrations and make it easy for multi tenant apps to use Citus: recent additions include an activerecord-multi-tenant gem for Ruby on Rails, and a Python django-multitenant library for Django. More to come.
While you may have a lot of data and your SaaS database may soon be too big for single-node Postgres, it’s likely that any given customer of yours can get the database performance they need from a single node. With our Citus extension to Postgres, the database is scaled out and yet data for each of your SaaS customers is
As of Citus 10 you can run Citus on a single node, or on multiple worker nodes—with Postgres and Citus installed on each node in the cluster. If you’re running your app on Citus in the cloud and you have HA turned in Azure Cosmos DB for PostgreSQL, then standby nodes will exist, too. Citus shards the database tables based on the distribution key, and then distributes shards across the worker nodes. The pièce de résistance: Because Citus can parallelize query fragments across multiple nodes in a cluster, you can run powerful cross-shard queries across all of your customer data quickly and easily.
Find noisy neighbors in your cluster with CPU usage insights and query counts from citus_stat_tenants. Citus maintains a resource utilization snapshot for top N tenants you can use with Grafana to visualize congestion & locate roadblocks.
Citus is available in the Azure Cosmos DB for PostgreSQL managed service. If you need to scale out your multi-tenant SaaS application without having to manually shard at the application layer, you can scale out Postgres horizontally on Azure.
Want to try Citus on Azure?
Try for free