0

We have a low-latency use case for Azure CosmosDB (eg. adding extra 100ms will be sensitive to the application).

Are there any implications on write latency when choosing an Azure CosmosDB API --

enter image description here

Core SQL is default, but perhaps there are some additional overhead in query parsing etc. So I'd think Cassandra and MongoDB APIs are tailored more towards low-latency use cases, didn't get into testing this yet. Thanks for any insights

Tagar
  • 13,911
  • 6
  • 95
  • 110
  • 1
    I suggest benchmarking your specific operations, to see how each api performs for you. Also, I wouldn't make assumptions about latency for any of the API's (or that the core API has more overhead) - keep in mind, all of the additional APIs are implementing a specific database protocol, but there's still Cosmos DB at the core. – David Makogon Jul 21 '22 at 01:09
  • FYI you should also look into direct/tcp vs gateway/http connection, when thinking about latency. – David Makogon Jul 21 '22 at 01:13

1 Answers1

3

There can be some latency differences between the different database APIs but it is nowhere near 100ms for the equivalent payload.

As pointed out in the comments, your assumption about the Core API is incorrect. Core API itself underlies all the other API's which sit atop of it.

Core API is the only one that provides an SLA on latency. This is guaranteed to be less than 10ms for in-region reads and writes at P99 when the payload is 1KB or less and using either .NET or Java SDK via Direct TCP mode (the default).

All other database APIs go through a gateway (as does Core API Python and Node.js SDKs). Also queries are executed on the gateway due to the fact they may talk to different partitions. Gateway also creates query plans and otherwise coordinates query execution.

Bottom line, Cosmos DB is fast across all its database APIs. But if you are trying to squeeze out every ms of latency, use Core API and either the Cosmos DB .NET or Java SDK's.

Mark Brown
  • 8,113
  • 2
  • 17
  • 21
  • Can you elaborate on this little bit more, how does the wire protocol fit into this whole picture (isnt it supposed to connect to DB via TCP/IP?) - "All other database APIs go through a gateway" so how is this exactly achieved and where does wire protocol fit into this? – solujic Oct 31 '22 at 14:09
  • All single document CRUD requests for NoSQL (formerly Core SQL API) go through the Cosmos DB front-end gateway with the exception of clients using .NET or Java SDK in Direct TCP mode. All queries go through the gateway. The emulated API's go through their respective front-end gateways. – Mark Brown Oct 31 '22 at 17:32