DOP 306: Understanding GraphQL's Role in Modern APIs

Episode 306

Show Notes

#306: In this episode of DevOps Paradox, we delve into the role of GraphQL in modern APIs with guest Sophia Willows from Rye. They discuss the pros and cons of using GraphQL versus REST and gRPC, highlighting the efficiencies and complexities each brings to API development, especially in developer tools. They tackle common misconceptions and usage pitfalls of GraphQL, offering valuable insights into its optimal application. Sophia explains the rationale behind Rye’s choice of GraphQL for public-facing APIs while opting for REST and gRPC for internal microservices, reflecting on the trade-offs between performance and flexibility. The episode also touches on the evolution of API standards and speculations on potential future innovations.

Frequently Asked Questions

When is GraphQL the right choice?

Sophia Willows makes the case on DevOps Paradox episode 306 for APIs shipped to external developers. At the start of such a project you cannot know which access patterns customers will invent, and curating response bodies in advance means guessing. You would have to define a schema and strong typing whatever technology you picked, and “GraphQL comes with all the stuff out of the box” rather than assembled from separate packages.

When should you not use GraphQL?

Sophia Willows says on DevOps Paradox episode 306 that her company deliberately does not use it between internal services, preferring REST and gRPC. Parsing query documents and running a heavy type system buys little when you own both ends and know exactly what each side needs. Avoiding request waterfalls also matters far less between services a millisecond apart than for a caller on the other side of the world.

What is the most common mistake with GraphQL?

Sophia Willows names mirroring your database schema one to one on DevOps Paradox episode 306, which several libraries make trivially easy and which she calls almost always an anti-pattern. Design around use cases instead. Rather than exposing a list of identifiers so consumers can check membership themselves, put a field on the type that answers the question, since consumers only pay for the fields they request.

Why does a specification matter more than flexibility?

Sophia Willows argues on DevOps Paradox episode 306 that every REST API ends up a snowflake. People differ on status codes, on verbs, on whether the design is resource-oriented, and on what an error object contains. GraphQL removes whole categories of that argument: HTTP verbs do not exist in it, so nobody debates whether an operation should be a PUT or a POST, and errors are described by the specification.

How do GraphQL, REST and gRPC compare?

Darin Pope proposes a spectrum on DevOps Paradox episode 306 and Sophia Willows agrees with it: gRPC at one end optimising for performance, plain HTTP in the middle, and GraphQL at the other end optimising for consumer flexibility. The trade-off is that both ends carry real complexity, so the middle keeps working in either direction at the cost of being a compromise.

Is gRPC overused?

Sophia Willows suggests so on DevOps Paradox episode 306, while noting gRPC has far fewer traps than GraphQL. It is more complicated than making HTTP requests between services and harder to debug, since a binary protocol does not appear as legibly in traces. Most systems reaching for it are not operating at a scale where they need that performance and would be fine with HTTP.

What is the DevOps Paradox podcast?

DevOps Paradox is a weekly podcast co-hosted by Darin Pope and Viktor Farcic, covering DevOps, platform engineering, and modern software delivery. Episode 306 brings in Sophia Willows of Rye to defend GraphQL against two sceptical hosts, marking out where it belongs, where it does not, and what people get wrong when adopting it. Every episode page carries the audio, the video, and a full transcript.

Topics

Share and Download

Guests

Hosts

Viktor Farcic

Viktor Farcic

Viktor Farcic is a member of the Google Developer Experts and Docker Captains groups, and published author.

His big passions are DevOps, Containers, Kubernetes, Microservices, Continuous Integration, Delivery and Deployment (CI/CD) and Test-Driven Development (TDD).

He often speaks at community gatherings and conferences.

He has published DevOps Paradox and Test-Driven Java Development.

His random thoughts and tutorials can be found in his blog The DevOps Toolkit.