Which of the following best describes the primary role of an API Gateway in a microservices architecture?
Think about what component manages client requests and common tasks like security in microservices.
An API Gateway serves as a single entry point for clients. It routes requests to the correct microservice and handles tasks like authentication, logging, and rate limiting, which are common across services.
In a system using an API Gateway, what is the correct sequence of steps when a client makes a request?
Consider the logical order of authentication before routing and response flow.
The client first sends a request to the API Gateway. The gateway authenticates the request, then routes it to the correct microservice. The microservice processes it and returns the response to the gateway, which then sends it back to the client.
Your system uses an API Gateway that is becoming a bottleneck under high traffic. Which approach best improves scalability while maintaining reliability?
Think about horizontal scaling and fault tolerance.
Deploying multiple API Gateway instances behind a load balancer allows the system to handle more requests by distributing load and provides fault tolerance if one instance fails.
What is a common tradeoff when introducing an API Gateway in front of microservices?
Consider the impact on request time and system management.
Using an API Gateway adds an extra step in the request path, which can increase latency slightly. However, it centralizes tasks like authentication and logging, simplifying microservices.
Your API Gateway must handle 10,000 requests per second at peak. Each request takes 5 milliseconds of processing time on the gateway. How many API Gateway instances are needed to handle the load without queuing?
Calculate how many requests one instance can handle per second, then divide total requests by that number.
One instance can handle 1000 ms / 5 ms = 200 requests per second. To handle 10,000 requests per second, 10,000 / 200 = 50 instances are needed.