Hundreds of thousands of developers are building amazing systems with Lightbend technologies, but some specific tools are better for particular use cases. So how choose the right tool for the job? In this podcast with Wade Waldron, Microservices Practice Lead at Lightbend, we discuss why it’s important to consider your use case, your team, and your environment.
Some questions to ask yourself:
Depending on your answers to these questions, you can figure out whether Play Framework, Lagom Framework, or Akka HTTP is the right technology for your use case.
Play Framework is a web development framework that empowers developers to build highly scalable, lightning-fast applications with an ease unparalleled on the JVM. Play is built on top of Akka and Akka HTTP, and based on an MVC programming model that should be familiar to many Java and Scala developers.
Play focuses on enabling developers to build HTML-based user interfaces. It also offers tools to create fully-featured REST APIs as well as plugins to support important features such as authorization, integration with databases, etc.
With the above in mind, we often recommend our clients use Play Framework for the following use cases:
Lagom Framework helps developers build microservices as systems — Reactive systems, to be precise — so that your microservices are elastic and resilient from within. Lagom is built on top of Play Framework and Akka Cluster, with a programming model based on an RPC style to simplify communication between microservices as well as a persistence layer based on the concept of Entities as described by Domain Driven Design.
Lagom is designed to support RPC-style communication between microservices, including Command Query Responsibility Segregation (CQRS) and Event Sourcing (ES). Lagom features integration with Apache Kafka and Apache Cassandra, plus abstractions for Service Location for integrating with DNS, Kubernetes, Zookeeper etc.
We often recommend that our clients adopt Lagom Framework if their use cases are specifically focused on:
Akka HTTP is a Reactive Streams compliant toolkit based on Akka Streams that implements a fully asynchronous and non-blocking server- and client-side HTTP stack. The programming model of Akka HTTP provides both a high level routing DSL, and a low level API. While it uses Akka Actors and the Actor model under the hood, it’s APIs hide this from the end user.
Akka HTTP is a suite of libraries, rather than a framework like Play and Lagom–interaction with a browser is in the scope, but it is not its primary focus. Akka HTTP is geared towards flexibility with integration layers, rather than application cores. It includes built-in support for streaming APIs with Akka Streams and Reactive Streams, with a client-side API providing the same asynchronous, non-blocking and streaming support.
We often recommend our clients work with Akka HTTP for the following use cases:
Akka is an actor-based, message-driven runtime for managing concurrency, elasticity and resilience on the JVM, featuring first-class support for Java and Scala. The programming model behind Akka is based on the Actor model, with Akka Streams based on Reactive Streams to provide a model that is optimized for working with streaming data.
Akka uses the Actor model to simplify concurrency and improve resource usage, providing cluster features including Sharding, Conflict-Free Replicated Data Types (CRDTs), gRPC, routers, and more. It also includes Akka Streams for supporting streaming data with non-blocking back-pressure, and Alpakka to provide Akka Streams endpoints integrating with a variety of external technologies.
Whether you start with Akka, Lagom, or Play you can add these features later as needed. These are only guidelines that have worked for Lightend clients, and other factors may influence the decision.
We hope you enjoyed this interview and article. If you’d like to speak to someone at Lightbend about using these technologies in your enterprise systems, simply contact us!