Search⌘ K
AI Features

Introduction to the Integrated Cache

Explore how to implement and manage the integrated cache in Cosmos DB using dedicated gateways. Understand connection modes, cache behavior, eviction policies, and best practices to optimize read-heavy applications and improve performance with caching in server-side programming.

Introduction

In Cosmos DB, there are two ways to connect to a container:

  • Through a gateway with HTTP

  • Directly with TCP

The gateway is responsible for routing requests to the correct physical partition, and it’s shared by multiple accounts to save costs. However, by default, .NET clients connect using the direct mode to reduce latency.

Dedicated gateway

It’s possible to deploy a gateway dedicated to us to access additional features, currently, the integrated cache. To provision one, we can go to the dedicated blade in the Azure portal and enable the toggle.

“Dedicated Gateway” blade in the Azure portal
“Dedicated Gateway” blade in the Azure portal

Once enabled, we need to choose the number of instances per region and the node type between:

    ...