Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microservice: Service discovery and Service Registry with Akka

I'm going to apply Microservices architecture for my application. The internal communication between microservices will be achieved by using Akka. But I don't know how to make all microservices aware and register each other. I have some options to design Service Registry and Discovery:

1) Use Zookeeper as a centrailized service to hold all metadata of all microservices (nodes) and let them access these metadata to communicate. The metadata of each node contains Akka path (address) information to let the other nodes communicate to.

2) Join all microservices (Akka Nodes) to an Akka Cluster and each node will keep reference of each other to communicate. Akka Cluster supports gossip protocol and it will let all nodes in cluster aware together.

Can anybody give me some advices about this? How to design Service Discovery and Service Registry efficiently on top of Akka? Are there any options for this?

like image 731
Barcelona Avatar asked Feb 27 '17 11:02

Barcelona


Video Answer


1 Answers

I've been building similar distributed applications since a while using the second approach you suggested, in which microservices run in an Akka Cluster, with few predefined seeder nodes. Each microservice identifies itself using Roles, and has a list of roles that it's interested in.

Each node/microservice has an actor listening to Member Events which is responsible for keeping path address' for nodes interested in, and also it acts as a router for inter-node messages.

I'm fine with this approach, it provides scalability in and out easily.

like image 131
Mohammad Qandeel Avatar answered Sep 28 '22 13:09

Mohammad Qandeel