πŸ•ΈοΈ API Patterns and Practices: GraphQL
Chapters Examples Bibliography GitHub β†—
Home / Performance & Safety
Part 7 3 chapters

Performance & Safety

Bound what a client can ask for with depth limits, cost analysis, persisted queries and caching.

Chapter 14

Depth limits and query cost analysis

Bounding what a client can ask for: depth, token and alias limits, a list-aware cost model computed by hand and on both stacks, the budget and its boundary, graphql-java's complexity instrumentation against a Strawberry execution extension, the per-field clamp, skipped selections, fragment pricing, batch refusal, and the caps that remain.

17 min readRead β†’
Chapter 15

Persisted queries and APQ

Replacing query text with a SHA-256 hash: Apollo's three-step APQ handshake, hashes that do not match their text, persisted queries over GET and the mutation that must stay off it, trusted documents as an allowlist, and where each stack resolves the document: a Vert.x route in front of SmallRye, a SchemaExtension in Strawberry.

16 min readRead β†’
Chapter 16

Caching

Four places to keep an answer: the client's normalized cache, an HTTP cache that persisted GET URLs make possible, field-level caches under the server's loaders, and the sources. Cache-Control decided per response, an nginx edge that bypasses on Authorization, TTLs, invalidation on registerHandlingEvent, and why the identity of the caller belongs in every key.

16 min readRead β†’
← Previous part Data Fetching at Scale Next part β†’ Security

API Patterns and Practices: GraphQL

Designing GraphQL APIs well, with runnable examples in Quarkus SmallRye GraphQL and Python Strawberry against one canonical SDL contract.

Site

  • Outline
  • Bibliography

Reference

  • GraphQL β†—
  • GraphQL specification β†—
  • SmallRye GraphQL β†—
  • Strawberry β†—
  • View on GitHub β†—
  • Issues β†—
Open source Β· MIT Last built 2026-10-17