More precisely, backup and recovery play a substantial role in data management. Two popular methods for database backup are Periodic and Continuous backup. Today, we will delve into the details, focusing on DP-420 Designing and Implementing Native Applications Using Microsoft Azure Cosmos DB Exam.
Periodic Backup
Periodic backup involves taking backup of the data at regular intervals. You can choose to back up your data hourly, daily, weekly, or monthly. Users can restore data to the most recent backup point. With Microsoft Azure Cosmos DB, periodic backup is managed through Azure portal, using the Azure CLI, or programmatically using the Azure Cosmos DB SDK.
Let’s consider an example below:
If the backup interval is set to 4 hours, the backups are taken 6 times each day. If you need to restore data, you’ll be able to go back up to 4 hours.
Cosmos DB, however, has a 2-tier backup policy; one tier goes back 30 days with an 8-hour interval. The second tier is immutable and goes back 180 days.
az cosmosdb sql container create \
–account-name “$accountName” \
–database-name “$databaseName” \
–name “$containerName” \
–resource-group “$rg” \
–backup-policy-type “Periodic” \
–backup-interval 240 \
Here are some factors to consider with periodic backup:
Pros | Cons |
Simple to implement | Restores data up to most recent backup only |
Automated | Risk of data loss between backups |
Lower storage requirements | Longer recovery time |
Continuous Backup
On the other hand, continuous backup involves a real-time, ongoing process that captures every change to the data as it happens. With the continuous backup mode in Azure Cosmos DB, you can perform granular point in time recovery of your data.
For instance, if a mistaken delete operation was carried out on the data, you can recover the data to the point just before this operation occurred:
az cosmosdb sql container create \
–account-name “$accountName” \
–database-name “$databaseName” \
–name “$containerName” \
–resource-group “$rg” \
–backup-policy-type “Continuous” \
Some factors to consider with continuous backup:
Pros | Cons |
Real-time data backup | Higher storage requirements |
Point in time recovery | Possible performance impact |
Lesser data loss | Complex to manage |
Now the question arises, which backup method should you choose for your Microsoft Azure Cosmos DB?
It depends primarily on your business requirements. If you have a business where data is updated very frequently and the risk of data loss should be minimal, then continuous backup would be the right choice. However, if your data doesn’t change frequently, implementing a periodic backup can suffice.
In the DP-420 Designing and Implementing Native Applications Using Microsoft Azure Cosmos DB Exam, you will need to evaluate the business and technical requirements to decide the type of backup policy for your Cosmos DB.
In conclusion, each backup strategy has its advantages and disadvantages. The choice between periodic or continuous backup would depend on the priority of data recovery against performance and the nature of changes made to the data in your Azure Cosmos DB.
Practice Test
True or False: Periodic and Continuous backup are two options available for backing up data in Azure Cosmos DB.
- True
- False
Answer: True
Explanation: Azure Cosmos DB offers both periodic and continuous backup options. Periodic backup takes snapshots of data at scheduled intervals, while continuous backup continuously captures changes as they happen.
Which backup option is well-suited for scenarios where data changes infrequently and recovery point objectives are not stringent?
- A) Periodic backup
- B) Continuous backup
Answer: A) Periodic backup
Explanation: Periodic backup is suitable when data doesn’t change frequently and when the recovery point objectives aren’t stringent. Continuous backup is more ideal for constant data changes and tight recovery objectives.
True or False: Continuous backup on Azure Cosmos DB can restore data to any point in time in the last 30 days.
- True
- False
Answer: True
Explanation: Continuous backup mode provides the capability to restore data to any point in time in the last 30 days.
True or False: With continuous backup, Azure Cosmos DB automatically takes a backup every hour and retains each backup for eight hours.
- True
- False
Answer: False
Explanation: The statement describes periodic backup, not continuous backup. In continuous backup mode, Azure Cosmos DB continuously captures changes, allowing for restore to any point within the last 30 days.
What is one disadvantage of continuous backup compared to periodic backup in Azure Cosmos DB?
- A) Higher cost
- B) Lesser security
- C) More complexity
- D) Slower performance
Answer: A) Higher cost
Explanation: Continuous backup generally costs more than periodic backup due to its operation complexity and the continuous nature.
True or False: The retention period of a backup in periodic backup mode is 8 days.
- True
- False
Answer: False
Explanation: The retention period for periodic backups in Azure Cosmos DB is 30 days, not 8 days.
Which option provides the ability to restore data to an arbitrary second within the past 30 days?
- A) Periodic backup
- B) Continuous backup
Answer: B) Continuous backup
Explanation: Continuous backup mode captures data changes continuously, which enables data restoration at any point in the last 30 days.
Which backup method requires manual setup and action for each backup operation in Azure Cosmos DB?
- A) Continuous backup
- B) Periodic backup
Answer: B) Periodic backup
Explanation: In the case of periodic backup, you have to manually set up each backup operation. Continuous backup, on the other hand, is continuously capturing changes.
True or False: Continuous backup affects the performance of Azure Cosmos DB.
- True
- False
Answer: False
Explanation: Continuous backup is designed to have minimal performance impact on Azure Cosmos DB operations.
In terms of recovery point objective (RPO), which backup option offers a shorter RPO?
- A) Periodic backup
- B) Continuous backup
Answer: B) Continuous backup
Explanation: Continuous backup offers a shorter RPO as it continuously captures changes as they occur.
Is it possible to switch between periodic and continuous backup after the creation of Azure Cosmos DB account?
- A) Yes
- B) No
Answer: B) No
Explanation: The backup policy is decided at create time and cannot be switched between periodic and continuous backup after the account is created.
Which backup policy in Azure Cosmos DB is enabled by default?
- A) Periodic backup
- B) Continuous backup
Answer: A) Periodic backup
Explanation: By default, Azure Cosmos DB accounts are using periodic backup policy. You must explicitly choose continuous backup at the time of Cosmos DB account creation.
True or False: With the continuous backup mode, transaction logs are stored for a shorter period of time than with the periodic backup mode.
- True
- False
Answer: False
Explanation: With continuous backup mode, transaction logs are stored for a longer period of time than with the periodic backup mode.
Which backup policy can help to create backups at a point-in-time of your choosing within the last 30 days for disaster recovery purposes?
- A) Periodic backup
- B) Continuous backup
Answer: B) Continuous backup
Explanation: Continuous backup policy allows for backup at any given point-in-time in the last 30 days, which is useful for more granular backups and disaster recovery purposes.
True or False: Backup storage for Azure Cosmos DB is geo-redundant.
- True
- False
Answer: True
Explanation: Both periodic and continuous backup options for Azure Cosmos DB offer geo-redundant backup storage. This means that your backup is stored in more than one geographic location.
Interview Questions
What is the main difference between periodic and continuous backup?
Periodic backup takes snapshots of your data at specific, regular intervals. Continuous backup, also known as real-time backup, on the other hand, saves changes to data almost instantaneously as the changes are made.
What is the advantage of continuous backup in Microsoft Azure Cosmos DB?
Continuous backup mode provides the ability to restore data at any point in time, up to the last few seconds, which can be crucial in a critical data-loss scenario.
What would you use a periodic backup system for in Microsoft Azure Cosmos DB?
The main advantage of periodic backups is that they are less resource-intensive than continuous backups. This makes them a good choice for applications which can tolerate a certain amount of data loss.
When it comes to cost-efficiency, which backup option would you recommend for Microsoft Azure Cosmos DB and why?
This would depend on the specific needs and budget of each project. While continuous backups can add to the cost, they provide a higher level of data protection and are therefore useful for mission-critical applications.
If you were designing a real-time trading application with Microsoft Azure Cosmos DB, would you use continuous backups or periodic backups, and why?
A real-time trading application is highly sensitive to data losses, so it would be preferable to use continuous backups. This allows for minimal to no data loss during a recovery operation.
How might the choice between periodic and continuous backup affect system performance in Microsoft Azure Cosmos DB?
Continuous backups might cause slightly more system overhead than periodic backups due to the ongoing nature of the backup process. However, this performance difference is generally minimized due to the distributed nature of Cosmos DB.
What is the main disadvantage of using periodic backup in Microsoft Azure Cosmos DB?
The primary disadvantage of periodic backups is the potential loss of data that can occur between two backups. If a system failure occurs just before a scheduled backup, the data changes since the last backup could be lost.
In what situations might continuous backup be unnecessary for Microsoft Azure Cosmos DB applications?
For systems with low data change volumes or in scenarios where data is not highly critical or sensitive, a continuous backup system might not be necessary.
How is the backup schedule determined in Microsoft Azure Cosmos DB’s periodic backup mode?
In Azure Cosmos DB, periodic backups are made every 4 hours by default. The frequency of backups cannot be changed.
Can you manually trigger backups in the continuous backup mode in Microsoft Azure Cosmos DB?
No, you cannot manually trigger backups in continuous backup mode in Microsoft Azure Cosmos DB. The backups are automatically performed in real-time.
Which backup type, periodic or continuous, provides the opportunity for point-in-time restore in Microsoft Azure Cosmos DB?
Continuous backup provides the opportunity for point-in-time restore. This feature allows you to restore your data to any given second within the configured retention window.
What is the data retention period in Microsoft Azure Cosmos DB’s continuous backup mode?
The default retention period for continuous backup mode in Azure Cosmos DB is 30 days.
Can you switch from periodic backup to continuous backup in Microsoft Azure Cosmos DB after data is already stored?
Yes, it is possible to switch from periodic to continuous backup, but it requires irreversible database migration and the old backups will not be available after the migration.
In terms of pricing, how does Microsoft Azure Cosmos DB charge for the continuous backup mode?
The cost of continuous backup mode in Azure Cosmos DB is based on the storage used for the backups and the period of retention.
If you were designing a system with non-critical data and low tolerance for system overhead would you use continuous backups or periodic backups, and why?
In this situation, it would be preferable to use periodic backups because they are less resource-intensive and could be a more cost-effective choice for non-critical data.