Every round trip over a mobile network is expensive and every hop inside the data centre is cheap, so a gateway that checks requests once at the door and fans out inside saves the phone the most time.
Learn the idea first
The home screen of a shopping app shows your profile, your recent orders and today's offers. Each lives in its own service behind one API gateway. The phone is on a mobile network (the slider sets its round trip); a hop inside the data centre takes about 1 ms. In this model, like many apps, the phone waits for each answer before sending its next request. Timings are an illustrative model.
Phone app
home screen
API gateway
api.shop.example
User service
profiles
Order service
order history
Offers service
today's deals
Swipe the diagram sideways to see every column →
Where the time goes
547 ms total
The home screen of a shopping app shows your profile, your recent orders and today's offers. Each lives in its own service behind one API gateway. The phone is on a mobile network (the slider sets its round trip); a hop inside the data centre takes about 1 ms. In this model, like many apps, the phone waits for each answer before sending its next request. Timings are an illustrative model.
Illustrative timings. Real numbers vary with distance, network quality and server load.