Add integrated cache best practice rule - #242
Conversation
There was a problem hiding this comment.
Pull request overview
This PR expands the cosmosdb-best-practices skill by adding a new Throughput & Scaling rule that recommends Azure Cosmos DB Integrated Cache (via dedicated gateway) for read-heavy workloads, and it wires the new rule into the skill index.
Changes:
- Added a new rule file
throughput-integrated-cache.mddescribing when/how to use Integrated Cache, includingMaxIntegratedCacheStalenessguidance and consistency constraints. - Updated
SKILL.mdto include the new rule in the Throughput & Scaling section.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| skills/cosmosdb-best-practices/SKILL.md | Adds the new throughput rule to the skill’s indexed rule list. |
| skills/cosmosdb-best-practices/rules/throughput-integrated-cache.md | Introduces a new best-practice rule for using Integrated Cache with dedicated gateway, including Incorrect/Correct examples and reference link. |
Comments suppressed due to low confidence (1)
skills/cosmosdb-best-practices/rules/throughput-integrated-cache.md:33
- The “Correct” snippet also references
containerwithout defining it, so it won’t compile. Define the container from the client before using it.
var client = new CosmosClient(dedicatedGatewayConnectionString);
var options = new ItemRequestOptions
4254cf7 to
6d0a394
Compare
6d0a394 to
b4e0635
Compare
|
hi Sajeetharan (@sajeetharan) Jay Gordon (@jaydestro) Theo van Kraay (@TheovanKraay), just checking regarding this PR, any updates ? |
|
Please also update the existing sdk-connection-mode.md rule. It currently says Gateway mode is only needed for firewall-restricted environments, but integrated cache is another valid production use case requiring Gateway mode. Without that update, the compiled guidance will conflict. Please also bump the package version using npm run version . |
b4e0635 to
d2d8e9b
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Suppressed comments (1)
skills/cosmosdb-best-practices/rules/throughput-integrated-cache.md:27
- This sentence references "repeated" requests, but after updating the example label to a single point read, the wording becomes inconsistent. Reword to avoid implying the snippet demonstrates repetition.
Every repeated request is sent to the backend, consuming RUs even when the data has not changed.
d2d8e9b to
c6b29b4
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
skills/cosmosdb-best-practices/rules/sdk-connection-mode.md:61
- The Gateway-mode exception list mentions Integrated Cache, but this comment doesn’t make it explicit that Integrated Cache requires using the dedicated gateway endpoint/connection string (not just setting
ConnectionMode = Gateway). Making that explicit here will prevent readers from assuming Gateway mode alone enables the feature.
// 4. Using Azure Cosmos DB Integrated Cache, which requires the dedicated gateway
fa0a0c2 to
b3cd642
Compare
Description
Adds a new best practice rule recommending the use of Azure Cosmos DB Integrated Cache for read-heavy workloads. The rule explains when Integrated Cache should be used, highlights the dedicated gateway requirement, demonstrates configuring
MaxIntegratedCacheStaleness, and outlines the supported consistency levels. It also adds the new rule to the Cosmos DB Best Practices skill index.Type of Change
Checklist
npm run validateand it passed{prefix}-{description}.mdtitle,impact,tags)For New Rules
Rule file:
skills/cosmosdb-best-practices/rules/throughput-integrated-cache.mdCategory: Throughput & Scaling
Impact level: Medium
Why is this rule important?
Read-heavy workloads often perform repeated point reads or queries for the same data. Azure Cosmos DB Integrated Cache can significantly reduce RU consumption and improve latency by serving cached results through the dedicated gateway. This rule helps developers understand when Integrated Cache is appropriate, how to configure
MaxIntegratedCacheStaleness, and the consistency requirements for using the feature effectively.Agent Testing
Related Issues
Closes #172
Additional Notes
skills/cosmosdb-best-practices/SKILL.mdto include the new rule.npm run buildnpm run validatenpm run validate:manifests