DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
View Events Video Library
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

UK-US Data Bridge: Join TechnologyAdvice and OneTrust as they discuss the UK extension to the EU-US Data Privacy Framework (DPF).

Migrate, Modernize and Build Java Web Apps on Azure: This live workshop will cover methods to enhance Java application development workflow.

Kubernetes in the Enterprise: The latest expert insights on scaling, serverless, Kubernetes-powered AI, cluster security, FinOps, and more.

A Guide to Continuous Integration and Deployment: Learn the fundamentals and understand the use of CI/CD in your apps.

Related

  • Ensuring API Resilience in Spring Microservices Using Retry and Fallback Mechanisms
  • Harness the Power of Quarkus and HarperDB for Efficient Data Management
  • Kafka Event Streaming AI and Automation
  • Building a Microservices API Gateway With YARP in ASP.NET Core Web API

Trending

  • Unlocking the Power of Streaming: Effortlessly Upload Gigabytes to AWS S3 With Node.js
  • Comparative Analysis of Open Source Cluster Management Systems: Kubernetes vs. Apache Mesos
  • Exploring the OpenTelemetry Collector
  • Querydsl vs. JPA Criteria, Part 5: Maven Integration
  1. DZone
  2. Data Engineering
  3. Databases
  4. Why Do Microservices Need an API Gateway?

Why Do Microservices Need an API Gateway?

With the growth of API-centric IT initiatives, API gateways and management layers are common place. Should we consider an API gateway for microservices?

James Higginbotham user avatar by
James Higginbotham
·
Nov. 20, 16 · Opinion
Like (16)
Save
Tweet
Share
27.5K Views

Join the DZone community and get the full member experience.

Join For Free

With the growth of API as a product, as well as API-centric IT initiatives, API gateways and management layers are becoming more common place. However, should we consider an API gateway for our microservices, as well? If so, what kind of benefits do they offer?

What Is an API Gateway?

An API gateway provides a single, unified API entry point across one or more internal APIs. They typically layer rate limiting and security, as well. An API management layer such as Tyk.io adds additional capabilities such as analytics, monetization, and lifecycle management.

A microservice-based architecture may have from 10 to 100 or more services. An API gateway can help provide a unified entry point for external consumers, independent of the number and composition of internal microservices.

The Benefits of an API Gateway For Microservices

Prevents Exposing Internal Concerns to External Clients

An API gateway separates external public APIs from internal microservice APIs, allowing for microservices to be added and boundaries changed. The result is the ability to refactor and right-size microservices over time without negatively impacting externally-bound clients. It also hides service discovery and versioning details from the client by providing a single point of entry for all of your microservices.

Adds an Additional Layer of Security to Your Microservices

API gateways help to prevent malicious attacks by providing an additional layer of protection from attack vectors such as SQL Injection, XML Parser exploits, and denial-of-service (DoS) attacks.

Enables Support for Mixing Communication Protocols

While external-facing APIs commonly offer an HTTP or REST-based API, internal microservices may benefit from using different communication protocols. Protocols may include ProtoBuf or AMQP, or perhaps system integration with SOAP, JSON-RPC, or XML-RPC. An API gateway can provide an external, unified REST-based API across these various protocols, allowing teams to choose what best fits the internal architecture.

Decreased Microservice Complexity

Microservices have common concerns, such as authorization using API tokens, access control enforcement, and rate limiting. Each of these concerns can add more time to the development of microservices by requiring that each service implements them. An API gateway will remove these concerns from your code, allowing your microservices to focus on the task at hand.

Microservice Mocking and Virtualization

By separating microservice APIs from the external API, you can mock or virtualize your services to validate design requirements or assist in integration testing.

The Drawbacks of an Microservice API Gateway

While there are many benefits to using an API microservice gateway, there are some downsides:

  • Your deployment architecture will require more orchestration and management with the addition of an API gateway.
  • Configuration of the routing logic must be managed during deployment, to ensure proper routing from the external API to the proper microservice.
  • Unless properly architected for high availability and scale, an API gateway can become a limiting factor and even a single point of failure.
API microservice

Published at DZone with permission of James Higginbotham, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Ensuring API Resilience in Spring Microservices Using Retry and Fallback Mechanisms
  • Harness the Power of Quarkus and HarperDB for Efficient Data Management
  • Kafka Event Streaming AI and Automation
  • Building a Microservices API Gateway With YARP in ASP.NET Core Web API

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: