Api Gateway easy
A mobile application dashboard requires data from 'User Profile', 'Recent Orders', and 'Product Reviews'. How can an API Gateway optimize this interaction?
- A By caching all orders for every user in the mobile device's local memory.
- B By automatically merging the three microservices into a single monolithic codebase.
- C By increasing the timeout of the mobile application's network requests.
- D Through Request Aggregation: The phone sends one request to the Gateway, which calls the three separate services and returns a single combined response.
Answer: D. Through Request Aggregation: The phone sends one request to the Gateway, which calls the three separate services and returns a single combined response.
This pattern reduces 'Chattiness'. Making three separate round-trips over a slow mobile network (LTE/5G) consumes significant battery life and increases the perceived latency for the user. One request to the Gateway, followed by three high-speed internal requests, is much more efficient.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- Your Gateway communicates with backends via HTTP/1.1 connections. A slow backend service causes 'Head-of-Line Blocking'. How does switching to HTTP/2 as the Gateway-to-Backend transport mitigate this?
- What is the primary architectural role of an API Gateway in a microservices environment?
- Why is 'Stateless Token Validation' (e.g., using JWTs) significantly more scalable at the Gateway level than 'Stateful Validation' (e.g., using Opaque/Reference Tokens)?
- Your Gateway is configured to cache any URL ending in `.css` or `.jpg`. An attacker tricks a victim into visiting `https://api.com/v1/profile/info/style.css`. How can this lead to an 'Account Takeover'?
- An API is receiving a sudden surge of 10,000 requests per second from a single IP address. How does an API Gateway preserve the stability of the backend services?
- How can an API Gateway help prevent 'Double Charging' in a payment system when a mobile client retries a failed request due to a poor connection?