Professional Documents
Culture Documents
Designing and Implementing Cloud-Native Applications Using Microsoft Azure Cosmos DB: Study Companion For The DP-420 Exam 1st Edition Steve Flowers
Designing and Implementing Cloud-Native Applications Using Microsoft Azure Cosmos DB: Study Companion For The DP-420 Exam 1st Edition Steve Flowers
https://ebookmeta.com/product/designing-and-implementing-cloud-
native-applications-using-microsoft-azure-cosmos-db-study-
companion-for-the-dp-420-exam-1st-edition-steve-flowers/
https://ebookmeta.com/product/microsoft-azure-cosmos-db-revealed-
a-multi-modal-database-designed-for-the-cloud-1st-edition-jose-
rolando-guay-paz/
https://ebookmeta.com/product/integrating-serverless-
architecture-using-azure-functions-cosmos-db-and-signalr-
service-1st-edition-rami-vemula-2/
https://ebookmeta.com/product/integrating-serverless-
architecture-using-azure-functions-cosmos-db-and-signalr-
service-1st-edition-rami-vemula/
AI 102 Designing and Implementing a Microsoft Azure AI
Solution Study Guide with Practice Questions and Labs
First Edition Ipspecialist
https://ebookmeta.com/product/ai-102-designing-and-implementing-
a-microsoft-azure-ai-solution-study-guide-with-practice-
questions-and-labs-first-edition-ipspecialist/
https://ebookmeta.com/product/cloud-native-infrastructure-with-
azure-building-and-managing-cloud-native-applications-1st-
edition-nishant-singh-michael-kehoe/
https://ebookmeta.com/product/kubernetes-patterns-reusable-
elements-for-designing-cloud-native-applications-2nd-edition-
bilgin-ibryam/
https://ebookmeta.com/product/developing-cloud-native-solutions-
with-microsoft-azure-and-net-build-highly-scalable-solutions-for-
the-enterprise-1st-edition-ashirwad-satapathi/
› Hands-on preparation and practice
› Practical skills advancement for practitioners
› Prescriptive guidance from expert voices
Designing and
Implementing Cloud-
native Applications
Using Microsoft
Azure Cosmos DB
Study Companion
for the DP-420 Exam
›
Steve Flowers
Certification Study Companion Series
The Apress Certification Study Companion Series offers guidance and hands-on
practice to support technical and business professionals who are studying for an exam
in the pursuit of an industry certification. Professionals worldwide seek to achieve
certifications in order to advance in a career role, reinforce knowledge in a specific
discipline, or to apply for or change jobs. This series focuses on the most widely taken
certification exams in a given field. It is designed to be user friendly, tracking to topics as
they appear in a given exam. Authors for this series are experts and instructors who not
only possess a deep understanding of the content, but also have experience teaching the
key concepts that support readers in the practical application of the skills learned in their
day-to-day roles.
Steve Flowers
Designing and Implementing Cloud-native Applications Using Microsoft Azure
Cosmos DB: Study Companion for the DP-420 Exam
Steve Flowers
Perrysburg, OH, USA
Preface�������������������������������������������������������������������������������������������������������������������xix
vii
Table of Contents
viii
Table of Contents
ix
Table of Contents
x
Table of Contents
Index��������������������������������������������������������������������������������������������������������������������� 195
xi
About the Author
Steve Flowers is a Senior Cloud Solution Architect at
Microsoft focused on Data and AI. He has 12 years of
experience in technology, and for the past three years,
he has helped customers achieve success with Azure
Cosmos DB. In 2022, Steve achieved the Azure Cosmos DB
Technical Insider badge acknowledging his training with
the product group and Microsoft Global Black Belts in Azure
Cosmos DB, and for helping enterprise customers architect
and deploy Azure Cosmos DB. Steve’s technical experience
ranges from networking and system administration to
cloud-native development on Azure and IoT solutions. He is
passionate about data architecture and enjoys the challenge
of a customer-driven role within Microsoft.
xiii
About the Technical Reviewer
Hasan Savran is a highly experienced Senior Business
Intelligence Manager at Progressive Insurance Company
and a distinguished Microsoft Data Platform MVP based in
the United States. He is also the head of SavranWeb Cosmos
DB Consulting, where he showcases his exceptional industry
knowledge and skills. Sharing knowledge and expertise
with the community is his passion. He achieves this by
speaking at tech conferences globally and writing on his
blog: https://bit.ly/44wr52u. Hasan has also developed
a VSCode extension called Azure Cosmos DB SQL Studio (https://bit.ly/3yKWkYP),
which streamlines the complexities of working with Azure Cosmos DB. This tool offers a
seamless and efficient experience for interacting with the platform, making it a valuable
asset for any user.
xv
Acknowledgments
Thank you Hasan Savran for your time and deep expertise reviewing this text.
Thank you Shaul Elson for your work organizing this effort and Jon Gennick for the
opportunity.
Thank you to Sergiy Smyrnov, Howard Ginsburg, Jeremiah Gutherie, Marc Grove,
Prasad Nair, and my other Microsoft colleagues who have helped me on my Azure
Cosmos DB journey.
Thank you to the Azure Cosmos DB Product Group for building the best cloud
distributed NoSQL platform in the industry. And thank you for all you do to train and
share your expertise with the community.
Thank you to my many mentors: Charlie, Troy, Erich, Freddy, Kevin, Frannie, Scott,
Ken, Edward, Sweta, Amy, Cathy, and Brian.
Finally, thank you to all my friends on the Microsoft Azure Discord server!
https://aka.ms/azurediscord
xvii
Preface
The goal of this book is to introduce readers to the Azure Cosmos DB service and
the topics covered on the DP-420 certification exam. Whether you are a developer
experienced with using Azure Cosmos DB or you are just starting your journey, I hope
this book can provide valuable information for you.
Gaining technical certificates is a way to show your employer or potential employers
you are proficient in a specific technology. Many exams have come and gone over the
years. The value of those that fade also diminish with technology. But NoSQL will likely
remain a relevant skill for years to come, and though this book is focused specifically
on Azure Cosmos DB, many of the topics discussed in this book can be applied to other
NoSQL products and platforms.
Some readers may also be seeking to obtain this certification as a mechanism of
self-study. Having a predetermined outline for learning and a goal to accomplish such
as the passing of an exam can be an excellent starter. This book will certainly help you
thoroughly understand NoSQL concepts and how to work with the Azure Cosmos DB
platform, whether you choose to take the exam or not.
If you do take the exam, I offer an important piece of advice that should be applied
to any study material on a subject: don’t stop here. Don’t let this book carry you
through the exam. Study the documentation. Dig into topics you don’t understand
using the vast resources at your fingertips: ChatGPT, StackOverflow, Discord, Slack,
LinkedIn, YouTube, etc. Work through the quick starts and tutorials in the Microsoft
documentation, many of which are linked in the companion repository associated with
this text.1 And if you aren’t using Azure Cosmos DB in your current role, stay connected
to the aforementioned communities and keep your skills sharp. NoSQL proficiency is
likely to be relevant in your career aspirations. Good luck, and thanks for reading.
1
https://github.com/Apress/designing-and-implementing-cloud-native-applications
xix
CHAPTER 1
1
© Steve Flowers 2023
S. Flowers, Designing and Implementing Cloud-native Applications Using Microsoft Azure Cosmos DB,
Certification Study Companion Series, https://doi.org/10.1007/978-1-4842-9547-2_1
Chapter 1 Scheduling and Taking the DP-420 Exam
applications. Passing the DP-420 exam can either help you on your journey in learning
NoSQL and Azure Cosmos DB or serve as a credential validating your knowledge and
experience.
A candidate for this exam must have solid knowledge and experience devel-
oping apps for Azure and working with Azure Cosmos DB database tech-
nologies. They should be proficient at developing applications that use the
Azure Cosmos DB .NET SDK for SQL API. They should be able to write effi-
cient Azure Cosmos DB SQL queries and be able to create appropriate index
policies. They should have experience creating server-side objects with
JavaScript. Additionally, they should be familiar with provisioning and
managing resources in Azure. They should be able to interpret JSON, read
C# or Java code, and use PowerShell.
—https://docs.microsoft.com/en-us/certifications/exams/dp-420
2
Chapter 1 Scheduling and Taking the DP-420 Exam
3
Chapter 1 Scheduling and Taking the DP-420 Exam
Also, spend time developing against the service. C# is the language I recommend
but some of the important things to know are how to create a client, working with client
options, interacting with the change feed, and writing and interacting with stored
procedures. The methods and properties across different languages should be similar,
but understand that C# is the language of Microsoft. To develop locally, download and
install the Azure Cosmos DB Emulator. This is a free installable which mimics the APIs
you will use in the real Azure service.
docs.microsoft.com/certifications/register-schedule-exam
docs.microsoft.com/certifications/prepare-exam
Testing is scheduled through Pearson VUE and the scheduling process will resume
on their site once your profile is configured. Select the language you require and choose
an in-person test or a remotely proctored test.
4
Chapter 1 Scheduling and Taking the DP-420 Exam
When it is time to take your exam, you will be escorted to the test taking room and sat
at a desk with a PC managed by the testing center. You are not allowed to take anything
in with you, and not allowed to write on anything other than the materials offered to
you by the testing center which typically include a small thin whiteboard and dry-erase
markers. The whiteboard cannot be erased and if you require more writing room you
must request it from a testing center assistant.
At every testing center I have taken a test in, the room includes others who are taking
exams on a number of topics. Keep in mind that your movement and sounds can be
distracting to them, and theirs may be distracting to you. If you are easily distracted, I
recommend the second approach, a remotely proctored exam.
5
Chapter 1 Scheduling and Taking the DP-420 Exam
Test Results
Regardless of whether you take the exam in a testing center or the privacy home virtually,
you will be presented with the results of the exam immediately after completion. To pass
the exam, you must score at least 700. This is a scaled score and does not mean you’ve
answered 70% of the questions correctly out of 1,000. Questions are not weighted evenly,
and the score is designed to assess your competency and takes into consideration the
difficulty of the question as well. See the following link for more information:
https://docs.microsoft.com/en-us/certifications/exam-scoring-
reports#scores-needed-to-pass-exams
6
Chapter 1 Scheduling and Taking the DP-420 Exam
If you have been working with Azure Cosmos DB since taking the exam, you likely will
need very little studying. If you have not, I recommend refreshing yourself on the exam
objectives before taking the renewal.
Summary
If this is your first time taking a Microsoft certification exam, don’t worry! In this book we
will cover the most important aspects of Azure Cosmos DB. If you have not worked with
the service before, this will be an exciting journey. Make sure to continue studying topics
you don’t understand and reference the Microsoft Docs for more information. And lastly,
get hands on with the topics. Write queries, develop code, create stored procedures, and
deploy your account with PowerShell. Practice will ensure these ideas are cemented in
your memory.
7
CHAPTER 2
9
© Steve Flowers 2023
S. Flowers, Designing and Implementing Cloud-native Applications Using Microsoft Azure Cosmos DB,
Certification Study Companion Series, https://doi.org/10.1007/978-1-4842-9547-2_2
Chapter 2 Design and Implement a Nonrelational Data Model
{
"id": "e41e37fb-eaf6-4dd8-8eab-cf536e220837",
"Name": "Blanca Quenneville",
"Email": "Blanca.Quenneville@contoso.com",
"Skills": ["Azure Cosmos DB", "Data", "Development"]
}
As you can see, integers, strings, and arrays (as well as additional data types)
are supported, and they are self-describing in that when the preceding document is
deserialized, it will represent the object and the data types of that object. JSON is stored in
documents, and these documents are stored on nodes (i.e., servers) in Azure Cosmos DB.
Azure Cosmos DB leverages a scale-out architecture which means that in lieu of
scaling nodes up by adding more CPU, more RAM, or more IOPS, the service scales out
by adding more nodes. The idea of scale-out architecture explains a lot as to why Azure
Cosmos DB behaves the way it does, and why data modeling is so important. Think
of it like a bookshelf in a library; there needs to exist a large enough bookshelf with
enough shelves to store the books that the library offers. When the library acquires more
books, perhaps they could add shelves to the existing bookshelf, but there is certainly
a limit, the ceiling only goes so high! So instead of increasing the size of one bookshelf,
the library chooses to add more bookshelves as they provide more books. This is the
idea behind scale-up versus scale-out distributed data architecture. Instead of adding
resources to a single server, Azure Cosmos DB provisions additional servers to scale out,
effectively making elasticity limitless and only confined to the bounds of the data center
instead of a single node.
Based on this distribution, you may be wondering how your data is distributed or
sharded. Library bookshelves use the Dewey Decimal system; what system do NoSQL
databases and Azure Cosmos DB use? The answer to that question is the partition
key, also sometimes referred to as a shard key. The partition key (PK for short) tells
Azure Cosmos DB how to distribute data across nodes as your workload scales. The
PK also helps your queries get routed to the correct physical node. Azure Cosmos DB
uses consistent, hash-based partitioning based on the PK. A good PK will have high
cardinality for even distribution. Consider the ISBN number of a magazine publication.
The ISBN number identifies a magazine but not each individual issue. In the case of our
library, this would allow patrons to find a magazine where they may not know which
specific issue they need. Partitioning efficiency stems from a proper data model and is
discussed further in Chapter 4.
10
Chapter 2 Design and Implement a Nonrelational Data Model
11
Chapter 2 Design and Implement a Nonrelational Data Model
As you can see in Figure 2-1, there is a N:N relationship between sales orders and
products. This means many products can exist in many orders and many orders can
contain many products. This is a common scenario for e-commerce applications. But
how would we model this in Azure Cosmos DB? First, we do not want to create two
different containers for these documents. Documents that are often queried together
should reside in the same container. This is more efficient, and it allows us to serve
multiple, related documents (entity types) from the same partition. Let’s explore how we
would model this in NoSQL and explain the benefits.
12
Chapter 2 Design and Implement a Nonrelational Data Model
A user who would like to view their recent order from Adventure Works would likely
open a page listing their recent orders. On this page, we wouldn’t want to show every
product in every order, rather a summary of the orders, the date they were placed, and
their status. When the user clicks on a specific order, they expect to be able to view a list
of products included in that order. Listings 2-1 and 2-2 show how we should design our
data model.
{
"id" : 123,
"doctype" : "order",
"revisionNumber" : 3,
"orderDate" : "2022/08/06 04:00:00",
"dueDate" : "2022/08/12 04:00:00",
"shipDate" : "",
"status" : "pending",
"Product" : [
{
"id" : 101,
"name" : "widget1",
"quantity" : 3
},
{
"id" : 105,
"name" : "widget7",
"quantity" : 1
}
],
Additional properties omitted...
}
13
Chapter 2 Design and Implement a Nonrelational Data Model
{
"id" : 101,
"doctype" : "product",
"name" : "widget1",
"standardCost" : "3.99",
"listPrice" : "5.99",
"weight" : "0.25",
Additional properties omitted...
Since these documents will often be queried together, they should be collocated
in the same container. We implement the “doctype” property to allow us to query the
documents we need, and partition documents. A user viewing an order on the Adventure
Works web page will be able to see a summary of their order easily and be able to click
through a product link and pull up information on that product. We have embedded a
summary of the product in the Sales Order document.
• Contained relationships
• One-to-few relationships
• Infrequent change
• Queried together
• Bounded growth
14
Chapter 2 Design and Implement a Nonrelational Data Model
When considering the reference approach, consider if the data model requires
• One-to-many relationships
• Many-to-many relationships
• Unbounded growth
And finally, when considering the hybrid approach, consider if the data model
requires
• Aggregates
Figure 2-2 is a visual representation of the three approaches. The embed approach
represents all data contained in a single document. The reference approach represents
a schema where what would be one document in the embed approach broken out into
multiple documents. And the hybrid approach represents some data that is embedded
and the rest is referenced.
As you can see, embedding is beneficial for a bounded set of information, and by
embedding it, read performance is increased. Azure Cosmos DB will retrieve data from
a single document faster than it will by retrieving multiple documents. The improved
read performance translates into lower query cost and lower latency. However, there are
many trade-offs to consider in the NoSQL world. Larger documents are more expensive
to write and even more expensive to update. In the case of the Sales Orders document, if
we embedded all the information into a single document using an array of JSON objects,
the document would become more and more expensive to update as new items are
added to the order. This is not scalable.
15
Chapter 2 Design and Implement a Nonrelational Data Model
The reference method splits the data into multiple documents. This data would
normally be represented as an array. Reading becomes more expensive as the service
must find more documents, but writing is improved since the document size has been
reduced by including less information. This is most appropriate when considering
an array that could grow rather large, and no upper bound exists to the total number
of objects. In our example, we create a reference to the full Product document by
embedding the Product ID into the Sales Order document.
The hybrid approach attempts to hedge the trade-offs of the other two approaches.
Using our Sales Order data as an example, the hybrid approach allows us to see a
summary of the products in our order which is read performant while also reducing
the document size by not storing all of the product data. A trade-off is introduced in
this pattern however, and it is due to denormalization. If you reference a subset of a
product’s properties in the SalesOrder document, what happens if the name of a product
is updated? We must implement a mechanism to maintain the reference. This can easily
be done using the change feed which will be discussed in a later chapter. But think of
the change feed as akin to a change data capture (CDC) table on a SQL server. Using
the change feed, we can trigger an update to all references based on the update of the
product document.
The hybrid approach illustrates how we can develop a model that denormalizes
data across documents. This is an important diversion from the rules we abide by in the
relational world. This provides greater flexibility for a design which optimizes performance
and reduces latency to accommodate the way we access our data. The idea of data
denormalization is a topic that will surely be present in the case studies of the exam.
16
Chapter 2 Design and Implement a Nonrelational Data Model
By adding properties to this field, Azure Cosmos DB will enforce uniqueness within
a logical partition. Consider our Products logical partition where products have an ID
and a name. The ID will already be constrained as unique but suppose we also want
to ensure the names of our products are unique. When we create the container to
store these documents, we can define the constraint by adding “/name” in the unique
keys field.
Another feature that is useful to know and important to understand for the exam is
time-to-live (TTL). TTL defines a time in seconds which will delete documents based
on the “_ts” property. The “_ts” property stands for timestamp and represents the last
modified time of a document based on epoch time in seconds. TTL can be configured at
the container level or on individual documents. To leverage document-level TTL, TTL
17
Chapter 2 Design and Implement a Nonrelational Data Model
must be configured on the container as well else the “ttl” field on a document will be
ignored. If you do not want to set a TTL on the container, enable the feature and set the
option to “On (no default).”
When setting TTL on a container or document, you can set the value to “-1” to signify
that the container should not expire documents (on, no default) or that the document
should not expire. If you set the TTL at the container level, any document which does not
have a “ttl” property will honor the container-level TTL. Listing 2-3 demonstrates setting
the TTL at the container level using the C# SDK.
18
Chapter 2 Design and Implement a Nonrelational Data Model
// Create a new container with TTL enabled and without any expiration value
Container container = await database
.CreateContainerAsync(properties);
TTL set at the document level will take precedence over TTL set at the container
level. Listing 2-4 demonstrates how to set the TTL at the container level.
await container.CreateItemAsync<SalesOrder>(item);
Summary
Data modeling is an important subject to understand in the world of NoSQL. It is a
fundamental skill to properly implement NoSQL workloads on Azure Cosmos DB as
well as understand the questions and use cases presented on the exam. Unlike the
relational world, we can use the flexibility of JSON documents to meet the performance
and latency needs of our application. Each decision comes with trade-offs which makes
careful planning important.
19
CHAPTER 3
21
© Steve Flowers 2023
S. Flowers, Designing and Implementing Cloud-native Applications Using Microsoft Azure Cosmos DB,
Certification Study Companion Series, https://doi.org/10.1007/978-1-4842-9547-2_3
Chapter 3 Plan and Implement Sizing and Scaling
An Azure Cosmos DB account is made up of three keys components: the account, the
databases, and the containers. The account is the top-level resource you deploy into your
Azure environment. This is where you will manage role-based access control (RBAC),
firewall, and features and access the Data Explorer. The Data Explorer allows you to
manage your databases, manage throughput, and issue queries against your containers.
Databases are the next level of your Azure Cosmos DB resource. They will be comprised
of your containers and can also be allocated throughput. Finally, your containers are the
buckets that your data will be stored in and can also be allocated throughput. If we think
back to the example of a library, the library itself is the account, rooms are the databases,
and sections of the rooms are the containers. Finally, the granular control over how
much processing we can perform on the data in our containers is defined by request
units, or RUs. Allocating more RUs means we can store more data and more physical
partitions are deployed. RUs represent the throughput available to our databases or
containers.
The hierarchy of Azure Cosmos DB entities is pictured in Figure 3-1: the account
at the highest level, then the databases within, and finally, the containers which reside
within databases.
It is important to understand this hierarchy, but this is all abstraction to what is really
being deployed to the service under the hood. To understand sizing and scaling, we
need to be familiar with the way in which Azure Cosmos DB provides throughput to our
22
Chapter 3 Plan and Implement Sizing and Scaling
containers. As mentioned earlier, this impacts our performance and partitioning. There
are two main ideas that are important to understand: these are logical partitions and
physical partitions.
Logical partitions are the subsets of our data that are defined by our partitioning
key. You will sometimes hear logical partitions referred to as key ranges since a logical
partition is defined by our partition key, and a range of those keys will be assigned to
each physical partition. For instance, if we partitioned by a customer’s name in our
e-commerce application, each customer would have a logical partition that comprises
their data. This is again beneficial to scaling and performance as queries which need
to read a specific customer’s orders would only be routed to a single logical partition. If
your application includes hundreds or thousands of customers, across tens or hundreds
of physical partitions, the partition key and hence the identification of your logical
partitions means that the query must only be routed to the specific physical partition
that contains that specific customer’s data. Notice I didn’t say “partitions,” plural. This
was done purposefully because at this time, a logical partition can only be contained
within a single physical partition. But more on that later.
Physical partitions are the physical resources that make up our cluster. When we
think of a cluster, we must think of nodes in a cluster. As we increase our need to store
data or serve requests, more nodes must be added. In Azure Cosmos DB, physical
partitions are made up of four nodes. There is a leader node and three follower nodes,
as shown in Figure 3-2. When using the multi-write capabilities of Azure Cosmos DB,
one of the follower nodes will be designated a forwarder node, which is responsible for
replicating data to other geographic regions. We also consider a physical partition to be a
replica set because it is a load-balanced group of replicas spread across fault domains.
24
Chapter 3 Plan and Implement Sizing and Scaling
Throughput Provisioning
Throughput provisioning is an important concept which will certainly be a topic of
questions on the exam, as well as case studies. Throughput provisioning is defined by the
number of request units (RUs) that we assign to our workloads. RUs are an abstraction of
CPU, memory, and IOPS that provide a granular yet easy to understand mechanism for
controlling performance as well as cost at scale. Our operations (reads, writes, updates,
deletes) have an RU cost associated with them which will inform how many RUs we need
provisioned to support the workload. RUs can be provisioned at the container level, or at
the database level. RUs provisioned at the database level are considered shared, which
will be discussed in the next section. There are three throughput provisioning models:
manual, autoscale, and serverless.
To meet this workload, we need 2,600 RUs or else HTTP status code 429 errors will
be returned. The 429 error indicates that the provisioned throughput has been exceeded.
The client will attempt to retry based on the retry policy. A small percentage of 429s is
acceptable (1–5%) as they will likely be mitigated by retries which are automatically
configured in the connection when using the Azure Cosmos DB SDK. It is a good idea
to leave some buffer in this case if an unexpected spike of traffic is received. There are
new features in Azure Cosmos DB such as bursting to account for this, but this feature
25
Chapter 3 Plan and Implement Sizing and Scaling
is outside of the scope of the exam at the time of this writing. In addition to the RU
requirements for our operations, we also need provisioned RUs for the storage of our
account. Ten RUs are required per 1 GB of data stored.
Manual provisioned throughput is best for workloads that may see small spikes
in operations but overall are mostly flat. As you can see in Figure 3-4, throughout the
day the RU consumption is mostly flat, but there is room in the provisioned RUs to
accommodate small spikes. Manual provisioned throughput is best for workloads with
predictable throughput requirements.
When provisioning manual throughput, Azure Cosmos DB will use the number of
RUs provisioned to determine how many physical partitions to create. When the number
of RUs increases, more physical partitions will be created. When you initially create a
container and provision RUs, one physical partition will be created for every 6,000 RUs.
26
Chapter 3 Plan and Implement Sizing and Scaling
When you have multiple physical partitions, RUs are split evenly across them. If we
select to provision 9,000 RUs, two physical partitions will be created and be allotted 4,500
RUs each. After initial creation, when additional RUs are added, new physical partitions
will be created for every 10k RUs. For example, I first create a container and assign 9k
RUs. Two physical partitions of 4.5k RUs are created. I later increase my RUs to 14k, I will
still have two physical partitions of 7k RUs each. If I again increase the RUs to 21k, I will
now have a third physical partition created. Each physical partition will have 7k RUs.
Figure 3-5 shows how throughput is split between partitions in the scenario described.
Physical partitions have a max limit of 10k RUs, hence the need to add additional
physical partitions when the RUs exceed this amount. Additionally, since a logical partition is
tied to a single physical partition, the max number of RUs for a logical partition is also 10k.
27
Chapter 3 Plan and Implement Sizing and Scaling
Autoscale has an increased cost when compared to manual RUs. The increased
cost comes from the fact that resources are reserved so that autoscale scales instantly
when your workload demands additional RUs. Unlike other services, there is no wait
time for cluster/node provisioning in the back end to provide the additional resources.
Autoscale also has a minimum number of RUs you will be billed for. The best way to
leverage autoscale is to set the minimum as close as possible to your baseline to ensure
you are paying the minimum most of the time, and scaling to meet spikes in operations
to prevent 429 errors. Previously, the min/max was 400 RUs/ 4k RUs. Recently this has
been amended to 100 RUs/ 1k RUs. Autoscale operates the same as manual in that new
physical partitions are provisioned except that a new physical partition is created for
every 10k RUs regardless (whether that be initial creation or RUs that are added later).
Figure 3-6 shows a traffic pattern that is best fit for autoscale provisioning. As you
can see, hour-by-hour traffic has a lot of spikes. Every other hour in this case is using
drastically lower RUs. Autoscale charges RUs based on the max that were used in that
hour, so based on Figure 3-6, you would be billed around 400 RUs for the low throughput
hours and around 2k–2.5k RUs for the higher throughput hours.
28
Chapter 3 Plan and Implement Sizing and Scaling
Serverless Throughput
Serverless throughput is not considered “provisioned” since the resources are not
dedicated to your workload. Serverless is considered a “consumption-based offering” as
you are only billed for the RUs that you consume. It is important to note here, however,
that you are billed for storage in Azure Cosmos DB as well as RUs. The consumption-
based nature of serverless provides straightforward pricing with no overhead as RUs are
consumed on a per-query basis. You do not have to commit to a specific amount of RUs
and there is no additional cost when not using the serverless throughput.
Serverless is a great throughput model when you are just getting started with
Azure Cosmos DB or working with development workloads. It can be appropriate for
some production workloads but there are some limitations to serverless throughput. A
serverless account can only run in a single region. By using serverless, you no longer gain
the benefit and scale of a multi-region deployment. Additionally, serverless containers
can only store a maximum of 50 GB (however, at this time 1 TB of storage is currently
in preview). Serverless-provisioned containers are also limited to a single physical
partition, hence the lack of multi-region support. The limitation of a single physical
partition limits your serverless throughput per container to 5k RUs. Even though the max
RU per physical container is 10k RUs, the limit on serverless containers remains 5k RUs.
The consumption pattern of a container that would benefit from serverless would look
like Figure 3-7.
29
Chapter 3 Plan and Implement Sizing and Scaling
30
Chapter 3 Plan and Implement Sizing and Scaling
Databases with provisioned throughput will have a “Scale” tab which allows
modification of the throughput provisioned at the database level as you can see in
Figure 3-9 when looking at the “shared” database.
31
Chapter 3 Plan and Implement Sizing and Scaling
When creating a new container under a database with shared throughput, you
are offered the option to provision throughput for the container as you can see in
Figure 3-10. By not checking this box, you are allowing the container to leverage the
throughput that was provisioned at the database level as shared throughput. If this box
is checked, you are configuring dedicated throughput for this container that will not
consume the shared throughput of the database. As you can see, dedicated and shared
containers can both coexist in the same database and there is granular control over
which containers have dedicated throughput and which are using shared throughput.
32
Another random document with
no related content on Scribd:
Family 1. Syllidae see p. 306 Family 8. Amphinomidae see p. 318
" 2. Hesionidae " 308 " 9. Eunicidae " 318
" 3. Aphroditidae " 309 " 10. Glyceridae " 320
" 4. Phyllodocidae " 313 " 11. Sphaerodoridae " 320
" 5. Tomopteridae " 315 " 12. Ariciidae " 321
" 6. Nereidae " 315 " 13. Typhloscolecidae " 321
" 7. Nephthydidae " 317
Sub-Order 2. Spioniformia.
Family 1. Spionidae see p. 321 Family 4. Magelonidae see p. 325
" 2. Polydoridae " 323 " 5. Ammocharidae " 325
" 3. Chaetopteridae " 323
Sub-Order 3. Terebelliformia.
Family 1. Cirratulidae see p. 325 Family 3. Ampharetidae see p. 330
" 2. Terebellidae " 327 " 4. Amphictenidae " 330
Sub-Order 4. Capitelliformia.
Family. Capitellidae, see p. 331.
Sub-Order 5. Scoleciformia.
Family 1. Opheliidae see p. 331 Family 4. Scalibregmidae see p. 334
" 2. Maldanidae " 332 " 5. Chlorhaemidae " 334
" 3. Arenicolidae " 333 " 6. Sternaspidae " 335
Branch B. Cryptocephala.
Sub-Order 1. Sabelliformia.
Family 1. Sabellidae see p. 336 Family 3. Amphicorinidae see p. 339
" 2. Eriographidae " 338 " 4. Serpulidae " 339
Sub-Order 2. Hermelliformia.
Family. Hermellidae, see p. 341.
In Aphroditidae and certain Amphinomidae the body is more or less oval in shape.
In Lipobranchius and Sternaspis it is grub-like, short, and cylindrical, with rounded
ends; in the former it is difficult to distinguish head and tail, or dorsal and ventral
surfaces.
The segments composing the trunk may be all alike, or may constitute two more or
less sharply marked regions, the thorax and abdomen, differing in the character of
the chaetae, or in their arrangement, or in some other way, as in the Sabelliformia
and the Capitelliformia.
The posterior extremity is generally more or less narrowed, and most of the
Nereidiformia are provided with special elongated cirri, borne by the anal segment.
In the Maldanidae and others the body terminates in a funnel, at the bottom of
which is placed the anus. Only in a few cases is the anus not terminal; in
Notopygos and other Amphinomidae, as well as in some species of Polynoë, it is
dorsal.[313] In Sabellaria and Pectinaria the hinder end of the body undergoes
great degeneration; in the former it is achaetous, but cylindrical and bent forwards
alongside the body (Fig. 131). In Pectinaria (Fig. 177), this region, which is called
the "scapha," is leaf-like, and serves to close the narrower end of the tube in which
the worm lives. Arenicola marina, and some Terebellids have no chaetae in the
hinder, narrower part of the body.
In the family Serpulidae one (rarely two) of the most dorsally placed gill filaments
is enlarged terminally, and acts as a stopper or "operculum," which closes the
mouth of the tube when the animal withdraws into it. Further, in Spirorbis this
operculum is grooved on one side, and serves as a brood pouch in which the eggs
undergo development (Fig. 184, p. 341). It will be seen, therefore, that the palps
may be very important organs for the life of the worm, and they are no less
interesting to the comparative anatomist, serving as they do as an excellent
illustration of the various uses which Nature finds for one and the same organ.
In the other sub-Orders the prostomium carries neither palps nor tentacles.
In the Cryptocephala there is never more than a single pair of tentacles, and these
are generally reduced to a group of sensory cells, though in Sabellaria they retain
a considerable size.
In a few genera, such as Aphrodite, Nephthys, Capitella, the first postoral segment
is distinguished from the succeeding segments only by its position with regard to
the mouth (Fig. 132) and by its smaller size. But in the remainder of the
Polychaeta, with here and there an exception, the peristomium is achaetous in the
adult.[319]
In a few cases, such as the Chlorhaemids and Sternaspis, and to a slight degree
in Arenicola, the "head" and even the anterior part of the worm is capable of being
withdrawn into the body.
In most Annelids the chaetae are in two bundles on each side, but there are
certain families in which the dorsal bundle, and even the notopodium itself, is
absent, as in the Eunicidae, Syllidae, and Phyllodocidae; or the dorsal bundle may
be absent only in certain regions of the body, as in the hind-body of Terebellids. In
some Amphinomidae and Aphroditidae the notopodium is scarcely distinct as a
separate lobe, being a slight tubercle on the upper surface of the neuropodium;
but the notopodial chaetae are present, and indeed particularly well developed in
many cases.
But whilst, in the Nereidiformia, the parapodia, whether consisting of two lobes or
only one, are always well developed, and project to a more or less pronounced
degree from the sides of the body, it is otherwise in the rest of the group, where
the chaetigerous lobes are usually reduced to mere tubercles or ridges, no doubt
in relation to their burrowing or tubicolous habits. In Sternaspis the chaetae issue
directly from the body-wall.
Amongst the Nereidiformia we find examples in which the parapodia, instead of
being more or less conical "legs," are flattened fore and aft so as to serve as
efficient "fins," as in the active swimmers, Nereis virens and Nephthys caeca, and
in the pelagic Phyllodocids, Alciopids, Typhloscolecids, and Tomopteris.
Of the typical dorsal and ventral cirri, the ventral is only absent in some
Amphinomids amongst the Nereidiformia; the dorsal is absent in Nephthys and
degenerate in Glycera, whilst in a very large number of families of the other sub-
Orders neither cirrus is present. These cirri, though originally filamentous and
sensory, may, by virtue of special blood supply, become "gills," and this occurs in
several families of different sub-Orders. Thus in Eunice this gill is comb-like; in
Amphinome and in Arenicola (on certain segments) it is arborescent, as it is also
in one to three segments in Terebellids; whilst in Ariciidae, Spioniformia,
Cirratulidae, Opheliidae, and Sabellaria it remains more or less finger-shaped or
filamentous. In the family Serpulidae the thoracic cirri, both dorsal and ventral,
become flattened and extended antero-posteriorly, and unite with one another to
form the "thoracic membrane."[320] In Phyllodocidae the cirri are foliaceous and
natatory, and they contain a great quantity of glands of a peculiar character. The
Aphroditidae are distinguished from other Annelids by the possession of "elytra" or
dorsal scales, which appear to be the dorso-ventrally flattened cirri, retaining their
sensory nature, but adding to this function several others.[321]
The chaetae or bristles are mainly used in locomotion, but it is not unreasonable
to believe that some of the stronger, serrated kinds may be used as weapons of
offence and defence; certainly the Polynoids, bristling as they do with stiff chaetae
along each side, must be rather unpleasant to their smaller enemies.
The various bristles may be placed in three chief groups, viz. (1) simple; (2)
jointed; (3) uncini (see Fig. 138).
(1) The simple chaetae may be smooth and hair-shaped, i.e. "capillary," such as
are present in nearly all families: or they may be forked (Amphinomidae), comb-
shaped (Eunice), notched or serrated, or provided with a series of frills at right
angles to their length, as in Aphroditidae; or fringed along one or both sides with a
membranous expansion, as in Terebellids and Sabellids. The simple chaetae may
also be short and spine-like, as in the ventral bundles of Arenicola; or they may be
slightly curved at the end and notched, forming what are generally termed
"crotchets," such as are common amongst Oligochaeta. These "crotchets" may be
simple, or have numerous denticulations at the end (Maldanidae), or be provided
with a membranous hood (Spioniformia, Capitelliformia). In Hermione peculiar
sheathed, spear-like bristles occur (Fig. 138, N).
(2) Jointed chaetae have already been described (p. 246); they are confined to the
sub-Order Nereidiformia, and occur only in certain families.
(3) The uncini are very short chaetae, which are simply embedded in the skin, and
do not extend beyond the body-wall into the body-cavity. An uncinus is a sharply
curved hook, which may have more or less numerous secondary teeth on it. They
are characteristic of the Sabelliformia and the Terebelliformia.
While the chaetae in the Nereidiformia and others are grouped in bundles, those
of many other families are in vertical, transverse rows, as in Maldanidae and in
Arenicola. The uncini are always embedded in such rows, usually slightly raised
from the general level of the body surface, each being termed a "torus
uncinigerus." These tori are usually limited to the sides of the body, but in Myxicola
and in Notomastus they encroach upon the dorsal surface, and in Chaetozone,
also upon the ventral, so as nearly to encircle the body, recalling the
"perichaetous" condition of some earth-worms.
Gills.—We have already seen that several different organs, e.g. the palps in
Sabelliformia, the prostomial tentacles of Chlorhaemidae, and the notopodial cirri
of sundry other Polychaetes, may take on a respiratory function. There are,
however, certain "gills" developed either on the parapodium itself or elsewhere on
the body which it is difficult to homologise. Such are the retractile gills on the
parapodia of the Glyceridae (Fig. 136, C); those of Dasybranchus, near the
abdominal neuropodia; those of Mastobranchus, near the notopodia. Nephthys
has a sickle-shaped gill on the under surface of the notopodium. The long gill
filaments at the posterior end of Sternaspis, again, are only doubtfully interpreted
as the dorsal cirri of some of the posterior segments.
Since primitively the whole skin of the worm is respiratory, any part of the skin may
become more or less specialised for this function, and chiefly, of course, on the
more actively moving parapodia. The blood-vessels constituting the essential part
of the "gill" may make use of any already existing outgrowth (such as a cirrus or a
tentacle), or may push the body-wall out on their own account.
Internal Anatomy.
Probably those organs which have the greatest effect in modifying the shape of
the body are the septa, for we find in the long, free-swimming worms that these
are regularly present throughout the body, and external "segmentation" of the
body is well marked. In burrowing and tubicolous forms the septa are frequently
incompletely developed, or more or fewer may be absent; and the body becomes
less distinctly segmented externally, tends to vary greatly in diameter during
movement, or becomes plumper. With the disappearance of the septa there is also
a diminution in the number of nephridia, as in Arenicola, with only six pairs.
Further, there is frequently a dimorphism of these organs; instead of all of them
serving equally as excretory organs and as genital ducts, some of the most
anterior in the Sabelliformia and Terebelliformia become greatly enlarged, and
take on practically the whole of the former function; whilst more or fewer of the
posterior nephridia dwindle in size, and become genital ducts. The absence of
septa allows a free communication between the successive segments, and thus a
freer flow of coelomic fluid for the distension of the anterior end of the worm during
burrowing.
In the Scoleciformia and Capitelliformia the buccal region exists, but there are no
jaws. In the Sabelliformia and Terebelliformia eversion does not take place and
jaws are absent.
Amongst the Nereidiformia the jaws are absent in the Phyllodocidae and
Hesionidae; when present they are usually set in the direct course of the food.
There may be one small tooth used for stabbing, as in some Syllids (Fig. 141, A);
or a circle of such denticles (Autolytus, Fig. 140, D). To these are added powerful
grasping jaws in Nereis (E); or the latter may alone be present, as in Glycera (F).
In Polynoë the four jaws are carried by hard pieces, to which the muscles are
attached (C and G). In Nephthys there is a dorsal and a ventral jaw.
In the Eunicidae, however, the numerous denticles are carried in a special pouch
below the food tract, with which it communicates anteriorly.[323] They are arranged
in an upper and lower series. The lower series (L) consists of a pair of flat plates
(k) on each side partially embedded in and acted upon by muscles, with a harder
enamelled piece—the actual lower "tooth" (j)—at its anterior end. The upper series
(U) consists of several pieces, varying in shape and size in the various genera of
this family; but developmentally they result from modifications of two rows of small,
similar pieces.[324]
The intestine is generally straight and cylindrical, and is usually constricted by the
septa, if these are present. In the Polynoids the intervening sacculations become
so long as to receive the name of "caeca," which, in Aphrodite, become
enormously elongated (Fig. 142); there are eighteen pairs of them (c), each being
a slender tube bent upon itself, giving off short branches and dilated distally,
where it lies in the base of the parapodium.
Fig. 141.—A, Alimentary canal of Syllid: B, transverse section of pharynx of the
same; b, buccal region; d, oesophageal outgrowth; g, salivary glands; i,
intestine; j, tooth; p, pharynx; s, gizzard: C, alimentary canal of Petta (after
Wirén); i, intestine; o, oesophagus; r, rectum; s, stomach.
Otocysts are rare. Arenicola possesses a pair at the base of the prostomium, each
of which in some species retains an opening to the exterior.[327] They probably
serve as "organs of direction" rather than of "hearing." Aricia and Polyophthalmus
likewise have such organs on the prostomium; whilst Fabricia, Myxicola, Terebella,
and a few others possess them in the peristomium, or in some other segment of
the body.
Fig. 144.—Ammotrypane aulogaster Rathke, enlarged. (From Cuningham.) Anterior
end. a, Prostomium; b, everted buccal region; c, notopodial cirrus; X, ciliated
organ everted; I, II, III, first three segments.
The eggs and spermatozoa in the Polychaeta are discharged into the sea either
by rupture of the body-wall or through the nephridia; the male and female
elements unite, and the resulting fertilised eggs undergo development, either
floating separately in the water, or embedded in jelly, or attached to the body or to
the tube of the worm.
The little animal is thus equipped for an independent life: the provisional chaetae
help in keeping it balanced; and in some cases (Spionidae) serve to protect the
little soft creature, for when it is touched it curls up, and its chaetae stick out at the
sides, so that it looks like a hairy caterpillar. But the larva is quite at the mercy of
the sea, for it is carried hither and thither by currents, and in this way the species
is disseminated. The larvae of the Polychaetes, like those of other animals, occur
at certain periods of the year in large quantities at the surface of the sea, and
serve as food for various larger animals.
These larvae are at first very different from the adult animal, and the necessary
changes to be passed through are more or less great according to the species. It
is not our intention to describe these changes in detail.[329] The larva increases in
size, the permanent chaetae make their appearance in regular order, and the body
exhibits segmentation, the new segments always appearing just in front of the anal
segment. The internal organs gradually develop, and the prostomial and
parapodial appendages grow out in their turn. In the Sabelliformia the
multifilamentous "gills" arise by the continued branching of an at first simple
process (the palp) arising from the latero-ventral surface of each side of the
preoral lobe.[330] These gradually encroach dorsally and ventrally till the
prostomium is more or less encircled; meanwhile the peristomium grows forwards
so as to conceal the prostomium, which no longer increases at the same rate as
does the rest of the body.
Although most worms appear to discharge their ova directly into the sea and take
no further care of them, some make provision for their offspring either by laying
the eggs in a jelly, which will serve as food for the young larvae—Aricia, Ophelia,
Protula, Phyllodoce—or by attaching them to their body. In certain Polynoids the
eggs are attached by means of a secretion to the back, under the elytra, where
they undergo development up to a certain stage. In Exogone and some other
Syllids they are attached to the ventral cirri, or in Grubea limbata, all over the
back. In the female Autolytus (Sacconereis) a ventrally-placed brood sac is formed
by the hardening of a secretion; the eggs develop into embryos inside the brood
sac, and then become free, with head appendages and three pairs of parapodia.
Enormous numbers of such embryos may occur; for instance, some 300 were
counted in a brood sac of Autolytus ebiensis. In the case of tubicolous worms, the
eggs are frequently attached to the tube, either inside or outside. In Spirorbis and
Salmacina the operculum serves as a brood pouch.
Only a very few species are known to be viviparous, viz. Syllis vivipara Kr.,
Cirratulus chrysoderma Clap., Marphysa sanguinea Mont., and Nereis diversicolor
Müll.
In most genera there is no external difference between a mature worm filled with
generative products and an immature one, except, it may be, in the colour; for the
yolk of the eggs is frequently tinted yellow, or pink, or bluish, while the
spermatozoa in mass are white; so that the normal colouring of the worm may be
modified when filled with these elements. But in a few instances striking
anatomical peculiarities are exhibited by the mature worm.[331] In many species of
Nereis, for instance, those segments containing the generative products undergo
more or less extensive changes, while the anterior ones remain unaltered. The
body of the ripe Nereis is then distinguishable into an anterior non-sexual region
and a posterior sexual region; and so great are these changes in certain species
that the mature worms were for a long time believed to belong to a different genus,
and received the name Heteronereis. But we now know their true relations, thanks
to the work of Claparède and others. The males in the Heteronereid phase have
fewer unaltered anterior segments than the females, so that there is a sexual
dimorphism.
The changes which Nereis undergoes in its transformation affect chiefly (a) the
shape of the parapodia, and (b) the form of the chaetae of these parapodia. Other
organs may also be affected, though less noticeably; thus the eyes become
enlarged, the intestine may become so compressed by the generative products as
to be functionless, and the tail develops special sensory papillae.[332]
In the parapodia an increase in size and a sharper delineation of the various parts
take place; then flattened foliaceous outgrowths (Fig. 147, x, y) arise from certain
lobes of the feet, in which, too, the blood supply becomes greatly increased. The
old chaetae are pushed out by the development of new ones of quite a different
shape; these are jointed like the old ones, but the appendix is, in many species at
least, flattened and oar-shaped (Fig. 123, C, p. 246); and the chaetae are
arranged in a fan-like manner. Both these modifications are in evident relation to
the free-swimming habit which the Heteronereid now adopts. The new foot serves
as a swimming organ, the old one was a walking appendage.
But in other genera the hinder genital region of the body becomes separated, on
maturity, from the anterior non-sexual region. Various stages of this "schizogamy,"
or fission into a sexual and a non-sexual zooid, have been observed in different
genera. In the genus Syllis the first segment of the sexual zooid, after its
separation from the asexual zooid, proceeds to bud forth a head. The character of
the head is alike in both sexes, though different species present heads of different
shapes; and as the worms were originally described as distinct genera, the names
then given are retained as descriptive terms. Thus the "Chaetosyllis" form has only
two tentacles; the "Ioda" form has three tentacles and a pair of palps. One and the
same species (e.g. S. hyalina) may successively pass through these stages.
With regard to the asexual portion, there is a regeneration of the tail segments
after the sexual zooid has separated; and the number of segments so regenerated
is usually equal to those that have become sexual. After a time these newly
formed segments will produce generative organs, and take on the characteristic
natatory chaetae, and this region will in its turn separate.
One original "stock," or asexual zooid, thus produces several sexual zooids, but
these are only of one sex for a given stock. The males differ in several important
characters from the females; so different, indeed, are the two sexes that before
their history was worked out by Agassiz[335] they were placed in different genera.
The male zooid has thus come to be known as Polybostrichus (Fig. 149, B). It has
three tentacles and two bifid palps; there are two pairs of peristomial cirri; the
testes are confined to the four anterior segments, which are without natatory
chaetae. The female is termed Sacconereis, owing to the possession of a great
ventral brood sac; its head possesses no separate palps; the peristomium carries
only one cirrus on each side; ova occur in every segment of the body, and may
even extend into the hinder segments of the asexual zooid (Fig. 149, C).
Fig. 149.—Myrianida fasciata. (From Malaquin.) The bright red markings of the living
animal are here represented black. A, An asexual individual which has
produced by budding from the zone (z) a chain of twenty-nine zooids, the
oldest being labelled 1, the youngest 29. B, A ripe male zooid (Polybostrichus),
with three tentacles and a pair of forked palps (p). There are five unaltered
anterior segments. C, A ripe female zooid (Sacconereis) with the palps fused
with the prostomium; s, the ventral brood pouch projecting on each side; t,
tentacles.