nerdexam
Microsoft

DP-420 · Question #6

You have an application named App1 that reads the data in an Azure Cosmos DB for NoSQL account. App1 runs the same read queries every minute. The default consistency level for the account is set to…

The correct answer is C. the connectivity mode of the App1 CosmosClient. The Azure Cosmos DB integrated cache is implemented at the dedicated gateway layer and only works when the SDK client is operating in Gateway mode. If the CosmosClient is configured for Direct mode, requests bypass the gateway entirely and go straight to the backend partition…

Optimize an Azure Cosmos DB solution

Question

You have an application named App1 that reads the data in an Azure Cosmos DB for NoSQL account. App1 runs the same read queries every minute. The default consistency level for the account is set to eventual. You discover that every query consumes request units (RUs) instead of using the cache. You verify the IntegratedCacheiteItemHitRate metric and the IntegratedCacheQueryHitRate metric. Both metrics have values of 0. You verify that the dedicated gateway cluster is provisioned and used in the connection string. You need to ensure that App1 uses the Azure Cosmos DB integrated cache. What should you configure?

Options

  • Athe indexing policy of the Azure Cosmos DB container
  • Bthe consistency level of the requests from App1
  • Cthe connectivity mode of the App1 CosmosClient
  • Dthe default consistency level of the Azure Cosmos DB account

How the community answered

(42 responses)
  • A
    7% (3)
  • B
    17% (7)
  • C
    74% (31)
  • D
    2% (1)

Explanation

The Azure Cosmos DB integrated cache is implemented at the dedicated gateway layer and only works when the SDK client is operating in Gateway mode. If the CosmosClient is configured for Direct mode, requests bypass the gateway entirely and go straight to the backend partition replicas-completely skipping the integrated cache. The fact that cache hit rates are 0 despite the dedicated gateway being provisioned and present in the connection string is a classic symptom of the client using Direct mode. Switching the connectivity mode of the CosmosClient to Gateway mode will route reads through the cache layer and produce cache hits for repeated identical queries.

Topics

#Azure Cosmos DB integrated cache#Connectivity modes#Performance optimization#Request Units

Community Discussion

No community discussion yet for this question.

Full DP-420 Practice