(gentle guitar playing)
Hello and welcome.
Please enjoy this short readiness video
on Azure database for PostgreSQL.
Hi Sai, how you doing today?
Hi Sanjay, how's it going?
Great, great to have you with us.
Thank you.
So can you please tell us what are we going to talk about?
Yeah, so today we are here to talk about building
multi tenant SAAS apps using Hyperscale Citus.
So that would be the story.
Okay, let's get started.
Awesome, so before I get started,
a quick intro about myself.
I'm Sai, I'm an engineer in the open source database esteem
and my area of specialization is Postgre,
and specifically Hyperscale Citus.
So yeah, let's get started.
Yes please, so let's see what's the first thing
you're going to talk about?
What's the scenario like?
Yeah, so what is a multi tenant application?
Right, so a multi tenant application
is an application that has multiple tenants, customers,
and each tenant and customer deals with its own data.
Classic example of a multi tenant application
is Dynamics 365.
Dynamics 365 has multiple businesses
who are customers to Microsoft,
and each business deals with its own sales transaction data.
So that's multi tenant applications.
Okay, so basically,
let's start with deployment options.
Yeah, so the deployment options
that Azure database for Postgre has the single server option
and then the Hyperscale Citus option.
Single server option is where you can deploy
a Postgre database on a single server
and get all the past benefits.
Next is Hyperscale Citus in which you can deploy
Postgre across multiple servers and scale
as your workload grows.
And getting into the multi tenant aspect, right,
typically the problems we hear from customers are threefold.
The first is performance issues.
Or that they hear is as the number of tenants grow,
as the data size grows and they see performance issues
because of tables not fitting in memory,
indexes not fitting in memory.
That is number one.
Number two is more around scalability, in the sense that
as they onboard more and more customers,
they are worried that a single node relational database,
say a Postgre or Oracle,
will not scale as the workload grows.
They are looking for a database that scales
as the workload grows.
The third is around tenant management.
So as they hit these issues of performance and scalability,
what they think is they want to move their tenants
to a new server, and write application logic
to route queries to the right servers.
So basically, they are looking at re-inventing the wheel
of sharding, which is a hard problem by itself, right?
Because you need to keep a lot of distributed systems
considerations in your mind, and it's not easy.
It requires a lot of effort.
And that's what Hyperscale Citus automates for you.
All right, so let's talk more about how do you do that?
Awesome.
So before talking about how Hyperscale Citus
solves these problems,
let's look at the Hyperscale Citus architecture.
So in the Citus world, you have something called as
the coordinated node, and you have multiple worker nodes.
The coordinated node is a node
that orchestrates your queries to the right worker nodes,
the worker nodes are the nodes where the actual data exists,
that's where the computation happens.
Note that all of this architecture of coordinated, workers,
for the end user, the client, looks and feels
like a single-node Postgre database.
So you have the username, the password,
very similar to how you connect to a Postgre database
and you run queries, right?
So from the end user point of view,
what you do is you connect to the coordinated node,
create tables as you typically do in a Postgre database.
So let's say we create a table called transactions.
And then you tell Citus that, hey,
I want to shard, that is distribute this particular table
on a particular column.
So let's say we shard the transactions table on, say,
the company ID, right?
And that's what happens typically
in multi tenant applications where the tables
are sharded on the tenant ID,
which is an identifier for the tenant,
it could be, say, the company ID,
the organization ID, or customer ID.
So here, we are sharding the transactions table
on the company ID.
For that, Citus gives you a very simple SQL function
to do the sharding.
And once I run that like SQL function.
Under the covers, Citus creates shards.
The blue dots that you're seeing on the screen,
on the workers,
shards are nothing but simple plain Postgre tables
that hold a set of your data.
So in this scenario they would hold a set of your company.
So very important concept in multi tenant applications is
once you shard these tables on the tenant ID,
Citus automatically makes sure that all the data
for a given tenant from all the tables
goes and sits on a single worker.
So if there is a query as you're seeing on the screen
for a particular company, then Citus routes that query
to the right worker where this company or tenant resides
and executes the query, that is number one.
Number two, if there is a query that is across tenants,
as you're seeing here, across companies,
then Citus parallelizes that query across multiple machines
and gives you the results.
So now coming to the problems of performance.
So the reason Citus solves the performance issue is because
under the covers, note that these shards are smaller.
By which in general, your index trades, the cache trades
are much better on smaller tables than the big large table
on a single node database, right?
That is number one.
And the second is the virtue of this parallellism
that it runs, it has the ability to run queries
across multiple workers and scale your workload
as the data size grows.
So this is in regards to performance.
Next is about scalability.
So along with this, Citus also has the ability
to add more worker nodes, increase your horsepower,
and then rebalance the data all in an online way.
So just to reiterate, the horizontal scalability piece
is all online.
So you don't need to take any downtime
with respect to reads and writes
while the horizontal scalability is kicking in.
So this is how we solve the scalability problem.
And coming to the last problem which I mentioned,
which is tenant management,
so Citus also gives you nuts and bolts
to manage your tenants across the worker nodes.
So the first is something called a Citus stat statement,
which is very similar to PG stat statements in Postgres.
Citus stat statements helps you gauge tenant activity
across the cluster.
So it will tell you that, hey, this tenant
is using your system a lot.
These tenants are using the system less.
By which you can identify hotspots in the database.
That is number one.
And once you identify hotspots in the database,
you would think of moving those hotspots to their own nodes.
That's where you have the tenant isolation utility.
So what tenant isolation utility does is
it helps you isolate these large tenants
that create hotspots in the database
to their own worker node.
And you see, it's a two step process.
First you isolate the tenant to its own shard,
and then move the tenant to its own node.
As simple as that.
And note that the moving of tenant to own node
is all online, so you don't need to take any downtime
with respect to reads and writes
while this operation is going on.
So this would be a scenario where
you have a sale happening, where there's lots of
Black Friday sale happening, right?
Exactly.
And also people coming in, so you can just simply
do this whole thing.
Exactly, that actually does happen
and that's around the holiday season where customers say
okay, I want to isolate this large tenant
and give better performance and be ready for scale.
So you're right.
That sounds good.
And then of course, what are the benefits
of building this multi tenant applications
in Azure ecosystem?
So the biggest benefit is as you see,
Hyperscale Citus solves the problem of scale
for multi tenant SAAS apps,
and Hyperscale Citus has a very good integration story
with the Azure ecosystem.
For example, if you see the reference architecture,
you have AKS which is compatible with Hyperscale Citus
which is Azure Kubernetes service, and you can run
multiple app platforms like Ruby, Django, .NET
on the Kubernetes service,
and then you can have Azure Cache for Redis
for caching purposes,
and then you can also have a tool such as
Azure Machine Learning and Power BI
hit your Hyperscale Citus database to get
visibility into reporting and artificial intelligence
purposes as well.
So amazing dashboard.
Yeah, absolutely.
All right, anything else in terms of resources
or anything else?
Absolutely.
So last, but not the least,
before I end, I just wanted to give some customer examples.
So a couple of customers who use this service
are number one, FINASTRA.
FINASTRA is the third-largest fintech company
that uses Hyperscale Citus.
They provide applications to banks
and financial institutions to support and automate
mission-critical workloads.
So the specific workload with they are looking at
Hyperscale Citus involves an open-core platform
for payments and lending for close to
4500 community market customers.
So currently, this customer is in the migration stage.
They are very close to cutting over,
and in the coming months, the goal is to cut over.
That is one customer, FINASTRA.
Next you have relayr.
Relayr is a customer that already uses Hyperscale Citus
in production, and they got into production
even before we went GA.
So it was actually during the public preview period,
and they are very happy with the product.
And this application basically provides insights
from existing equipments and machines
and product clients to improve
their overall business outcomes.
So this is also proper multi tenant app.
And as I said, it deals with equipments, machines,
along with the multi tenancy piece
there is also that IoT angle in this, Sanjay.
Okay, so IoT sends the information as well.
Exactly, yeah, that's it.
Fantastic.
Thank you so much for all this information.
Any other final thoughts?
No, that's it, and please feel free to check out
and if there is any multi tenant use case,
feel free to deploy Hyperscale Citus cluster
and there are a lot of resources, technical resources
out there which actually Umer shared,
and then go out and test Hyperscale Citus.
So that's it from my side.
Thank you so much for all this great information.
Awesome.
Thanks for watching this short Azure Readiness video.