lundi 10 avril 2017

API Gateway pattern implementation for microservices based on Akka cluster

I try create some microservices based on Akka which use CQRS. So my microservice has write (send command to cluster) and read side (read projections from database) with Http endpoints, but this is not the main problem. Because of many microservices, the question arose as to collect complex API for clients. I found unswer: API Gateway pattern. But I have next question: How can I implement it?

  1. I can create separate project, which will implement API Gateway pattern (in simple case it is a reverse proxy). Full stack will be:

    Load balancer     
      -> API Gateway project 
        -> Load balancer 
          -> Microcervice read part
            -> Database 
          -> Microcervice write part
            -> Akka cluster 
    
    

Pros:

API Gateway separate project with own abstractions

Cons:

Two balansers, and not so fast proxy in API Gateway project

  1. API Gateway (auth, etc) implemented in Microservice parts, load balancer will collect endpoints in complex API. Full stack will be:

    Load balanser
      -> Microcervice read part (with public API)
        -> Database 
      -> Microcervice write part (with public API)
        -> Akka cluster 
    
    

Pros:

  1. Direct acces to cluster and databses
  2. Fast response

Cons:

Complex microservices parts, blending layers

What variant is more preferable or is another best?

Aucun commentaire:

Enregistrer un commentaire