48
{Nano|Micro|Mini}-Services? Modularization for Sustainable Systems Stefan Tilkov | innoQ [email protected] @stilkov

{Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

{Nano|Micro|Mini}-Services? Modularization for Sustainable Systems

Stefan Tilkov | innoQ [email protected]

@stilkov

Page 2: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

http://microxchg.io

Page 3: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

1. Reviewing architectures

Page 4: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

Generic Architecture Review Results

Building features takes

too long

Technical debt is well-known and not

addressed

Deployment is way too

complicated and slow

Replacement would be way too expensive

Scalability has reached its limit

Architectural quality has degraded

“-ility” problems abound

Page 5: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

Any architecture’s quality is inversely proportional to the number of bottlenecks limiting its evolution,

development, and operations

Page 6: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

«Insert Obligatory Conway Reference Here»

Page 7: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

Conway’s Law

“Organizations which design systems are constrained to produce systems which are copies of the communication structures of

these organizations.” – M.E. Conway

Organization → Architecture

Page 8: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

Reversal 1

Any particular architecture approach constraints organizational options – i.e. makes some organizational models simple and others

hard to implement.

Organization ← Architecture

Page 9: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

Reversal 2

Choosing a particular architecture can be a means of optimizing for a desired

organizational structure.

Organization ← Architecture

Page 10: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

2. System boundaries

Page 11: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

Modularization

Legacy SystemNew System New System

Page 12: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

New System

Consolidation

Legacy System Legacy System

Page 13: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

New SystemLegacy System

Modernization

Page 14: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

New System

Greenfield

Project scope

Page 15: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

1 Project = 1 System?

Page 16: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

Size Modularization

1-50 LOC single file

50-500 LOC few files, few functions

500-1000 LOC Library, class hierarchy

1000-2000 LOC Framework + application

>2000 LOC multiple applications

Page 17: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

System CharacteristicsSeparate (redundant) persistence

Internal, separate logic Domain models & implementation strategies

Separate UI Separate development & evolution

Limited interaction with other systems Autonomous deployment and operations

Page 18: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

Macro (technical) architecture

Domain architecture

Page 19: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

JRuby C#

ScalaGroovy

JavaClojure

Page 20: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

RDBMSNoSQL

K/V

RDBMS RDBMS/DWHNoSQLDocDB

Page 21: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

RDBMSNoSQL

K/V

RDBMS RDBMS/DWHNoSQLDocDB

Micro architecture

Page 22: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

Persistence

Logic

UI

Module A

Module B

Module C

Page 23: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

System A

Persistence

Logic

UI

System B

Persistence

Logic

UI

System C

Persistence

Logic

UI

Page 24: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

Assumptions to be challengedLarge systems with a single environment

Separation internal/external Predictable non-functional requirements

Clear & distinct roles Planned releases

Built because they have to be

Page 25: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

http://12factor.net

Page 26: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

Separate, runnable process Accessible via standard ports & protocols

Shared-nothing model Horizontal scaling

Fast startup & recovery

App characteristics

Page 27: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

Microservice Characteristicssmall

each running in its own process lightweight communicating mechanisms (often HTTP)

built around business capabilities independently deployable

minimum of centralized management may be written in different programming languages

may use different data storage technologies

http://martinfowler.com/articles/microservices.html

Page 28: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

System CharacteristicsSeparate (redundant) persistence

Internal, separate logic Domain models & implementation strategies

Separate UI Separate development & evolution

Limited interaction with other systems Autonomous deployment and operations

Page 29: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

In search for a name …

Not-so-micro-service

Autonomous system

Full-stack service

Self-sufficient componentSmall system

Sovereign system

Independent system

Cohesive system

Large enough system

Small enough system

Logical node Domain unit

Bounded system

Executable component

System

Self-contained system

Page 30: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

Self-Contained System (SCS)

Page 31: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

SCS CharacteristicsAutonomous web application

Owned by one team No sync remote calls Service API optional

Includes data and logic No shared UI

No or pull-based code sharing only

Page 32: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

SCS App Microservice

Size (kLoC) 1-50 0.5-10 0.1-?

State Self-contained External Self-contained

# per Logical System 5-25 >50 >100

Communication between units No (if possible) ? Yes

UI Included Included External (?)

UI Integration Yes (web-based) ? ?

Page 33: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

But why?

Page 34: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

Isolation

Page 35: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

(Independent) Scalability

Page 36: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

Localized decisions

Page 37: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

Replaceability

Page 38: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

Playground effect

Page 39: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

Afraid of chaos?

Page 40: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

Necessary Rules & GuidelinesCross-system System-internal

Responsibilities Programming languagesUI integration Development toolsCommunication protocols Frameworks

Data formats Process/Workflow control

Redundant data PersistenceBI interfaces Design patternsLogging, Monitoring Coding guidelines

Page 41: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

Web-native front-end integration

Page 42: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

Browser

HTML Page

Backend 1

UI 1

UI 2

Server-side integration

Backend 2

FrontendServer

Examples: ESI-Caches SSI Portal Server

Page 43: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

Browser

HTML Page

Backend 1

UI 1

UI 2

Client-side integration

Backend 2

Examples: AJAX Proprietary Frameworks

Page 44: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

Browser

HTML Page 1

Links

Backend 1

Backend 2

Asset Server

HTML Page 2

CSS

<<creates>>

<<creates>>

Page 45: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

Development

Deployment

Storage

Backend call

Edge integration

Server-side integration optionsESI

Homegrown(Portal server)

Build toolsChef, Puppet, …

Asset pipeline

Git/SVN submodules GemsMaven artifacts

DB replicationFeeds

RPCRESTRMI

WS-*

Page 46: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

Link

Replaced link

Client-side integration options

Client call

Magical integration concept

Unobtrusive JSROCA-style

oEmbed

SPA-styleJS Widgets

Page 47: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

Explicitly design system boundaries Modularize into independent, self-contained systems

Separate micro and macro architectures Be aware of changing quality goals

Strike a balance between control and decentralization

Summary

Page 48: {Nano|Micro|Mini}-Services? Modularization for Sustainable ... · Limited interaction with other systems Autonomous deployment and operations. Macro (technical) architecture ... Accessible

Thank you!Questions? Comments?

Stefan Tilkov, @stilkov [email protected] http://www.innoq.com/blog/st/ Phone: +49 170 471 2625

innoQ Deutschland GmbH

Krischerstr. 100 40789 Monheim am Rhein Germany Phone: +49 2173 3366-0

innoQ Schweiz GmbH

Gewerbestr. 11 CH-6330 Cham Switzerland Phone: +41 41 743 0116www.innoq.com

Ohlauer Straße 43 10999 Berlin Germany Phone: +49 2173 3366-0

Robert-Bosch-Straße 7 64293 Darmstadt Germany Phone: +49 2173 3366-0

Radlkoferstraße 2 D-81373 München Germany Telefon +49 (0) 89 741185-270