BT
x Share your thoughts on trends and content!

Lagom, a New Microservices Framework

by Jan Stenberg on Mar 08, 2016 |

Lightbend (recently renamed from Typesafe), the company behind Akka, has released an open source microservices framework, Lagom (Swedish for ‘just enough’), built on their Reactive Platform. In particular the Play Framework and Akka family of products are used, together with ConductR for deployment. By default, Lagom is message-driven and asynchronous, and uses distributed CQRS persistence patterns with event sourcing as the primary implementation.

One reason for the name Lagom is according to Jonas Bonér, CTO of Lightbend and creator of Akka, to remove the emphasis on micro (i.e. size) in microservices, it’s about having right sized services, not just small services.

In a conversation with InfoQ Bonér shared his view on the new framework.

InfoQ: What are the major features of Lagom in your opinion?

Bonér: Features that I think makes Lagom unique compared to other microservices frameworks include:
  • Most microservices frameworks out there focus on making it easy to build individual microservices—which is the easy part. Lagom extends that to systems of microservices, large systems—which is the hard part, since here we are faced with the complexity of distributed systems.
  • Communication is asynchronous by default—message and stream-based—but with the option of using other protocols, like synchronous REST, if needed.
  • Persistence is event-based by default—using Event Sourcing and CQRS—but has support for things like JPA and NoSQL databases if needed.
  • A fully integrated development environment, through which 100s of microservices can be managed with one command. It supports automatic hot code reload across all the services and is integrated with IDEs and other tools. The development environment is based on the production environment (through ConductR), thus directly supporting deployment and scaling up in production.

InfoQ: You describe Lagom as an opinionated framework?

Bonér: Yes. It is opinionated. We have learned a lot of lessons building Akka and Play Framework, and seeing our customers use our platform for building microservices—which they have been doing for years, even before the word microservice was coined.

Lagom is based on the Reactive principles (as defined in the Reactive Manifesto). This has a lot of implications and has guided the design of Lagom. The goal is to make it easy to do the "right thing" out of the box, and provides a guard-railed approach, with good defaults. But also allows you to deviate from them if you have good reasons and know what you are doing.

InfoQ: More specifically, what does Lagom encourage?

Bonér: We touched briefly on this above, but let me elaborate. Some of the key principles Lagom encourages, and makes easy, are:
  • True isolation through share nothing designs: This means the services in Lagom are autonomous, loosely coupled and mobile (location transparent)—which is a necessary requirement for resilience and elasticity. In Lagom microservices are based on:
    • Akka Actors—providing isolation through a share nothing architecture based on the Actor Model.
    • Akka Cluster—providing resilience, sharding, replication, scalability and load-balancing of the groups of individual isolated service instances making up a microservice.
    • ConductR—providing isolation down to the metal and runtime management of the microservice instances.
  • Single Responsibility: The old principle “write programs that do one thing and do it well”—stated decades ago in the Unix philosophy—has helped generations of developers to write programs that have a single purpose, a small well-defined responsibility and compose well with other small programs. Wisdom that is—in this era of microservices—more relevant than ever. It is not about size. The word microservice is actually pretty terrible, because it makes you think about size and lines of code. Lagom tries to simplify the design by removing most of the boilerplate code, allows you to focus on the essence of the service and makes it easy to create explicit and typed protocols that compose—either through asynchronous messaging, request/reply or continuous streaming.
  • Services own its data: Each service needs to own not only its behaviour, but also its data, all the way down to the persistence. In Lagom the default persistence model is using Event Sourcing and CQRS—using Akka Persistence and Cassandra—which is very scalable, easy to replicate and to make fully resilient. As a bonus it is also great for auditing and debugging, allowing you to replay or inspect the event log from any point in time. It also avoids the traditional object-relational impedance mismatch that we have suffered through using ORM techniques like JPA and Hibernate. That said, one benefit with microservices is that services are free to choose the persistence model that is most suitable for the problem at hand, so called Polyglot Persistence.
  • Asynchronous all the way through: In Lagom both communication and IO is asynchronous and non-blocking by default, and also a cornerstone in Reactive system design. For good reasons: it is often more cost-efficient through more efficient use of resources; it helps minimizing contention (congestion) on shared resources in the system—which is one of the biggest hurdles to scalability, low latency, and high throughput; and it helps creating more loosely coupled systems that can be made dynamic, available and elastic. Microservices-based systems need to embrace this fact to be able to meet the challenges of today's real-world systems.

The first MVP of Lagom is available on GitHub for Java, with Scala to follow.

Rate this Article

Relevance
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Interesting rebranding effort by Adrian Ivan

"Lightbend (recently renamed from Typesafe)."

Please excuse me, but this sounds very much like:
O(+> The Artist Formerly Known as Prince TAFKAP
The worst rebranding in showbizz history.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

1 Discuss
General Feedback
Bugs
Advertising
Editorial
Marketing
InfoQ.com and all content copyright © 2006-2016 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT

We notice you're using an ad blocker

We understand why you use ad blockers. However to keep InfoQ free we need your support. InfoQ will not provide your data to third parties without individual opt-in consent. We only work with advertisers relevant to our readers. Please consider whitelisting us.