Caching
- Improving Performance: API gateways can cache responses from backend services, reducing the latency of subsequent requests for the same data.
- Reducing Load on Backend Services: Cached responses can be served directly from the gateway, reducing the load on backend services and improving overall system performance.
Why do we need API gateway?
An API gateway is a server that acts as an intermediary between clients (such as mobile apps or websites) and backend services (such as databases or other services). It is a key component in microservices architecture, providing a single point of entry for clients to access multiple services.
The API gateway handles all the tasks related to accepting and processing incoming requests, such as routing requests to the appropriate service, performing authentication and authorization, enforcing rate limits, and aggregating responses from multiple services.
Let’s understand why we need an API gateway: