maxvasil
maxvasil

Reputation: 169

Running DocumentClient and CosmosClient side by side

In our production service, I’m planning the upgrade of Cosmos DB SDK from v2 (Microsoft.Azure.DocumentDB) to the latest v3 (Microsoft.Azure.Cosmos).

Is it safe to run both DocumentClient (v2) and CosmosClient (v3) instances side-by-side within the same process? Are there any caveats or performance implications?

Running both clients simultaneously would bring us the following benefits:

Currently, our DocumentClient is setup to work in Direct mode (TCP protocol) and we'd like to use CosmosClient in the same mode.

Upvotes: 0

Views: 599

Answers (1)

Matias Quaranta
Matias Quaranta

Reputation: 15603

Short answer: Yes, it would be safe. As long as you maintain the same approach of having a Singleton instance of both clients, you shouldn't experience any issue. They both use the same serialization engine (Newtonsoft.Json).

V3 SDK has Direct/TCP mode as the default (V2 SDK has Gateway as default), so you don't need any special setting or configuration for V3 to achieve the same mode.

Upvotes: 1

Related Questions