GraphQL Print

  • 0

An alternative query approach.

WHAT IT IS

A single endpoint where the caller specifies exactly what they want.

WHAT IT PROVIDES

Fetching several related things in one request No over-fetching of unused fields A strongly typed schema

WHAT PROBLEM IT ADDRESSES

Interfaces requiring many round trips, or returning far more than needed.

WHAT IT COSTS

Caching is harder, since every query differs Rate limiting by request count is meaningless A caller can construct a very expensive query Errors are returned with a success status

WHY THAT LAST POINT MATTERS

Monitoring based on status codes sees nothing wrong.

WHAT TO IMPLEMENT ON THE SERVER

Query depth limits Complexity scoring, with a budget Timeouts

WHY COMPLEXITY SCORING SPECIFICALLY

It is the only meaningful way to limit cost.

WHAT THE REPEATED QUERY PROBLEM IS

Resolving a list then querying once per item.

WHAT SOLVES IT

Batching loaders.

WHY THAT MATTERS

Without them, one request becomes hundreds of database queries.

WHEN GRAPHQL SUITS

Many clients with differing needs Deeply related data Mobile clients where round trips are expensive

WHEN IT DOES NOT

Simple interfaces Public interfaces where you cannot trust callers


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot