Microservice Architecture in Akka


(Anish) #1

Hi ,
I am new to this forum . I want to create microservice using akka (not using lagom framework) . What is the best way to do ? Should I use just akka http and run this in k8s or do you suggest to use akka cluster having multiple akka actor over there ?
If this is a duplicate topic then sorry and then can you re-direct me to the original one .


(Ivano Pagano) #2

I would say that your question is quite general and it’s hard to give a valuable answer without knowing any detail of what kind of service is the app giving…

First of all, how many micro-services do you plan to deploy, what are the requirement on the architecture (replication, fault-tolerance, load, …), and what kind of interface you plan to use for contacting the services (e.g. rest/json)?

These are but a few of the first things that comes to my mind


(Anish) #3

Thanks for quick response . Requirement is as below

I want my channel layer to consume the API (REST using Json) . And these API will call some legacy system to fetch the data . There can be multiple layer of API like as “Digital experience microservice” will be calling “process microservice” . “Digital experience microservice” will be responsible for providing channel specific data . This process microservice will be able to do some orchestration/choreography for fulling the process by calling “Domain Microservice”. These Domain microservice Should be able to fetch the data from Read/cache DB .
In case of write service this read Db need to be populated by event streaming. So there will be multiple microservice , and they can communicate between themselves (domain service) using json/protobuf -grpc . Definitely it needs to be fault tolerant, As well I want to deploy in kubernetes and will use kubernetes out box support for service discovery & registry,load balancing ,autoscaling features .

Hope I am able to give you some picture . Would appreciate if you can suggest whether AKKA http or AKKA Cluster or AKKA HTTP+Cluster is the better option in the given scenario ?


(Ivano Pagano) #4

I’m not an expert here, but I guess that using the Akka Cluster should work well with the idea of deploying your services on K8s.

Also Akka-Http could be a possible solution for the rest-api, though it’s pretty “down to the barebone” if you try to follow my meaning: if you need to handle advanced but commonly found scenarios (e.g. db-access, CORS, jwt auth, …) you could also look at Playframework which is a rounded-out solution, and more similar to existing frameworks.

Personally I consider akka-http more of a toolbox to build complex streaming-io apps over http.

That said, all of those build on akka as a foundation (the new playframework uses akka-streams under-the-hood, so it’s all the same in the end) which means that clustering should work well.

This is a pretty general answer, but I guess that’s because finding the more appropriate stack will depend on a more detailed analysis over the details of the problem you’re trying to solve.


(Andy Czerwonka) #5

You should probably start with a template from Lightbend Tech Hub, and probably more specifically for your use case start with an Akka HTTP template.