The 6 Rules for Modernizing Your Legacy Java Monolith with Microservices

86
The 6 Rules for Modernizing Your Legacy Java Monolith with Microservices by Kevin Webber (@kvnwbbr)

Transcript of The 6 Rules for Modernizing Your Legacy Java Monolith with Microservices

The 6 Rules for Modernizing Your Legacy Java Monolith with Microservices

by Kevin Webber (@kvnwbbr)

A Legacy Monolith Story

heritage architecture» Single points of failure

» Impossible to scale out (shared mutable state, etc)

» Different non-functional requirements (reads, writes, compute)

» Optimized for none!

» Long, risky release cycles

How do Microservices help?

Microservices» Ubiquitous language

» Well defined models & boundaries

» Single responsibility

» Independently deployable, scalable, resilient

» Communicate via async messaging

» Own their data

» Don't expose a public API

Approach?Principles

» responsive, resilient, elastic, message-driven

Approach?Principles

» responsive, resilient, elastic, message-driven

Concepts

» bounded contexts (DDD), event sourcing, CQRS, CAP (eventual consistency)

Approach?Principles

» responsive, resilient, elastic, message-driven

Concepts

» bounded contexts (DDD), event sourcing, CQRS, CAP (eventual consistency)

Tools

» Typesafe Reactive Platform (Play, Akka, Spark)

Concepts and patternsWe will cover:

» Domain Driven Design (DDD)

» Async messaging

» API management

» Dependency management

» CQRS & event sourcing

» Transactions & ordering

Domain Driven Design

Getting started» Model sub-domain at package

level

» Tip: Visualize existing architecture with a tool like Structure101

» Define public RESTful API at package level (use async messaging inside package at service level)

» Refactor for physical separation, remove package

Going async

Async Benefits» Not wasting resources

» Memory, CPU, threads

» Embracing failure

» Not expecting a return from a remote service

» Designing for all scenarios

API management

API mgmt.» Messaging patterns

» Pub/sub, point-to-point, streaming

» API gateway

» Routing, aggregation, protocol translation

» Discovery

» Service discovery, registry, versioning

Dependency management

CQRS & event sourcing

Transactions and ordering

Considerations» ACID doesn't work across location/trust boundaries

» No 2-Phase commits (2PC)

» No holding locks for the duration of work

» In distributed systems we need to compensate for for failure rather than prevent failure

What next?

Microservices with Lightbend» Play for API gateway

» Akka for core microservices (DDD, CQRS, event sourcing)

» ConductR for cluster management (service registry, discovery, architecture visualization, security)

LagomMonolith to microservices

» Webinar: March 17, 1PM PST / 4PM EST

» https://www.lightbend.com/discover-lagom

» Ready-to-use connectors: event-sourcing, CQRS

» Launch all microservices with a single command

» Instantly visible code updates

Thank you!Visit https://www.lightbend.com/products/lightbend-reactive-platform to get started

Contact info

» Twitter: @kvnwbbr

» Email: [email protected]

LIGHTBEND REACTIVE PLATFORMFull Lifecycle Support for Play, Akka, Scala and Spark

Give your project a boost with Reactive Platform:

• System orchestration for resilient releases • Real-time monitoring of asynchronous systems • Self-healing for network partitions, node and apps • Availability protected with configurable user quotas • Certified, load-tested Reactive Runtime

Enjoy learning? See about the availability of on-site training for Scala, Akka, Play and Spark!

GET STARTED