Using Azure Cosmos DB Integrated Cache for Faster and Cheaper Data Access
    • Dark
      Light
    • PDF

    Using Azure Cosmos DB Integrated Cache for Faster and Cheaper Data Access

    • Dark
      Light
    • PDF

    Article Summary

    #ServerlessTips - Azure Cosmos DB
    Author: Rahul Rai Microsoft MVP

    Azure Cosmos DB is a fully managed NoSQL database service that offers high performance, scalability, and availability. However, as your application grows, you may face challenges such as increased costs and latency due to high request volume.

    To address these challenges, Azure Cosmos DB offers an integrated cache feature that allows you to store frequently accessed data in memory for faster and cheaper access. The integrated cache is built-in into the Azure Cosmos DB dedicated gateway, a front-end compute layer that routes requests to the backend database. You can choose from different dedicated gateway sizes based on your workload needs.

    The integrated cache is easy to set up and manage. You don’t need to write custom code for cache invalidation or manage any backend infrastructure. You can configure the integrated cache using the Azure portal or the Azure CLI. For example, to enable the integrated cache, you can enable the dedicated cache on your Cosmos DB account as follows:

    download 9

    Fig1.Enable Cosmos DB dedicated gateway.

    The clients must use the connection string of the gateway instead of the database to use the integrated cache. The connection string of the gateway can be obtained from the "Keys" option in the "Settings" section, as shown in the screenshot below. No other application code changes are necessary.
    download 10

    Fig2.Connection string of the dedicated gateway

    The integrated cache currently supports SQL API accounts only. For more information on the feature, refer to the Microsoft documentation.

    MicrosoftTeams-image 503


    Was this article helpful?