The API Gateway Journey: Part 2 - Why Use an API Gateway?

The API Gateway Journey: Part 2 - Why Use an API Gateway?

As an Architect you need to balance both short term implementation and long term maintainability. There are many cross cutting concerns that you might have , including maintainability, extensibility , security , observability , product lifecycle management and monetization. An API gateway can help with all of these!


Key problems That an API gateway can address

An API gateway can address key problems such as :

  • Reducing coupling by by using an adapter between frontends and backends
  • Simplifying consumption by aggregating backend services
  • Protecting APIs from abuse with threat detection and mitigation
  • Understanding how API are being consumed
  • Managing APIs as products with API lifecycle management
  • Monetizing API by using account management ,billing and pay.

Reducing Coupling

Systems that are designed to exhibit loose coupling and high cohesion will be easier to. understand , maintain and modify.

Information hiding is the principle of segregation of the design decisions in a software system that are most likely to change.

Loose Coupling allows different implementations to be swapped in easley and can be especially useful when testing systems.

High cohesion promotes understandability that is all code in a module or a system supports a central purpose.When a module or component has high cohesion, it means that its elements (like methods, functions, or data) work together to perform a single, well-defined task.

An API gateway acts as a single entry point that decouples clients from backend service by acting as an intermediary, Clintes do not need to know the details of backend services they only interact with the gateway. This reduces direct dependencies between the frontend and backend making it easier to change or replace backend services without impacting clients.


Article content

Simplifying Consumption

It is often the case that the API you want to. expose to the frontend systems is different that the. current interface provided by abcakend service or composition of backend systems. For example you may want to. aggregate the APIs of several backend services that owned by multiple owners into a single consumer facing API in order to simplify the client's interaction,streamline data management or hide backend architecture.

A popular simplified approach implemented in API gateway is orchestrating concurrent backend API calls. This is where the gateway orchestrates and coordinates the concurrent calling of multiple independent backend APIs. Those APIs are independent and non coupled APIs that can be called in parallel rather than sequentially in order to save time when gathering results for consumer.

It is also also a common requirement within an enterprise that protocol translation is requierd. For example you may have several systems that provide only SOAP based APIs but you only want to expose REST APIs to consumers.

An API gateway can provide this aggregation and translation functionality, a client can make one request to the API gateway which then communicates with the necessary backend services and aggregate/translate the response.


Article content

Protecting APIs

The edge of the systems is where your users first interact with your application. It is also often the point where bad actors and hackers first encounter the system.

Majority of enterprise organization will have multiple security focused layers to their edge stack,such as a content delivery network (CDN) and web application firewall (WAF), and dedicated demilitarized zone (DMS), however for smaller organization API gateway may be the first line of defense.

For this reason may API gateways include security focused functionality such as TLS, authentication/authorization , IP whitelisting and API contact validation .


Understanding How API are Being Consumed

Understanding how systems and applications are performing is vitally important for ensuring business goals are being met and that customer requirements are being satisfied.It is increasingly common to measure business objectives via key performance indicators (KPIs), such as customer conversion, revenue per hour, stream starts per second, and more.

API gateway is an ideal location to. capture tp-line ingress metrics, such as the number of errors, throughput, and latency, and it is also a key location for identifying and annotating requests (potentially with application-specific metadata) that flow throughout the system further upstream.

Correlation identifiers are typically injected into a request via the API gateway and then can be propagated by each upstream service. These identifiers can then be used to correlate log entries and request traces across services and systems.

By analyzing API usage data, you might discover that a particular API is being heavily used by a specific region, leading you to optimize that API for users in that area.

See, For Example : Zipkin

Managing APIs

Modern APIs are often designed, built, and run as products that are consumed by both internal systems and third parties, and they must be managed as such.

An API gateway often comes with tools for managing the entire lifecycle of an API, from development and testing to deployment, versioning, and retirement. It allows you to control the availability of different API versions, ensuring clients always use the most up-to-date and secure API versions.


Article content

Monetizing API

The APIs being exposed to customers typically have to be designed as a product and offered via a developer portal that also includes account management and payment options.

API gateway can integrate with billing systems to track API usage, apply pricing models and manage payments. This allows to monetize API by charging clients based on their usage.

Examples include Apigee Edge.


Article content

In Summary

The API gateway simplifies the interaction between clients and backend services, provides security and monitoring, and enables you to manage and monetize APIs effectively.

By acting as a central point of control, it reduces coupling, aggregates/transforms services, and ensures that APIs are consumed in a controlled and efficient manner.


ساره المرسي

مُدرسة لغة عربية في مدرسة أحمد زويل التجربية بالمنصورة

8mo

شكرًا على المشاركة

To view or add a comment, sign in

More articles by Motaz Mohammed Sameh

  • Part 2: Install Istio

    In Part#2 we will set up Istio on our local machine, we will use docker desktop, here we are preparing our environment…

    1 Comment
  • Intro to Service Mesh

    What is Service Mesh? Service Mesh it's a communication layer between a software component in a distributed system, the…

    3 Comments
  • System Migration: A Seamless Approach with Service Layer

    System Migration are often complex, particularly when existing services consumers depends on the old system APIs. A…

    1 Comment
  • Real Time Data Streaming

    In our latest article we explored an optimized approach for [Preloading data using Redis and Kafka Connectors]…

    1 Comment
  • Leveraging Redis for Preloading Data: Replacing ODS with In-Memory Performance

    In our previous article on Change Data Capture (CDC) with Debezium, we demonstrated how to set up CDC using Debezium…

    1 Comment
  • The API Gateway Journey: Part 1 - The Basics

    What Is API Gateway? API gateway is a management tool that sits at the edge of systems between a consumer and. a…

  • Distributed Transaction

    One of the common issues is how to manage the Distributed Transaction across multiple microservices, There is a lot of…

    1 Comment
  • Operational Data Store(ODS)

    Table Of Contents What is Operational Data Store (ODS) Characteristics of an Operational Data Store How do operational…

    3 Comments
  • Change Data Capture With Debezium

    Why Change Data Capture? We have a transaction log at our database systems which have all change events occurred in the…

    1 Comment

Insights from the community

Others also viewed

Explore topics