Planning a microservices project

Lightbend Platform tools for development include:

  • The Akka toolkit, which enables you to build highly concurrent, distributed, and resilient message-driven and streaming applications.

  • Play, built on Akka HTTP, which provides a framework for building web applications and web services.

  • Lagom, built on Akka Cluster and Play, which offers a framework for building microservices.

When developing large systems or applications, users of the Lightbend Platform often employ a combination of the tools. When planning how to use them effectively, consider:

  • Project requirements

  • Team skills

  • Preference for guidance vs flexibility

Let’s take a look at how each of these factors might influence whether you start a project with Akka, Lagom, or Play.


This is not meant to be an exhaustive checklist nor a set of rules to apply universally. Rather, it outlines principles that have helped many Lightbend customers begin their Reactive Journey.

Project Requirements

To begin planning, think about the size and scope of your project. Are you architecting a complex system or working on a smaller, relatively independent application? Are you creating something new or updating legacy functionality?

Akka is a complete toolkit, useful for many different types of applications. It provides tremendous flexibility by imposing few design constraints. Play’s support for stateless services and CRUD work well for replacing web components to achieve better performance and scalability. Lagom provides a guided path to create a reactive system of microservices.

Match Lightbend Platform capabilities with your use case:

  • Are you building web services, the underlying business logic, or both?

    Using a familiar model-view-controller architecture, Play framework is well-suited for creating REST APIs and stateless or stateful web services. Play provides interfaces for accessing legacy databases and integrating with CRUD-style applications, using either Java or Scala. It is built using a fully asynchronous model and consumes minimal CPU, memory, and threads—​making for highly scalable applications.

  • Do you need to handle massive amounts of data reliably to obtain real-time analysis?

    Lightbend Pipelines relieve you of the burden of wiring together all of the pieces necessary to handle data in motion.

  • Are you planning to use microservices with event sourcing and CQRS?

    Lagom offers a framework for building distributed, reactive microservices. It incorporates best practices and patterns learned from building microservices with Akka and fits well with domain driven design. Lagom is especially appropriate if you want to take advantage of event sourcing and CQRS for microservices written in Java or Scala. It includes a seamless integration with Kafka, also available in Java or Scala, and a development environment for Java and Scala that includes a service locator and Cassandra.

  • Do you need a tool that offers the building blocks for many different use cases?

    Akka is a complete toolkit, useful for many different types of applications. It provides tremendous flexibility by imposing few design constraints. Akka provides the building blocks to create apps based on asynchronous messaging and streaming. These process data efficiently and reliably, making it easier for you to perform real-time analysis and apply artificial intelligence. Akka is also the foundation for Lagom and Play, allowing you to use Akka features regardless of which tool you start with.

Team skills and preferences

A team can be more productive initially by working with familiar tools. Lightbend Platform tools and frameworks have both Java and Scala APIs and integrate easily with popular build tools and IDEs.

If your team has no experience with Lightbend products, Play provides a good entry point. It offers flexibility for building web interfaces, REST APIs, or an API gateway. For CRUD-style applications, a variety of persistence plug-ins support data store technologies, saving you from dealing with these lower-level concerns. If you are dealing with a monolith, replacing existing web functionality with Play can make a dramatic improvement to performance and scalability.

Perhaps your team wants to use microservices, but are inexperienced with microservice architectures. The Lagom framework simplifies building backend microservices by hiding details that your team would otherwise need to learn and implement. On the other hand, Lagom provides a familiar RPC-style of communication. Microservices interact in a very typesafe way, but the details—whether they are using HTTP, gRPC, or a message broker—are abstracted away so that communication looks very much like a function call. This is very powerful model for fast and efficient communication.

The Lagom persistence layer is based on entities, a concept from domain-driven design, and it supports natural use of CQRS and event sourcing. During development, Lagom provides automatic service discovery, and Cassandra and Kafka instances, which saves you from having to think about, and set up, all of those details.

If your team wants to learn the ins and outs of building a reactive system, Akka is a great place to start because it does not hide what’s going on under the hood. The Akka toolkit uses the actor programming model to simplify concurrency and optimize resources such as threads and CPUs. Akka Alpakka provides endpoints that integrate with many different types of technologies.

In addition to the open source software, Lightbend offers help in the form of consulting and training. Our skilled consultants can help you with proof of concepts, architectural reviews, and help at any phase of your project. Lightbend training provides a range of courses that cover skills that will enable your team from project concept to deployment, architecture to operations.

Preference for guidance vs. flexibility

Do you prefer to handle all of the nitty gritty details or to concentrate on higher level business logic? If the latter, frameworks hide the details of what is going on behind the scenes. Both Play and Lagom abstract away lower level application plumbing, providing a guided way to accomplish your goals.

On the other hand, Akka gives you the opportunity to customize as much as you like, it has a rich set of modules that include Akka HTTP; Akka Cluster and Akka Cluster Sharding; and Akka Streams:

  • Akka HTTP allows you to build REST endpoints. It offers both a high-level routing DSL and a low-level API. If you have an existing app and just want to add an endpoint, Akka HTTP is very lightweight, small and easy to add into an application. You can also build a full-fledged HTTP server when you are looking for flexibility over simplicity. On the other hand, Play provides a framework and a well-defined structure for your projects. It also has built-in features to render views, integrate with relational databases, and has sensible defaults for security configuration. It also includes module support with dependency injection and hot reload in development mode.

  • Akka Cluster and Akka Cluster Sharding relieve you of coding the logic necessary to distribute an application over multiple nodes and track the membership and health of the cluster. Lagom takes advantage of both, hides some of the complexity, gives you high-level APIs to use CQRS and event sourcing, and provides a development environment built on top of what Play offers.

  • Akka Streams provides a Reactive Streams implementation, allowing you to build asynchronous, non-blocking streams with backpressure. Akka Alpakka provides Akka Streams-compatible connectors to integrate with a variety of databases, messaging systems, and other data sources and data stores.

Regardless of which of the Lightbend products you choose to start a project, you will be laying the foundation for a responsive, scalable, reliable system. Use Lightbend Platform to accelerate the development and deployment of your application and take advantage of support, consulting, and Lightbend Academy to jump-start your project and enable your team for success.