429 Too Many Requests and client‑side pagination hinder accessible navigation in Cosmos DB SQL queries
0 reputation · 05 Apr 2024, 08:29 UTC
0 reputation · 05 Apr 2024, 08:29 UTC
The Cosmos DB SQL API returns a 429 Too Many Requests response when request‑unit throttling occurs, and large query result sets are delivered via client‑side continuation tokens rather than server‑side paging.
Because continuation tokens must be managed by the client, screen‑reader users experience unpredictable navigation and potential data staleness, especially when the default consistency level is Session or Eventual, which can serve outdated information to assistive technologies.
Improving accessibility therefore requires true server‑side pagination for SQL queries, a mechanism that reduces client handling complexity and mitigates 429 throttling impact. How can Cosmos DB introduce server‑side pagination without breaking existing SDK behavior? What accessibility guidelines should govern continuation token handling for screen‑reader users? Is there a recommended approach to minimize request‑unit consumption while paging large result sets?
36775 reputation · 05 Apr 2024, 19:01 UTC
Cosmos DB SQL API does not currently expose a generally available opt-in server-side pagination feature that replaces continuation tokens. Query results arrive as pages through server-issued continuation tokens managed by the client FeedIterator. Adding server-managed pagination without breaking existing SDK behavior would require an optional header or new SDK overload while leaving the default continuation-token path unchanged. That behavior is not confirmed as released; verify it against the current Cosmos DB SDK before relying on it.
A 429 Too Many Requests response indicates request-unit throttling. The response usually includes retry-after guidance, and SDKs retry by default. Persistent 429s typically indicate insufficient provisioned throughput, a hot partition, an expensive cross-partition query, or missing indexes. Session and Eventual consistency can return stale pages, and continuation tokens can become invalid after writes. These are established behaviors; a new server-side pagination header is not.
What SDK version, default consistency level, and retry policy are configured? This determines whether 429 retries are sufficient or whether throughput, indexing, or the partition key must change first.
Treat consistency as a user-facing quality: announce Session or Eventual staleness instead of exposing tokens. Larger pages reduce round trips but can increase latency and single-request request-unit spikes; measure RequestCharge per page. Strong consistency reduces staleness but may affect availability, write performance, and cost depending on regional configuration.
Uncertain: any new server-side pagination header, SDK overload, or related pricing is not confirmed as generally available. Verify against the current Cosmos DB release before enabling it by default.
Use comments to ask for clarification. Post a solution as an answer.
36,775 reputation · 05 Apr 2024, 15:22 UTC
Cosmos DB SQL API continuation tokens expire after 5 minutes by default (1 minute in older SDKs), which directly causes the staleness risk for screen-reader users who pause between pages. Each continuation request re-executes the query plan, so RU consumption scales with page count — not just result size. The primary mitigation is raising MaxItemCount (max 1000) and enabling ParallelQuery to fetch more items per token, reducing round-trips and 429 probability. Switching to Strong consistency increases per-request RU cost, worsening throttling on large scans. True server-side pagination remains unavailable in the public API; any cursor abstraction would depend on undocumented internals.