Download - 20160317 lagom sf scala
Microservices and Lagom Jamie Allen
Sr. Director of Global Services
@jamie_allen
Agenda • What are “microservices?” • What do we want in our services? • Lagom • Questions
Traditional application architectures and platforms are obsolete. Gartner
What are we trying to achieve? • Accelerate teams • Reduce dependency nightmares • Increase application throughput
Calvin and Hobbes, Bill Waterston
“Microservices” is a lousy term • Size is irrelevant
Bing Images
We want isolation • At the API • In our source • For our data
Wikipedia, Creative Commons, created by DFoerster
We want realistic data management • Transactions, especially distributed, will not work • Consistency is an anti-pattern at scale • CQRS and Event Sourcing, not CRUD • Distributed locks and shared data will limit you
Think in terms of compensation, not prevention. Kevin Webber, Lightbend
We want asynchronous APIs • Synchronous request/response semantics are expensive • Use REST for external APIs • Stream-based interactions for inter-service communication
US Postal Service
We want immutable deployments • We can bind a build of our application to a version of our
configuration and always know what is currently running • You cannot edit configuration and keep running
Dilbert, Scott Adams
We want to expose a “tip of the iceberg” • Users see the public API • The API hides much complexity
MyBluePuzzle.org
We want DDD (but not a requirement) • Solving your pain is • In a greenfield project, Bounded Contexts and Aggregate
Roots can help you to decompose the problem
We want to ACID v2 • Associativity and Commutativity are the path to scale • Idempotent and Distributed
Wikipedia, Creative Commons, created by Weston.pace
We will have additional operational complexity • Proxying • Service Discovery • Stateless aggregation • Orchestration • Failure management • Versioning
Complexityandotherbeasts.com
• Service API • Persistence API • Development environment • Production environment
Lagom
• IO and communication • Streaming between services as a first-class concept • Higher level of resilience and scalability with no blocking • Service is a Bounded Context in DDD
Lagom Service API
• Event sourced (deltas) with Cassandra backend by default • No object/relational impedance mismatch • Can always replay to determine current state • Allows you to learn more from your data later • Persistent entity is an Aggregate Root in DDD • Can be overridden for CRUD if you want
Lagom Persistence API
• Create single project definition in sbt, use runAll, includes: • In-memory Cassandra with own keyspaces • A service locator • A service gateway
• Overload Mode: recompile and redeploy on save
Development Environment
• Deployment • Monitoring • Scaling • Can test locally with ConductR then push to production • Launch multiple instances with a single command
Production Environment (Lightbend RP)
Links Project Site: http://www.lightbend.com/lagom GitHub Repo: https://github.com/lagom Documentation: http://www.lagomframework.com/documentation/1.0.x/Home.html
Questions?