API Gateway

When creating an application based on microservices, there are several issues one might come across:
  • Different clients (WEB vs mobile) might require different data
  •  The granularity of the data API returns might differ to what a specific client needs
  • In order to get all the data, the client might need to send requests to several microservices
  • Number of instances of microservices and their locations might change
  • In the course of application lifetime, some microservices could be spilled or combined
  • Some microservices might use special protocols that are not web-friendly
So the main problem is how the clients of a microservice application know which microservice should be targeted? The solution is the API Gateway pattern. It is a separate microservice that acts as a single entry point for all clients. It will receive a request from the client, and then according to its ruleset, forward request to appropriate microservices: Depending on the architecture, sometimes is beneficial to create several gateways for different types of clients: Pros:
  • Clients don't need to know how the microservices are partitioned, nor their location
  • Client simplification, since the logic of tarteting, is moved to the gateway
  • Client isolation, each client has access to a subset of microservices it needs
  • Universal gateway, or bespoke API for each client
  • Hides the underlying communication protocols between API gateway and microservices, while providing "standard" friendly API to the public
Cons:
  • Increased complexity, since it is another service that needs to be built and maintained
  • Increased response time, but mostly negligible

You may also like

June 10, 2024

Staying Motivated in the IT: Student's Guide

Securing a job in the IT field can feel like trying to crack the toughest code, especially without prior experience. That’s where internships and practical experience come into play, acting as the perfect stepping stones for your career path.  At Lilly021, we’ve noticed some young tech enthusiasts feeling a bit blue, likely due to market […]

June 20, 2024

Mastering Client-Oriented Roles: Expert Advice for Junior Developers

Ever wondered what makes the magic happen behind the scenes in global software companies? Spoiler alert: it’s the client-oriented roles! These are the glue that keeps everything together, ensuring clients’ needs are met and expectations exceeded.  This blog post will share concrete, experience-based insights to help new employees thrive in these crucial positions. Whether you […]

June 13, 2024

Bugs and Scalpel Slips: Why Software Development Demands Surgical Precision

A surgeon and a programmer walk into a bar. But it’s not the start of a joke—it’s a scenario highlighting both professions’ weighty responsibilities. Surgeons, with their scalpels, work with life and death hanging in the balance. Armed with code, programmers might not hold lives in their hands, but their mistakes can still wreak havoc […]