From Monolith to Microservices: A Leadership Perspective on ...

66
SATURN 2015 – Einar Landre, Jørn Ølmheim, Harald Wesenberg – Statoil ASA

Transcript of From Monolith to Microservices: A Leadership Perspective on ...

Page 1: From Monolith to Microservices: A Leadership Perspective on ...

SATURN 2015 – Einar Landre, Jørn Ølmheim, Harald Wesenberg – Statoil ASA

Page 2: From Monolith to Microservices: A Leadership Perspective on ...

Introduction

Discussion

• The Case• Domain Driven Design• Microservices

• Data vs Domain Driven• Organization and Team• Breaking the Monolith

Page 3: From Monolith to Microservices: A Leadership Perspective on ...

The Case

Page 4: From Monolith to Microservices: A Leadership Perspective on ...

DBR – Drilling Reporting System Planning and reporting of drilling operations

Began as a simple activity log

Has evolved into much more over 20 years

Client server application• 3,5 MLOC

• 1,5 MLOC PLSQL• 1,0 MLOC C#/ APS.NET/Silverlight• 1,5 MLOC PowerBuilder

Began as a PowerBuilder / Oracle application• Extended with Web later

Page 5: From Monolith to Microservices: A Leadership Perspective on ...

Architecture & Technology

DBR DB

Operations

Experiences

Risk

Cost Estimates

Experiences

KPI´s

Sections Plans

1,5MILL LOC PLSQL

Tightly coupled

+10.000LOC procedures

Fat Windows Client / Citrix

Technological fragmented

Scripted business logic

Page 6: From Monolith to Microservices: A Leadership Perspective on ...

The TeamSmall (3-5) over very long time• +15 years• Now two teams 6+4, two locations

Technology segregated• Database• Power Builder• Web (Microsoft Stack)

Vulnerable • Dependent on individuals• Number of years to retirement

Geographically segregated• Stavanger• Bergen

Page 7: From Monolith to Microservices: A Leadership Perspective on ...

PainpointsLong lead times for new functionality

Convoluted database model

Deployment problems (windows client on Citrix)

System level testing

All in one build bundle

Obsolete technology

Short time to retirement

Page 8: From Monolith to Microservices: A Leadership Perspective on ...

Data

User Interface

Logic

1. Make implicit concepts explicit.2. Create functional verticals in a

layered architecture.3. How to split the database?

Risks

Risk Domain Model

Risk Service API

Risk UI

Project Plans

Project Planning Domain Model

Project Planner Service API

Project Planner UI

Way forward

Page 9: From Monolith to Microservices: A Leadership Perspective on ...

Domain Driven DesignDomain-Driven Design:Tackling the complexity in the heart of softwareEric Evans, 2003

http://www.domaindrivendesign.org

Page 10: From Monolith to Microservices: A Leadership Perspective on ...

An object model of the domain that incorporates both behavior and data.

A single instance that handles the business logic for all rows in a database table or view.

• Transaction Script

Patterns of Enterprise Application Architecture (p. 109-132) – Martin Fowler

Organizes business logic by procedures where eachprocedure handles a single request from thepresentation.

• Table Module

• Domain Model

Three main patterns for organizing the domain logic:

Domain Logic Patterns

Page 11: From Monolith to Microservices: A Leadership Perspective on ...

Domain Driven Design – distilled

• Ubiquitous (domain based) language

−A language that is built around the concepts of the business and that permeates every activity in the project.

− The language used to talk about the domain model in the project

• Patterns for building a domain model

• Strategic design principles and techniques

Page 12: From Monolith to Microservices: A Leadership Perspective on ...

Ubiquitous language – A Domain based language

TechnicalLanguage

DomainLanguage

UbiquitousLanguage

Page 13: From Monolith to Microservices: A Leadership Perspective on ...

Building blocks: Patterns

Domain DrivenDesign

Services

Smart UI

Entities

ValueObjects

LayeredArchitecture

Repositories

Aggregates

Factories

SmartDatabase

Page 14: From Monolith to Microservices: A Leadership Perspective on ...

Domain Driven Design – Strategic Design

Context Map

Continous Integration

UbiquitousLanguage

SharedKernel

PublishedLanguage

AnticorruptionLayer

Customer/SupplierTeams

Conformist

Open HostService

Bounded Context

SeparateWays

CoreDomain

Domain VisionStatement

GenericSubdomains

SegregatedCore

HighlightedCore

AbstractCore

Page 15: From Monolith to Microservices: A Leadership Perspective on ...

Strategic design: Context mapsIn large systems (or set of systems), we need a map to give us a picture of the models that are inside.

Bounded context

Bounded context

Context map

Relations

2014-

Page 16: From Monolith to Microservices: A Leadership Perspective on ...

Strategic design: Integrity across systems

• Bounded context− The meaning of a domain concept is

bound by the context it is used• Context map

− A map that describe the contexts and their relationships

• Relation types:− Shared kernel − Customer/supplier teams − Conformist − Anti-corruption layer − Separate ways − Open host service − Published language

Page 17: From Monolith to Microservices: A Leadership Perspective on ...

