Questions about how Cosmos DB Consistency Levels would behave in suboptimal conditions

I have questions about how Consistency Levels would behave in suboptimal conditions, like a catastrophic failover or replications falling behind.

I have tried testing some of the below scenarios but have not been very successful because replications happen very quickly.

I even trying to do manual failovers appears to do a more of a graceful failover vs catastrophic failover. I do wish Microsoft gave you the ability to do more of a catastrophic failover.

Anyway, here are my questions.

  1. If you’re using Strong CL with single write region in East US and 2 read regions in East US and West US, would Cosmos Db stop taking writes if East US went offline since it can’t replicate the data?
  2. If you’re using Bounded Staleness CL with single write region in East US and 2 read regions in East US and West US, would Cosmos Db stop taking writes if East US staleness threshold has been exceeded?
  3. If you’re using Strong CL with single write region in East US and 3 read regions in East US, Central US, and West US, would Cosmos Db stop taking writes if East US went offline since it can’t replicate the data?
  4. If you’re using Bounded Staleness CL with single write region in East US and 3 read regions in East US, Central US, and West US, would Cosmos Db stop taking writes if East US staleness threshold has been exceeded?
  5. For Consistent prefix CL, let’s assume you have multiple write regions, with East US as priority 1 and West US as priority 2. When writing to the same partition key in different regions, will you get incorrect results if replication is lagging? Let’s assume this scenario:
Write To East US @ 2:10 PM UTC: partitionNumber: 1, id: 1, firstName: John
Write To West US @ 2:11 PM UTC: partitionNumber: 1, id: 2, firstName: Bob

If you run statement:

SELECT * FROM c WHERE c.partitionNumber= '1'
  • I assume East US would give you id 1 with firstName John, if replication has not happened?
  • I assume West US would give you id 2 with firstName Bob, if replication has not happened?
  • What result would the Cosmos portal give you?
  1. If you have multiple write regions, does all CL become Eventual? Let’s assume this complex scenario that would happen with any CL (Except Strong) in a multi-region writes.

This is just an example and not necessarily how it should be designed.

Let’s assume you have a UI where you give commands to servers. A Cosmos container has a partition key of serverName. The server calls an API in a 1-minute interval. You only want to send the command once, so you have a flag that states if it was sent.

Let’s say these events occur:


UI does an insert in East US @ 2:10:10 PM UTC: id: 1, serverName: 'MyServer, command: 'apt update', commandSent: false

UI does an insert in West US @ 2:10:12 PM UTC: id: 1, serverName: 'MyServer, command: 'apt upgrade', commandSent: false

UI does an insert in East US @ 2:10:22 PM UTC: id: 1, serverName: 'MyServer, command: 'apt install nginx', commandSent: false

UI does an insert in West US @ 2:10:30 PM UTC: id: 1, serverName: 'MyServer, command: 'run antivirus program', commandSent: false

UI writes command to East US @ 2:10:55 PM UTC: id: 1, serverName: 'MyServer, command: 'shutoff', commandSent: false

Now the server calls an API that gets the commands to run, the API set ApplicationRegion to West US. At the time the server called the API, East US hasn’t replicated with West US

So West US runs SQL Statement

SELECT * FROM c WHERE c.serverName = 'MyServer AND c.commandSent = false'

My assumption is this query would return

apt upgrade
run antivirus program

Now the API sets commandSent to true for all the commands that were sent.

Before the next server calls the API a second time, a replication happens.

Now when the server calls the API server on West US and runs query:

SELECT * FROM c WHERE c.serverName = 'MyServer AND c.commandSent = false'

My assumption is this query would return

apt update
run antivirus program
apt install nginx
shutoff

So, instead of the commands getting the run command in the correct order of:

apt update
apt upgrade
apt install nginx
run antivirus program
shutoff

It would be run in this order:

apt upgrade
run antivirus program
apt update
run antivirus program
apt install nginx
shutoff

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật