Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Looking for API Gateway Technology that call multiple microservices [closed]

In my company, we plan to migrate our back-end solution, which is a huge monolith, to a sexier microservices architecture.

So far, we have benchmarked many technologies, and we will probably use the AWS infrastructure with AWS EC2 Container Services (ECS). Our microservices will be wrapped in Docker containers.

We have already deployed containers and configured the auto-scaling and the load balancing. Everything works great.

However, we are looking for an API Gateway technology that could allow us to call multiple microservices with only one request for the client.

The idea is to develop an architecture that looks like Netflix one: http://techblog.netflix.com/2013/01/optimizing-netflix-api.html

For example:

If the client (a web site) wants to fetch the cart of a client. It will send a Get request to the API.

First, I would like that our gateway call the "user" microservice that will return the user's information and the list of the id product that his cart contains:

{
    "name": "john",
    ....,
    "cart": [1,2,3]
}

Then, without directly responding to the client, the gateway will call the "product" microservice to hydrate the Json with the information about each product.

{
    "name": "john",
    ....,
    "cart": [
         {"id": 1, "name": "Iphone", ...},
         {"id": 2, "name": "Ipad", ...},
         {"id": 3, "name": "Ipod", ...}
    ]
}

So, my question is do you know a nice technology that could do the job ?

like image 240
Jeremy Maignan Avatar asked Dec 28 '16 09:12

Jeremy Maignan


People also ask

Can an API have multiple microservices?

It's important to note that no two microservices are alike, and all utilize APIs differently. Some might assign multiple APIs to one service, or use a single API for accessing multiple services.

What is the difference between API gateway and microservices?

API gateway is a central component of the architecture, while service mesh divides the application's functionality into microservices further handled by the infrastructure layer. The API gateway and service mesh functionality include handling request routing, rate limiting, monitoring, authentication, etc.

How multiple microservices communicate with each other?

Because microservices are distributed and microservices communicate with each other by inter-service communication on network level. Each microservice has its own instance and process. Therefore, services must interact using an inter-service communication protocols like HTTP, gRPC or message brokers AMQP protocol.


1 Answers

You would use AWS Lambda for this. Have API Gateway call a Lambda function. Have the Lambda function perform the actions you have described, calling your ECS services, and then return the final result.

like image 143
Mark B Avatar answered Nov 05 '22 13:11

Mark B