Rinu Goldgin Dhanaraj

Software Consultant

API Design Approach

API Management Strategy: As a Solution

Key Idea: Touse a lightweight message gateway as the main entry point for all the clients/consumers and implement the common non-functional requirements at the Gateway level

API-GW style gives you the following advantages.

  • Ability to provide the required abstractions at the gateway level for the existing microservices. For example, rather than provide a one-size-fits-all style API, the API gateway can expose a different API for each client.
  • Lightweight message routing/transformations at gateway level.
  • Central place to apply non-functional capabilities such as security, monitoring and throttling.
  • With the use of API-GW pattern, the microservice becomes even more lightweight as all the non-functional requirements are implemented at the Gateway level.

The API-GW style could well be the most widely used pattern in most microservice implementations. In fact, this is a combination of microservices architecture and API-Management which give you the best of both worlds.

Design Approach – Stand Alone API Gateways

Advantages

  • Insulates the clients from how the application is partitioned into microservices
  • Insulates the clients from the problem of determining the locations of service instances.
  • Provides the optimal API for each client.
  • Reduces the number of requests/roundtrips. For example, the API gateway enables clients to retrieve data from multiple services with a single round-trip. Fewer requests also means less overhead and improves the user experience. An API gateway is essential for mobile applications.
  • Simplifies the client by moving logic for calling multiple services from the client to API gateway.
  • Single point failure handling scenarios.

Disadvantages 

  • Increased complexity – the API gateway is yet another moving part that must be developed, deployed and managed
  • Increased response time due to the additional network hop through the API gateway – however, for most applications the cost of an extra roundtrip is insignificant.
  • Addition of a failure point, if API gateway crashes
Architecture Model
 
 

Design Approach –  API Gateways + Microservices

Advantages

  • Insulates the clients & API Gateway from how the application is partitioned into microservices
  • Insulates the clients & API Gateway from the problem of determining the locations of service instances.
  • Provides the optimal control over the microservices.
  • Reduces the number of requests/roundtrips. 
  • Simplifies the client by moving logic for calling multiple services from the API gateway to entry point microservice.
  • Easily scalable

Disadvantages 

  • Distributed failure scenarios.
  • Need of reactive solution/ approach for the API lifecycle includes decision of configuration, deployment, testing, etc.
Architecture Model
Next Article