wtf( )unctionsystem design, drawn
← all problemsAPI DesignMedium

Twelve round trips to draw one screen

The mobile home screen needs a profile, a cart count, three recommendations and an order summary. The app fetches each one separately — twelve requests, each with its own TLS handshake and latency, over a phone connection where every round trip costs real time.

The services are fine. The API surface is what's wrong: it was designed for the database's shape, not for the screen's.

Insert the layer that turns one client request into one response.
Components — tap one, then tap a slot on the diagram
!The home screen takes eleven seconds to draw on a phone.

Boundaries, outermost first: Services: Cart, Recommendations, Profile Outside every boundary: Mobile app (one screen; FAILED: 11s), an empty slot for the one call in, one out Connections: Mobile app calls one call in, one out — 1 request (step 1) one call in, one out calls Profile — fan out in-datacentre (step 2) one call in, one out calls Cart one call in, one out calls Recommendations

Cart
Mobile appone screen11s
Recommendations
Profile