Strategic design: Types of relations

Type Description

Shared kernel • Overlapping models shared among teams

Customer/supplierdevelopment teams

• One bounded context is maintained by one team but used by another

Conformist • As C/S development teams, but the customer team stricly adheresto the supplier model, without the option to change it.

Anticorruption layer • Isolation layer between models that take up the differences

Separate ways • Avoid integration, let the models develop on their own

Open host service • One system that has an open connection point that can be used by (many) other systems

Published language • Let the integration be based on a common, well-defined language

Page 18: From Monolith to Microservices: A Leadership Perspective on ...

Aggregates

+addProduct()+calculateCost()+getOrderLines()+deleteOrderLine()+create()

«aggregate-root»Order

-priceOrderLine

1*

-price

«aggregate-root»Product

1 1

+add()+findAll()+findMatching()

OrderRepository

1 * +add()+findAll()+findMatching()

ProductRepository

1*

Order aggregateProduct aggregate

Page 19: From Monolith to Microservices: A Leadership Perspective on ...

…is a wayof designing software

as suites ofindependently deployable

services

Microservices

Page 20: From Monolith to Microservices: A Leadership Perspective on ...
Page 21: From Monolith to Microservices: A Leadership Perspective on ...

governance

Independent

Service Management

Ruby

Agile Ar

chite

ctur

e

Skills

Team

Clou

d App Engine

REST

Linux

Scal

a

Kanban

Application Development

Mobility

Pyth

on

Docker

node.jsweb services

JSON

javascript

Odata Atom PubXML

Page 22: From Monolith to Microservices: A Leadership Perspective on ...

Smart EndpointsDumb Pipes

Page 23: From Monolith to Microservices: A Leadership Perspective on ...
Page 24: From Monolith to Microservices: A Leadership Perspective on ...
Page 25: From Monolith to Microservices: A Leadership Perspective on ...

InfrastructureAutomation

Page 26: From Monolith to Microservices: A Leadership Perspective on ...

Service Interfaces

Page 27: From Monolith to Microservices: A Leadership Perspective on ...

Organized aroundBuisness capabilities

Page 28: From Monolith to Microservices: A Leadership Perspective on ...

Conway’s LawOrganizations which designsystems … are constrained toproduce designs which are copiesof the communication structuresof these organizationsMelvin E. Conway

Page 29: From Monolith to Microservices: A Leadership Perspective on ...

Borrowed from James Lewis and Martin Fowler’s article:http://martinfowler.com/articles/microservices.html

Page 30: From Monolith to Microservices: A Leadership Perspective on ...

Borrowed from James Lewis and Martin Fowler’s article:http://martinfowler.com/articles/microservices.html

Inverse Conway maneuver

Page 31: From Monolith to Microservices: A Leadership Perspective on ...

-Rapid provisioning-Basic monitoring-Rapid Application Development-DevOps Culture

Important success criteria

Page 32: From Monolith to Microservices: A Leadership Perspective on ...

Data driven vsDomain driven

Page 33: From Monolith to Microservices: A Leadership Perspective on ...

Discussion

Domain Driven Design is advocated as the best way

Still we see that the data driven approach dominate

Why?

Object oriented languages used as script languages

1000 or even 10.000 LOC methods are still written

Page 34: From Monolith to Microservices: A Leadership Perspective on ...

Data Driven DevelopmentHas its origin in data processing

Entry, Validation, Sorting, Summarization, Aggregation, …

1890 US CensusHerman Hollerith

Punch cards for data storage

Electro-Mechanical machines until the 1950ties…

COBOL programming language since 1959 …

Page 35: From Monolith to Microservices: A Leadership Perspective on ...

Object Oriented DevelopmentHas its origin in simulation of dynamic systems

Encapsulation of state and behaviour in “classes”

Simula 67 language

Ole Johan Dahl / Kristen Nygaard

Simplifies the modelling of real-world behaviour

Smalltalk, C++, Java, C#, Scala, ….

Interception of ICBM’s

Page 36: From Monolith to Microservices: A Leadership Perspective on ...

Thoughts on DBR and its likesBegan as a data processing systems

With time, more and more dynamic domain’s was added

Record and report performed operations• Materials used• Difficulties encountered• Failures

Planning (re-planning)• Automated planning• Optimisation• Monitoring

Scheduling• Cost function• Automatic re-scheduling• Optimisation

Dynamic domains are addressed with a data driven approach

Page 37: From Monolith to Microservices: A Leadership Perspective on ...

Micro-services to the rescue?Planning & Scheduling• Automated planning• Multi-agent

Each service can be implemented with the most suitable technology

Analysis• R for statistics

Daily reports• Data driven

Page 38: From Monolith to Microservices: A Leadership Perspective on ...

Novice

AdvancedNovice

Proficient

Competent

Expert

Know

ledg

eCreativity

You need skills

Page 39: From Monolith to Microservices: A Leadership Perspective on ...

2014-04-2439

Novice Competent Expert

10x 10x

Number of persons

Skills and productivity

Page 40: From Monolith to Microservices: A Leadership Perspective on ...

Organization

