Azure CosmosDB Overview

Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *
or

Already have an account? Sign In »

Time
14 hours 28 minutes
Difficulty
Intermediate
CEU/CPE
15
Video Transcription
00:00
>> Hello, Siberians.
00:00
Welcome to Lesson 3.9 of Module 3
00:00
>> of this course titled,
00:00
>> AZ-301: Microsoft Azure Architect Design.
00:00
Here are the learning objectives for this video.
00:00
We'll start out by giving an overview
00:00
>> of Azure Cosmos DB.
00:00
>> What exactly is this service?
00:00
We'll then proceed to cover
00:00
the different APIs that Azure Cosmos DB supports,
00:00
and we'll also cover
00:00
the consistency levels that it supports.
00:00
Finally, we'll give
00:00
an overview of the resource hierarchy of Cosmos DB,
00:00
so that we understand
00:00
the different terminologies. Let's get into this.
00:00
What is Azure Cosmos DB?
00:00
Azure Cosmos DB is a globally distributed,
00:00
massively scalable,
00:00
low-latency, multi-model database service
00:00
but what exactly does that mean?
00:00
It's a globally distributed database service,
00:00
because with a single click of a mouse,
00:00
we can replicate our database to
00:00
any Azure region around the world.
00:00
It's massively scalable.
00:00
You see some of that in
00:00
a minute when we get to the design decisions.
00:00
For example, the storage can be unlimited.
00:00
It has low latency because with Azure Cosmos DB,
00:00
what you're actually paying for is
00:00
guaranteed performance to the tune of
00:00
less than 10 millisecond for
00:00
99 percent of write and read operations.
00:00
It's a multi-model database service because we
00:00
can select different data models and API access.
00:00
For example, we can select the
00:00
>> Table API, Cassandra API,
00:00
>> SQL API, Cosmos DB API for MongoDB,
00:00
or the Gremlin API.
00:00
Here are some more information about
00:00
the APIs that Cosmos DB supports.
00:00
It supports MongoDB API,
00:00
which means that it's compatible
00:00
with existing MongoDB libraries,
00:00
drivers, tools and application.
00:00
What that also that means is that
00:00
existing MongoDB databases can be
00:00
migrated over to Azure Cosmos DB,
00:00
and you do not need to
00:00
modify your applications because you can
00:00
use the same wire protocol to
00:00
>> communicate with Cosmos DB.
00:00
>> It also supports the Table API.
00:00
If you're familiar with the Azure Table Storage,
00:00
this is a similar thing in terms of the API itself.
00:00
It's a key value database,
00:00
but it now gains the benefit of
00:00
the enterprise capabilities of Cosmos DB,
00:00
the global replication capabilities of Cosmos DB,
00:00
and the low latency capabilities of Cosmos DB.
00:00
It supports the Gremlin API,
00:00
which is based on Apache TinkerPop specification.
00:00
It supports Cassandra API,
00:00
which again is compatible with
00:00
existing Apache Cassandra libraries.
00:00
It supports the native API which we
00:00
can query with SQL like Query Language.
00:00
In terms of some of the core functionalities
00:00
of Azure Cosmos DB.
00:00
I mentioned earlier it's got global replication.
00:00
It actually just [inaudible] replication.
00:00
You simply click a button on the mouse and replication
00:00
occurs transparently in the background to that region.
00:00
What that means is that you can put
00:00
not only your applications close
00:00
to the users that are using the applications,
00:00
you can put your database very close
00:00
to the users that are using the application.
00:00
It has varied consistency level.
00:00
We talk about that in a little bit in a minute,
00:00
because Azure Cosmos DB supports multi-master,
00:00
and we have to have a way to handle consistency,
00:00
and it has different degrees
00:00
of consistency levels that we can configure.
00:00
It has low latency,
00:00
by it it serves
00:00
less than 10 milliseconds for read operations and
00:00
less than 15 millisecond write request
00:00
for 99 percent of the operations.
00:00
It's got elastic scale-out.
00:00
Throughput can scale from 10-100s of
00:00
millions of request per second across multiple regions.
00:00
I mentioned this a little bit earlier,
00:00
but it's what touching on again,
00:00
because when it comes to Cosmos DB,
00:00
we can migrate existing MongoDB databases
00:00
and Cassandra databases to Azure Cosmos DB,
00:00
and we do not need to transfer
00:00
our applications in anyway,
00:00
because with the same libraries and SDKs,
00:00
we can communicate with
00:00
Azure Cosmos DB with the API using
00:00
the same wire protocols
00:00
that the applications already use.
00:00
Now, let's talk a little bit
00:00
about this consistency levels.
00:00
Because Azure Cosmos DB supports multi-master write,
00:00
what that means is there has to be a way for us
00:00
to specify the consistency.
00:00
For many NoSQL databases,
00:00
they have only two degrees that you can configure.
00:00
It has strong consistency,
00:00
which means whenever there's
00:00
a write operation that's committed,
00:00
it has to be replicated across
00:00
all the different masters
00:00
before an acknowledgment is supplied.
00:00
Or they have the eventual consistency
00:00
which is where you can say,
00:00
"Yeah, I don't care when the data gets there,
00:00
as long as it gets there."
00:00
Now eventual consistency is great for performance,
00:00
but it's not good for availability.
00:00
Because if there were to be a failure
00:00
on the single master that
00:00
probably one of the masters that holds
00:00
a write operation before it's replicated,
00:00
then that data is lost.
00:00
Whereas the strong consistency is
00:00
great for availability but not great for performance.
00:00
What Azure Cosmos DB does a way it's different
00:00
is that it does not only have strong and eventual,
00:00
but it has all these varying degrees in the middle.
00:00
Not all applications needs
00:00
to go for eventual of a strong.
00:00
You can either go bounded-stateless,
00:00
session, or consistent prefix.
00:00
There's a whole spectrum that we can
00:00
select from when it comes to consistency levels.
00:00
Some more information about this consistency levels.
00:00
We have the strong, the bounded-stateless,
00:00
the section, the consistent prefix, and the eventual.
00:00
Strong and eventual we explained earlier.
00:00
When it comes to bounded-stateless,
00:00
what that means is we can settle a limits to say,
00:00
make sure that the replication is
00:00
consistent within this amount of time.
00:00
In other words, what we're saying is,
00:00
we're saying, go ahead and do the replication,
00:00
but you can only be still for this
00:00
>> amount of time or for
00:00
>> this amount of lag behind in terms of consistency.
00:00
We can specify that.
00:00
When it comes to session,
00:00
which is what many applications actually need,
00:00
when it comes to session consistency,
00:00
is to say as long as
00:00
the request is coming from the same client,
00:00
all read and write operations
00:00
should be consistent across the user session.
00:00
For many applications, this is sufficient.
00:00
Then you have the consistent prefix,
00:00
which is, the data will be replicated.
00:00
If at some point,
00:00
so it has loose consistency,
00:00
but the thing is, when the data gets replicated,
00:00
they got to be replicated in the right order,
00:00
so you have that balance
00:00
between performance and availability,
00:00
which you have to select the one
00:00
that fits well with the application.
00:00
The good thing is you have
00:00
the ability to do the selection.
00:00
Now, let's talk a little bit about
00:00
the practical side of working with Azure Cosmos DB.
00:00
When working with Azure Cosmos DB,
00:00
the first thing that we need to create is something
00:00
called an Azure Cosmos DB account.
00:00
Now, when we create Azure Cosmos DB account
00:00
within our account,
00:00
we can then create databases.
00:00
If you're thinking about it in
00:00
terms of relational database,
00:00
now being sense of an account is you have your server,
00:00
and then after that you have
00:00
your databases within a server.
00:00
You can have multiple.
00:00
Then within our database,
00:00
we can have something called a container.
00:00
Now when it comes to the container,
00:00
it varies depending on the API selection that we
00:00
chose when we're creating the Cosmos DB account.
00:00
For example, a container can be a collection,
00:00
it can be a graph,
00:00
it can be a table.
00:00
If you select Cassandra or Table API for example,
00:00
container will be reflected as a table.
00:00
If you selected Gremlin,
00:00
it'll be reflected as a graph.
00:00
If you selected MongoDB,
00:00
it will be reflected as a collection.
00:00
If you selected SQL API,
00:00
it will be reflected as a container.
00:00
Then under the containers,
00:00
then we can have our item.
00:00
Think about the table as like the containers of
00:00
a table within a relational database and the item
00:00
as like the rows and
00:00
the columns within that
00:00
, and that's what you're talking about.
00:00
You're talking about the actual document
00:00
or the items that are
00:00
stored within our containers.
00:00
Also we can have things like sproc for CDL,
00:00
user-defined functions, and triggers,
00:00
and conflict, and all those other items.
00:00
I'll pause this video right here,
00:00
and when I get to the next video,
00:00
I'll carry on talking about Azure Cosmos DB.
00:00
I'll give more information around
00:00
things like partitioning for Azure Cosmos DB.
00:00
Then we'll get into the design decisions
00:00
of Azure Cosmos DB.
00:00
We'll also cover Cosmos DB migration,
00:00
or migrating data into Cosmos DB.
00:00
Thanks for watching this video,
00:00
and see you in the next lesson.
Up Next