NFJS 2015 Migrating to Microservices - SDD...

Preview:

Citation preview

Software Design and Development Conference 2015

Mark RichardsHands-on Software ArchitectAuthor of Enterprise Messaging Video Series (O’Reilly)Author of Java Message Service 2nd Edition (O’Reilly)Co-author of Software Architecture Fundamentals Video Series (O'Reilly)

Migrating to a Microservices Architecture

Software Architecture Fundamentals Video Series Enterprise Messaging Video Series

microservices architecture elements

agenda

migration challengesmicroservices hybrid models

migration techniques

Microservices Architecture Elements

microservices elements

api layer

client requests client requests client requests

distributed architecture

api layer

client requests client requests client requests

microservices elements

separately deployed units

api layer

client requests client requests client requests

microservices elements

service component

api layer

client requests client requests client requests

microservices elements

bounded context

api layer

client requests client requests client requests

microservices elements

microservices hybrid models

databasescope

service granularity

integration hub

microservices hybrids

api layer

client requests client requests client requests

microservices hybridsservice granularity

user interface layer

client requests client requests client requests

microservices hybridsservice granularity

single-purpose micro-service to "portion of the application" macro-service

service granularity

macro-services resolves orchestration and transactional issues

microservices hybrids

allows for complex business processing within a service context

-

single-purpose micro-service to "portion of the application" macro-service

service granularity

services become harder to develop and testdeployment pipeline requires more planningchange control becomes more difficult

microservices hybrids

-

microservices hybridsdatabase scope

api layer

client requests client requests client requests

microservices hybridsdatabase scope

user interface layer

client requests client requests client requests

single-purpose service-based database to globally shared application database

reduces service orchestration and contract dependencies

microservices hybridsdatabase scope

improves performance due to fewer remote callsrefactoring entire database may not be feasible or possible

-

single-purpose service-based database to globally shared application database

looser bounded context of servicestighter service coupling based on schema

microservices hybridsdatabase scope

schema changes become expensive and difficult

-

microservices hybridsintegration hub

api layer

client requests client requests client requests

lightweight message broker

user interface layer

client requests client requests client requests

microservices hybridsintegration hub

integration hub / middleware

lightweight message broker to heavier integration hub

microservices hybridsintegration hub

allows for transformation of contract differences allows for non-transactional orchestration of servicesallows for protocol-agnostic heterogeneous interoperabilityallows for common processing logic across all services

-

lightweight message broker to heavier integration hub

decrease in overall performanceadded complexity and costincreased need for governancedeployment pipeline requires much more planning

microservices hybridsintegration hub

services become harder to develop and test-

microservices migration challenges

migration challenges

distributed architecture and remote service issues

service component granularity and transactional boundaries

shared services, modules, and object hierarchies

distributed architecture issues

contract creation, maintenance, versioning, and coordination

migration challenges

distributed architecture issues

remote process responsiveness and server availability

migration challenges

distributed architecture issuesmigration challenges

slower service invocations due to remote access protocols and distributed

components

distributed architecture issuesmigration challenges

atomic transactions and transaction scope

distributed architecture issuesmigration challenges

authenticating and authorizing remote connections and service invocations

distributed architecture issuesmigration challenges

distributed logging facilities to provide a holistic view of a transaction

service component granularitymigration challenges

module module module module module

module module module module module

module module module module module

module module module module module

coarse-grained service components address transactional issues but may not achieve your desired goals

service component granularitymigration challenges

module module module module module

module module module module module

module module module module module

module module module module module

fine-grained service components may lead to too much orchestration and inter-dependency between service components

module module module module module

module module module module module

module module module module module

module module module module module

business functionality groupingstransactional boundariesdeployment goalsscalability needs

service component granularitymigration challenges

shared components and object hierarchiesmigration challenges

module module module

abstract

abstract

shared

inheritance structure

shared modules (utility and service classes)

shared components and object hierarchiesmigration challenges

module module module

abstract

abstract

shared

inheritance structure

shared modules (utility and service classes)

LIB

LIB

modulemodule module module

module

module

module module

modules can be split....

shared components and object hierarchiesmigration challenges

module module

module

module

or moved into a shared library or jar file...

module

shared components and object hierarchiesmigration challenges

or replicated in each service component

module module

module

module

module module

shared components and object hierarchiesmigration challenges

shared lib or jar file

user interface layer

application business layer

module module

modulemodule module

module module

module

migration challengesshared components and object hierarchies

migration challengesshared component techniques

jar /dll (compile or runtime)

LIB

shared library (compile time)

code replication remote services

migration techniques

playbook approach

current state iteration 1 iteration 2 iteration 3

each iteration should clearly illustrate the changes to the architecture each step along the way

migration techniques

playbook approach

current state iteration 1 iteration 2 iteration 3

identify the purpose behind each iteration

identify the technical and business value for each iteration

keep iterations as small as possible while still providing enough technical and business value

try to minimize "staging iterations"

migration techniques

form a logical or physical separation between the user interface layer and the business layer

user interface separationmigration techniques

application business layer

user interface layer

CustomerData

AccountData

TradeData

ReportData

IDataModel

CustomerUI

AppClient

AccountUI TradeUI ReportUI

Customer Account Trade Report

migration techniques

application business layer

user interface layer CustomerUI

AppClient

AccountUI TradeUI ReportUI

Customer Account Trade Report

model.jar

model.jarCustomerData

AccountData

TradeData

ReportData

IDataModel

migration techniques

service migrationmigration techniques

application business layer

user interface layer CustomerUI

AppClient

AccountUI TradeUI ReportUI

Customer Account Trade Report

model.jar

model.jar

migration techniques

application business layer

user interface layer CustomerUI

AppClient

AccountUI TradeUI ReportUI

ReportTrade

model.jar

model.jar

Customer Account

model.jar

CustomerListener

Customer Account

migration techniques

application business layer

user interface layer CustomerUI

AppClient

AccountUI TradeUI ReportUI

ReportTrade

model.jar

model.jar

Customer Account

model.jar

CustomerListener

migration techniques

user interface layer CustomerUI

AppClient

AccountUI TradeUI ReportUImodel.jar

Customer Account

CustomerListener

model.jar

trade

TradeListener

model.jar

Report

ReportListener

model.jar

migration techniques

Migrating to a Microservices Architecture

Independent  ConsultantHands-­‐on  So*ware  ArchitectPublished  Author  /  Conference  Speaker

Mark  Richards

h<p://www.wmrichards.comh<p://www.linkedin.com/pub/mark-­‐richards/0/121/5b9

Recommended