This document discusses Lagom, a microservices framework for building reactive, distributed systems on the JVM. Lagom promotes building loosely coupled services with explicit boundaries and focuses on asynchronous communication. It provides tools for event sourcing, CQRS, and clustering services for scalability. The document outlines Lagom's approach and provides resources for learning more.
10. @myfear
“All this hype about microservices
makes me sad. And not about the
concept, but about the name. As I
wrote before, “micro” in
“microservices” means absolutely
nothing. What is worse, it confuses
everybody. Again and again I see
people focusing on “micro” and
falling into nanoservices trap.”
Eugene Kalenkovich
12. @myfear
Lagom (pronounced [ˈlɑ̀ːɡɔm]) is a
Swedish word meaning
"just the right amount".
The Lexin Swedish-English dictionary
defines lagom as "enough, sufficient,
adequate, just right".
https://en.wikipedia.org/wiki/Lagom
14. @myfear
“We need to build systems
for flexibility and resiliency, not
just efficiency and robustness.
15. @myfear
Not really: Lagom is opinionated!
• Use context bounds as boundaries for services!
(Domain Driven Design)
• The event log is the book of record!
(Event Sourcing)
• Separate the read and write sides!
(CQRS)
• Microservices, too, need to be elastic and resilient!
(Reactive)
• Developer experience matters!
(The Lagom development setup)
• Takes you all the way to production!
18. @myfear
• We implementour aggregateroots as
Persistent Entities
• Persistent Entities will receive commands
• Triggered by a command, Persistent
Entities will change their state
• Example: Add a friend, remove a friend
Lagom-Services and Persistent Entities
19. @myfear
• Lagom allows you to
scale out by forming a
cluster of nodes
• Nodes can be added and
removed dynamically
• Lagom allows you to
scale out by distributing
your Persistent Entities in
the cluster
Lagom Cluster
20. @myfear
Event Sourcing - storing deltas
• Every state change is materialized in an
Event
• All events are stored in an Event Log
• Current state is constructed by replaying
all events
• No object-relational impedancemismatch
• Bullet-proof auditing and historical tracing
• Support future ways of looking at data
• Performance and scalability
• Testability
21. @myfear
Read Side is derived from Event-Log
• Events forwarded to read side to
build different representations
• ElasticSearch
• SQL, de-normalized
• Stream Processor / Analytics
• BI
• OLAP
• …
22. @myfear
Event Sourcing with Lagom Persistence revisited
• Keep all data in memory!
• Store all state changes as events
• Replay all events of an actor to recreate it
• Strong consistency for Actor (aggregate)
and Journal
• Eventual Consistency for Read Side
23. @myfear
Lagom-Services are Reactive
• Asynchronous I/O
• Asynchronous communication as first class
• WebSocket support
• Reactive Streams support
• Distributed by default
• Built-on Akka Clustering, Sharding,
Persistence
24. @myfear
Developer Support
• Run all microservices at once
• Embedded Cassandra DB
• Intra-service communicationvia service
locator
• Hot reloading
25. @myfear
Java API Scala API
Client Libraries
Protocols
Programming Model
Kafka Cassandra
JDBC
Service Locator
Service Gateway
Security
Play
JMS
REST
TCP/UDP
File IO
Akka Streams
Akka Persistence
SOAP
Play
SOAP
Akka Actors Camel
Spark
Streaming
Lagom
RP
Integra-tion
Developer UI /
REPL
Akka Cluster
Play JPA / Slick
FTP
SMTP
Integration Technologies
26. @myfear
• Reactive Microservices Framework for the JVM
• Focused on right sized services
• Asynchronous I/O and communication as first class
priorities
• Highly productive developmentenvironment
• Takes you all the way to production
Recap.
27. @myfear
Next Steps! Download and try Lagom!
Project Site:
http://www.lightbend.com/lagom
GitHub Repo:
https://github.com/lagom
Documentation:
http://www.lagomframework.com/documentation/1.0.x/Home.html
Example:
https://github.com/typesafehub/activator-lagom-java
28. @myfear
Written for architects and developers that must quickly gain
a fundamental understanding of microservice-based
architectures, this free O’Reilly report explores the journey
from SOA to microservices, discusses approaches to
dismantling your monolith, and reviews the key tenets of a
Reactive microservice:
• Isolate all the Things
• Act Autonomously
• Do One Thing, and Do It Well
• Own Your State, Exclusively
• Embrace Asynchronous Message-Passing
• Stay Mobile, but Addressable
• Collaborate as Systems to Solve Problems
http://bit.ly/ReactiveMicroservice
29. @myfear
The detailed example in this report is based on Lagom, a
new framework that helps you follow the requirements for
building distributed, reactive systems.
• Get an overview of the Reactive Programming model and
basic requirements for developing reactive
microservices
• Learn how to create base services, expose endpoints,
and then connect them with a simple, web-based user
interface
• Understand how to deal with persistence, state, and
clients
• Use integration technologies to start a successful
migration away from legacy systems
http://bit.ly/DevelopReactiveMicroservice
30. @myfear
http://bit.ly/SustainableEnterprise
• Understand the challenges of starting a greenfield
development vs tearing apart an existing brownfield
application into services
• Examine your business domain to see if microservices would
be a good fit
• Explore best practices for automation, high availability, data
separation, and performance
• Align your development teams around business capabilities
and responsibilities
• Inspect design patterns such as aggregator, proxy, pipeline, or
shared resources to model service interactions