ATRIUMsearch → argument graph
Article · 2026-08-13 · 3 moments

A Detailed Guide to API Composition Techniques

In this article, we are going to dive deep into the area of the API composition problem and the patterns associated with it. ✦ AI generated

01
Mechanism

In a service-based architecture, a single product screen commonly requires data from several separate services, each storing only its own data, so the caller issues one call per service and merges the responses in the structure the user interface needs — and this merging step, API composition, exists in every system where data is split across more than one service.

Introduces the API composition problem: a product screen needs four separate services (profile, orders, delivery status, recommendations), and the developer must merge their responses — a step that exists wherever data spans multiple services.

transcript

Author (unnamed): In a service-based architecture, a single product screen showing a user profile, that user's five most recent orders, the delivery status of each order, and a short list of recommendations requires data from four separate services. Each service stores only its own data, so none of the four services returns the full set on its own. In other words, the caller issues four separate calls, and merges the resulting four responses in the structure needed for the user interface. This merging step is API composition, and it exists in every system where data is split across more than one service.

02
Context

Latency is only the first tradeoff in choosing where the merge runs: the location also determines behavior when one service is unavailable, how much of the response can be cached, and which team must approve a change before the screen ships.

Frames the merge-location decision as multi-dimensional: beyond speed, it shapes failure handling, caching, and ownership — the broader design space the article will explore.

transcript

Author (unnamed): However, latency is only the first tradeoff. The place where the merge operation runs also determines what happens when one of the four services is unavailable, how much of the response can be cached, and which team has to approve a change before the screen ships.

extends · 2

03
Mechanism

The code that merges responses can run on the client, on a server, at a CDN edge, or inside a service; and while putting a server between the app and the services adds a network hop, it usually reduces total load time because trading four expensive phone-to-server round trips for one expensive trip plus four cheap server-to-server trips is a large net saving.

Explains the latency tradeoff in choosing where merging runs: a server in front of the services seems costly but usually speeds things up, since intra-datacenter calls are orders of magnitude faster than phone-to-server trips.

transcript

Author (unnamed): The code that performs this merging can run in several places. It can run inside the mobile application, on a server in the datacenter, at a CDN edge location, or inside one of the four services. Putting a server between the mobile application and the four services adds a network hop, which sounds like it should cost extra time. However, it usually reduces total load time instead, because a round trip between a phone and a server on a weak mobile connection can take a few hundred milliseconds, while a round trip between two services inside the same datacenter takes a fraction of a millisecond. To put it simply, trading four expensive round trips for one expensive round trip plus four cheap ones is often a large net saving.

explains mechanism · 1

Highlight slides
Related episodes