20160317 lagom sf scala

21
Microservices and Lagom Jamie Allen Sr. Director of Global Services @jamie_allen

Upload: shinolajla

Post on 09-Jan-2017

1.364 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: 20160317 lagom sf scala

Microservices and Lagom Jamie Allen

Sr. Director of Global Services

@jamie_allen

Page 2: 20160317 lagom sf scala

Agenda •  What are “microservices?” •  What do we want in our services? •  Lagom •  Questions

Page 3: 20160317 lagom sf scala

Traditional application architectures and platforms are obsolete. Gartner

Page 4: 20160317 lagom sf scala

What are we trying to achieve? •  Accelerate teams •  Reduce dependency nightmares •  Increase application throughput

Calvin and Hobbes, Bill Waterston

Page 5: 20160317 lagom sf scala

“Microservices” is a lousy term •  Size is irrelevant

Bing Images

Page 6: 20160317 lagom sf scala

We want isolation •  At the API •  In our source •  For our data

Wikipedia, Creative Commons, created by DFoerster

Page 7: 20160317 lagom sf scala

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

Page 8: 20160317 lagom sf scala

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

Page 9: 20160317 lagom sf scala

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

Page 10: 20160317 lagom sf scala

We want to expose a “tip of the iceberg” •  Users see the public API •  The API hides much complexity

MyBluePuzzle.org

Page 11: 20160317 lagom sf scala

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

Page 12: 20160317 lagom sf scala

We want to ACID v2 •  Associativity and Commutativity are the path to scale •  Idempotent and Distributed

Wikipedia, Creative Commons, created by Weston.pace

Page 13: 20160317 lagom sf scala

We will have additional operational complexity •  Proxying •  Service Discovery •  Stateless aggregation •  Orchestration •  Failure management •  Versioning

Complexityandotherbeasts.com

Page 14: 20160317 lagom sf scala
Page 15: 20160317 lagom sf scala

•  Service API •  Persistence API •  Development environment •  Production environment

Lagom

Page 16: 20160317 lagom sf scala

•  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

Page 17: 20160317 lagom sf scala

•  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

Page 18: 20160317 lagom sf scala

•  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

Page 19: 20160317 lagom sf scala

•  Deployment •  Monitoring •  Scaling •  Can test locally with ConductR then push to production •  Launch multiple instances with a single command

Production Environment (Lightbend RP)

Page 20: 20160317 lagom sf scala

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

Page 21: 20160317 lagom sf scala

Questions?