Page 41: From Monolith to Microservices: A Leadership Perspective on ...
Page 42: From Monolith to Microservices: A Leadership Perspective on ...

Our TeamSmall (3-5) over very long time• +15 years• Now two teams 6+4, two

locations

Technologically segregated• Database• Power Builder• Web (Microsoft Stack)

Page 43: From Monolith to Microservices: A Leadership Perspective on ...

Why have wenot succeded?

Page 44: From Monolith to Microservices: A Leadership Perspective on ...

2014-04-2444

LeadershipGood software leaders are rare• How to nurture talents?• How to develop the needed skills?

Leading from the front or back?• How to build trust?

How to ensure individuals pulls as a team?

Page 45: From Monolith to Microservices: A Leadership Perspective on ...

Conway’s LawOrganizations which designsystems … are constrained toproduce designs which are copiesof the communication structuresof these organizationsMelvin E. Conway

Page 46: From Monolith to Microservices: A Leadership Perspective on ...

Our TeamNot cross functional• Database• Power Builder• Web (Microsoft Stack)

Vulnerable • Dependent on individuals• Number of years to retirement

Not co-located• Stavanger• Bergen

Page 47: From Monolith to Microservices: A Leadership Perspective on ...

Our company

Large enterprise organization• Divisional structure• Multinational• Central IT governance

Lacking• DevOps culture• Infrastructure automation

Page 48: From Monolith to Microservices: A Leadership Perspective on ...

Borrowed from James Lewis and Martin Fowler’s article:http://martinfowler.com/articles/microservices.html

Page 49: From Monolith to Microservices: A Leadership Perspective on ...

DB Server

App Server

Web Server

Custom codeCustom codeCustom code

Platform

Custom Platform

Development Team

Group 1 Group 2 Group 3

Actors = 4

Page 50: From Monolith to Microservices: A Leadership Perspective on ...

DB Server

App Server

Web Server

Custom codeCustom codeCustom code

Platform

Custom

Platform

Development Team

Actors = 1

Page 51: From Monolith to Microservices: A Leadership Perspective on ...

Breaking theMonolith

Page 52: From Monolith to Microservices: A Leadership Perspective on ...

How do you eat an elephant?

oone bite at a time

Page 53: From Monolith to Microservices: A Leadership Perspective on ...

Goals1. Make it easier to implement new features2. Make stored data more easily available3. Simplify build and deployment4. Modernize technology stack

In short: Optimize delivery of newfeatures and availability of data

Page 54: From Monolith to Microservices: A Leadership Perspective on ...

CostEstimation Risk

Profile

DBR

Risk

Project Planner

Reference Data

Daily Reports

Benchmarks KPI’s

AnalysisExperiences

Schedules Cost Estimates

Operations History

DBR DB (1,5mloc)

Bounded contexts

Monolith

Page 55: From Monolith to Microservices: A Leadership Perspective on ...

RiskProfile

ProjectPlanning

DBR - Modularized

Risk

Project Planner

Reference Data

Daily Reports

Benchmarks KPI’s

AnalysisExperiences

Schedules Cost Estimates

Operations History

Risk

Functionality integrated at each module level as services• Internal bus for DBR functionality • Services for external data

Daily Reports

Project Planner

Benchmarks KPI’s

Experiences

Schedules

Analysis

OperationsHistory

Reference Data

Cost Estimates

Page 56: From Monolith to Microservices: A Leadership Perspective on ...

How do we get there?

Page 57: From Monolith to Microservices: A Leadership Perspective on ...

Making changes

Page 58: From Monolith to Microservices: A Leadership Perspective on ...

Extracting a bounded context

Page 59: From Monolith to Microservices: A Leadership Perspective on ...

1. Duplicate databases, replicate data2. Duplicate schemas3. Views

Database tactics

Page 60: From Monolith to Microservices: A Leadership Perspective on ...

DBR

DBR

Risk

Project Planner

Reference Data

Daily Reports

Benchmarks KPI’s

Analysis

Experiences

Schedules

Cost Estimates

Operations History

DBR

DBR - Risk

Risk

Page 61: From Monolith to Microservices: A Leadership Perspective on ...

DBR

Risk

DBR - Risk

Risk(NoSQL)

DBR

Project Planner

Reference Data

Daily Reports

Benchmarks KPI’s

Analysis

Experiences

Schedules

Cost Estimates

Operations History

Page 62: From Monolith to Microservices: A Leadership Perspective on ...

Database refactoring

Page 63: From Monolith to Microservices: A Leadership Perspective on ...

Master data

Page 64: From Monolith to Microservices: A Leadership Perspective on ...

Master

Customer

REST

Application

Customer

Publish/SubscribeBatch Pull

Application

Pull

Application

Customer

TRANSFORM

Publish/SubscribeBatch Pull

Page 65: From Monolith to Microservices: A Leadership Perspective on ...

Summary• Data-driven monolithic apps• Change and adapt your organization• Bounded contexts as Microservices• Build domain modelling skills• Leadership is a critical success factor

Page 66: From Monolith to Microservices: A Leadership Perspective on ...

Thank you