Play 2 microservice architecture best practises

328 views
Skip to first unread message

innfa...@gmail.com

unread,
May 2, 2017, 12:36:27 PM5/2/17
to Play Framework
Hey,

right now i am building a play 2 application.
I found this activator template https://github.com/knoldus/playing-microservices for a play 2 microservice architecture and i would like to adapt it for my needs and deploy it to AWS.
I want to use most of the AWS Infrastructure like ec2/ecs/cloudWatch/s3/rds/dynamoDB..., so i didn't build the application with lagom. 

Are there any best practises how to build and deploy play 2 microservices directly to aws? And what is the best way to transfer data from one server to another? Should i talk to the Endpoints of the Load Balancers or is there a better way e.g. with consul and akka remote? I saw lagom does the service communication with akka and comes with a service locator when you use conductr. is it possible to do something like this in play 2 too? 

Greetings 
Tobias

Igmar Palsenberg

unread,
May 2, 2017, 5:33:19 PM5/2/17
to Play Framework
 
right now i am building a play 2 application.
I found this activator template https://github.com/knoldus/playing-microservices for a play 2 microservice architecture and i would like to adapt it for my needs and deploy it to AWS.
I want to use most of the AWS Infrastructure like ec2/ecs/cloudWatch/s3/rds/dynamoDB..., so i didn't build the application with lagom. 

Are there any best practises how to build and deploy play 2 microservices directly to aws?

I usually recommend sticking to plain ELB and autoscaling groups. Yes, AWS has container services these days, but IMHO, it adds up to the complexity.

And what is the best way to transfer data from one server to another? Should i talk to the Endpoints of the Load Balancers or is there a better way e.g. with consul and akka remote?

We use a JMS broker. The biggest issue with AWS is that broadcast / multicast is disabled, so service location is a problem. If you expand over multiple regions, that problem is even worse. We're looking at using a VPC with public IPv6 enabled, to get around all kinds of nasty AWS limitations (All is NAT'ted being one of them).
 
I saw lagom does the service communication with akka and comes with a service locator when you use conductr. is it possible to do something like this in play 2 too? 

Sure. It usually however needs a "master" or seed node, which makes it harder to work with. You can also do funky stuff with security groups, but that requires doing AWS API calls. It all depends on how complex you want it, and what your application looks like.


Igmar

Will Sargent

unread,
May 2, 2017, 7:46:46 PM5/2/17
to play-fr...@googlegroups.com
I would look into Lagom if you are using microservices.  


--
Will Sargent
Engineer, Lightbend, Inc.


--
You received this message because you are subscribed to the Google Groups "Play Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framework+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/d0e0d34a-03d6-4229-8174-feb718a2a496%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Thibault Meyer

unread,
May 3, 2017, 2:20:27 AM5/3/17
to Play Framework
Lagom is a very good framework, but It force usage of CQRS architecture who is not suitable for all projects.


@Tobias: in our company, we are using Play 2.5 with some service directly callable from a http api (retrofit or WSClient directly) and we are using a RabbitMQ to broadcast some event like (User created, user update, account credit, account debit, ...) to update other services (eg: statistics, notification, ...)



Le mercredi 3 mai 2017 01:46:46 UTC+2, Will Sargent a écrit :
I would look into Lagom if you are using microservices.  


--
Will Sargent
Engineer, Lightbend, Inc.


On Tue, May 2, 2017 at 2:33 PM, Igmar Palsenberg <ig...@palsenberg.com> wrote:
 
right now i am building a play 2 application.
I found this activator template https://github.com/knoldus/playing-microservices for a play 2 microservice architecture and i would like to adapt it for my needs and deploy it to AWS.
I want to use most of the AWS Infrastructure like ec2/ecs/cloudWatch/s3/rds/dynamoDB..., so i didn't build the application with lagom. 

Are there any best practises how to build and deploy play 2 microservices directly to aws?

I usually recommend sticking to plain ELB and autoscaling groups. Yes, AWS has container services these days, but IMHO, it adds up to the complexity.

And what is the best way to transfer data from one server to another? Should i talk to the Endpoints of the Load Balancers or is there a better way e.g. with consul and akka remote?

We use a JMS broker. The biggest issue with AWS is that broadcast / multicast is disabled, so service location is a problem. If you expand over multiple regions, that problem is even worse. We're looking at using a VPC with public IPv6 enabled, to get around all kinds of nasty AWS limitations (All is NAT'ted being one of them).
 
I saw lagom does the service communication with akka and comes with a service locator when you use conductr. is it possible to do something like this in play 2 too? 

Sure. It usually however needs a "master" or seed node, which makes it harder to work with. You can also do funky stuff with security groups, but that requires doing AWS API calls. It all depends on how complex you want it, and what your application looks like.


Igmar

--
You received this message because you are subscribed to the Google Groups "Play Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.

Will Sargent

unread,
May 3, 2017, 1:58:02 PM5/3/17
to play-fr...@googlegroups.com
Lagom does not force use of CQRS.  It is optional.

> If you do not want to use event sourcing and CQRS, you should probably use something other than the Persistence module in Lagom. (However, we suggest that you read Advantages of Event Sourcing first.) If you opt not to use Lagom’s persistence module, the CassandraSession in the Lagom Persistence module provides an asynchronous API for storing data in Cassandra. But, you can implement your Lagom services with any data storage solution.

> Should you choose to use something other than Lagom’s persistence module, remember to use asynchronous APIs to achieve best scalability. If you are using blocking APIs, such JDBC or JPA, you should carefully manage the blocking by using dedicated thread pools of fixed/limited size for the components that are calling those blocking APIs. Never cascade the blocking through several asynchronous calls, such as Service API calls.


--
Will Sargent
Engineer, Lightbend, Inc.


To unsubscribe from this group and stop receiving emails from it, send an email to play-framework+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/7626519b-c697-4bcf-9305-431c35de2289%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages