Api Gateway medium
Your backend architecture uses gRPC for its performance and strict typing, but your public API must remain standard REST/JSON for ease of consumption. Where is the 'Transcoding' logic typically placed?
- A Within the API Gateway, using a tool like the Envoy gRPC-JSON transcoder filter.
- B On the client's router to ensure the data is converted before it enters their ISP's network.
- C In a special 'Translator Microservice' that acts as the only database for the entire system.
- D It is not possible to bridge these protocols; you must choose one for the entire stack.
Answer: A. Within the API Gateway, using a tool like the Envoy gRPC-JSON transcoder filter.
Modern API Gateways (like Envoy or Kong) can automatically map HTTP/JSON paths and fields to gRPC service methods and Protobuf messages. This 'Abstractions' layer allows developers to use the best internal protocols (gRPC/Protobuf) while maintaining a developer-friendly REST/JSON interface for the outside world.
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?