10 Tips for failing at microservices

Post on 11-Apr-2017

216 views 5 download

Transcript of 10 Tips for failing at microservices

@koenighotze#Voxxed #10TipsMicroservices

10 Tips for failing badly at Microservices

David Schmitz Senacor Technologies

#VoxxedVienna #10TipsMicroservices @koenighotze

David Schmitz / @koenighotze

Senacor Technologies

Principal Architect

Programmer

That’s me coding EJBs

#VoxxedVienna #10TipsMicroservices @koenighotze

Disclaimer

This is not YOU! Opinions are my OWN!TM

#VoxxedVienna #10TipsMicroservices @koenighotze

What’s in it for you?

Your boss want’s to modernise, but you don’t

Things to do to sabotage your project

Lessons learned the hard way

Things have been anonymised to protect the guilty

#VoxxedVienna #10TipsMicroservices @koenighotze

The Boss read about microservices?

#VoxxedVienna #10TipsMicroservices @koenighotze

Extreme agile cloud native digital

microservices!

Disrupt or be disrupted!

Sounds good. And cloud and agile equal

good?!?Industry 4.0!

FTW!

#VoxxedVienna #10TipsMicroservices @koenighotze

“IT People! Make it happen! Build me some microservices”

#VoxxedVienna #10TipsMicroservices @koenighotze

What the hell is a microservice and why should I care?

#VoxxedVienna #10TipsMicroservices @koenighotze

Microservices IMHO

Single Bounded Context

UI and Services

Independent

Self-Contained

Local storage

Share nothing

User Interface

Services

Persistence

Operations

#VoxxedVienna #10TipsMicroservices @koenighotze

Whatever! BLAH BLAH

User Interface

Services

Persistence

Operations

Too lazy to actually read all

this stuff…looks boring and I

want to look at funny cat

pics.

#VoxxedVienna #10TipsMicroservices @koenighotze

Sabotage Extravaganza

Follow these

#VoxxedVienna #10TipsMicroservices @koenighotze

Sabotage Extravaganza10 9 8 7 6 5 4 3 2 1

Direction of Awesomeness

#VoxxedVienna #10TipsMicroservices @koenighotze

10 - Go Full-Scale-Polyglot

#VoxxedVienna #10TipsMicroservices @koenighotze

#VoxxedVienna #10TipsMicroservices @koenighotze

Waldo-Tech Stack

#VoxxedVienna #10TipsMicroservices @koenighotze

Technical knowledge - Excitement

Groundhog Code - Redevelop solutions

Maintenance field trips

Heisenberg monitoring & Ops

The Zoo of Technology

#VoxxedVienna #10TipsMicroservices @koenighotze

Jump the Bandwagon$ npm ls | grep @0 ui-demo@0.1.0 │ ├─┬ fbjs@0.8.8 │ │ │ ├─┬ encoding@0.1.12 │ │ │ │ └── iconv-lite@0.4.15 │ │ └── ua-parser-js@0.7.12 ├─┬ react-scripts@0.8.5 │ │ ├── normalize-range@0.1.2 │ │ │ │ └── json5@0.5.1 │ │ │ └── source-map-support@0.4.11 │ │ │ └── regenerator-runtime@0.10.1 │ │ │ └── ms@0.7.2

#VoxxedVienna #10TipsMicroservices @koenighotze

Polyglot?

#VoxxedVienna #10TipsMicroservices @koenighotze

Polyglot?

thx @Codepitbull

#VoxxedVienna #10TipsMicroservices @koenighotze

Freedom is a human right

Everybody loves a puzzle - REST, HAL, SIREN

Find new friends while searching for fixes on Stackoverflow

Synergies: Polyglot UI with beta status

Keep ops on their toes by multi-monitoring and logging (easy win -> Date format!)

#VoxxedVienna #10TipsMicroservices @koenighotze

And ignore Ops!

#VoxxedVienna #10TipsMicroservices @koenighotze

9 - The data monolith

(c) Disney Corporation

#VoxxedVienna #10TipsMicroservices @koenighotze

#VoxxedVienna #10TipsMicroservices @koenighotze

Mum said we should share

Credit Account Payment

Giant SQL Datastore

#VoxxedVienna #10TipsMicroservices @koenighotze

Mum said we should share

Credit Account Payment

#VoxxedVienna #10TipsMicroservices @koenighotze

Name must be VARCHAR(200) instead of

VARCHAR(50)

#VoxxedVienna #10TipsMicroservices @koenighotze

Account table changes

Credit Account Payment

#VoxxedVienna #10TipsMicroservices @koenighotze

Credit Account Payment

Boom

#VoxxedVienna #10TipsMicroservices @koenighotze

Sharing is a Good ThingTM

All microservices must share the database

Avoid table or schema ownership

Insidious dependencies, e.g. Connection pools keep everybody awake at night

#VoxxedVienna #10TipsMicroservices @koenighotze

And ignore Ops!

#VoxxedVienna #10TipsMicroservices @koenighotze

8 - The event monolith

#VoxxedVienna #10TipsMicroservices @koenighotze

Marketing Pitch

Customer Homeaddress

Updated

Credit acquired

New Customer Created

Direction of Time

Customer Credit

Event Store

#VoxxedVienna #10TipsMicroservices @koenighotze

Eventsourcing Marketing Pitch

Audit trail - Immutable history for free

Distributed data management

Decoupled microservices with CQRS

…and much more!

#VoxxedVienna #10TipsMicroservices @koenighotze

‘Das schöne Österreich’ will no longer be

accepted as a country code

#VoxxedVienna #10TipsMicroservices @koenighotze

WET is the new DRY

Country: “AU”

Country: “Das schöne Österreich”

Direction of Time

Customer Credit

Event Store

#VoxxedVienna #10TipsMicroservices @koenighotze

Don’t change messy past events

Don’t come up with a data strategy

Copy and Paste compensation actions

Event history as bugfixes

Dont’t need it? Play the “We might become google or linkedin!” card

#VoxxedVienna #10TipsMicroservices @koenighotze

7 - The Home Grown monolith

#VoxxedVienna #10TipsMicroservices @koenighotze

– Carl Sagan (slightly paraphrased)

“If you wish to make MICROSERVICES from scratch, you must first create a FRAMEWORK”

Wrapping up

#VoxxedVienna #10TipsMicroservices @koenighotze

Home made Eventsourcing

{ "type": "NewCustomerCreated", "id": 1234, "payload": { } }

{ "type": "NewCustomerCreated", "id": 1234, "payload": { } }

CustomerAccount Reporting

ES V1 ES V1 ES V1

#VoxxedVienna #10TipsMicroservices @koenighotze

The customer system needs special, non-numeric ids

#VoxxedVienna #10TipsMicroservices @koenighotze

Version increaseCustomer V2

{ "type": "NewCustomerCreated", "id": "1234-5678", "payload": { ... } }

ES 2

#VoxxedVienna #10TipsMicroservices @koenighotze

Runtime surpriseCustomer V2Account Reporting

ES V1 ES V1ES 2

{ "type": "NewCustomerCreated", "id": "1234-5678", "payload": { ... } }

#VoxxedVienna #10TipsMicroservices @koenighotze

Change the world eventCustomer V2Account V2 Reporting V2

ES V2 ES V2ES 2

#VoxxedVienna #10TipsMicroservices @koenighotze

Microservice Promise

Customer

Account

Reporting

Independent release

#VoxxedVienna #10TipsMicroservices @koenighotze

Monolithic Release Plan

Customer

Account

Reporting

Common Release

#VoxxedVienna #10TipsMicroservices @koenighotze

Cross-cutting dependencies as social tools

Job insurance via invasive frameworks

Building frameworks is fun! Try it!

Ideas: Collections, String-Utils, Logging, ORM!

#VoxxedVienna #10TipsMicroservices @koenighotze

6 - Think of the meat cloud

#VoxxedVienna #10TipsMicroservices @koenighotze

W K

P T

Optimise your Revenue!

#VoxxedVienna #10TipsMicroservices @koenighotze

Who KNOWS how to do it?K

P T

Optimise your Revenue!

Who WANTS it to be done?

Who has the required

PRIVILEGES?

Who has TIME to actually

do it?

#VoxxedVienna #10TipsMicroservices @koenighotze

Insight: CD is very useful

Delivery pipeline

Production

#VoxxedVienna #10TipsMicroservices @koenighotze

And the rest of the world?

Delivery pipeline

Production

Handcrafted with love

Soulless automation

#VoxxedVienna #10TipsMicroservices @koenighotze

W

Quickly…release a new Customer microservice

K

P T

#VoxxedVienna #10TipsMicroservices @koenighotze

P T

KW

#VoxxedVienna #10TipsMicroservices @koenighotze

Ops Toolchain - Vi all the way!

P T

W K

P T

#VoxxedVienna #10TipsMicroservices @koenighotze

Ops Toolchain - Vi all the way!

P T

W K

P T

#VoxxedVienna #10TipsMicroservices @koenighotze

Prod Status - Illustration

#VoxxedVienna #10TipsMicroservices @koenighotze

Infrastructure is expensive…be proud to take care of it

Microsoft Word is some kind of automation

Play the “we are not google” card

If someone asks, say you are using Docker

#VoxxedVienna #10TipsMicroservices @koenighotze

5 - The distributed monolith

#VoxxedVienna #10TipsMicroservices @koenighotze

Friends stay close together

Customer AccountCredit

Security

#VoxxedVienna #10TipsMicroservices @koenighotze

Let’s offer a discount to new users

#VoxxedVienna #10TipsMicroservices @koenighotze

The Musketeer Pattern

Customer AccountCredit

Security

#VoxxedVienna #10TipsMicroservices @koenighotze

Combine the complexity of a microservice architecture with

the rigidity and fragility of a monolith

#VoxxedVienna #10TipsMicroservices @koenighotze

The network is reliable

Dependencies indicate good design, like in Dependency Injection

Synchronous dependencies are easy

What is half a system good for, anyway? So avoid Circuit breakers

#VoxxedVienna #10TipsMicroservices @koenighotze

And ignore Ops!

#VoxxedVienna #10TipsMicroservices @koenighotze

4 - The SPA monolith

#VoxxedVienna #10TipsMicroservices @koenighotze

Micro is REST only

Customer REST Credit RESTAccount REST

Giant Monster UI

#VoxxedVienna #10TipsMicroservices @koenighotze

Add a mandatory social-number field to the

customer

#VoxxedVienna #10TipsMicroservices @koenighotze

But not that mandatory. E.g. if the customer is not committed, yet

#VoxxedVienna #10TipsMicroservices @koenighotze

No clear responsibility

Customer Domain Credit DomainAccount Domain

Comprehensive UI Domain Model

#VoxxedVienna #10TipsMicroservices @koenighotze

Domain is spread around

Customer REST Credit RESTAccount REST

#VoxxedVienna #10TipsMicroservices @koenighotze

Ach, just put it there

Room available

#VoxxedVienna #10TipsMicroservices @koenighotze

Meet people while discussion ownership and conflicting features

Keep the testers busy with side effects

Single point of failure -> Easy to find

#VoxxedVienna #10TipsMicroservices @koenighotze

By all means, avoid composition

CreditCustomer Account

Tailor.JS / Project Mosaic

#VoxxedVienna #10TipsMicroservices @koenighotze

…and avoid Hyperlinks!

CreditCustomer Account

#VoxxedVienna #10TipsMicroservices @koenighotze

3 - The decision monolith

#VoxxedVienna #10TipsMicroservices @koenighotze

“But we need Java 7…it is 2017 after all!”

#VoxxedVienna #10TipsMicroservices @koenighotze

The sieve of sanity

Architecture & Design Sieve

#VoxxedVienna #10TipsMicroservices @koenighotze

The sieve of sanity

Agile

RxMicroservice

Actors Augmented realityCloudAWSWebRTC IoT

Blockchain

#VoxxedVienna #10TipsMicroservices @koenighotze

The sieve of sanity

Agile

RxMicroservice

Actors Augmented realityCloudAWSWebRTC IoT

Blockchain

Architecture & Design Sieve

#VoxxedVienna #10TipsMicroservices @koenighotze

The sieve of sanity

JEE

WebSphere

Agile

RxMicroservice

Actors Augmented realityCloudAWSWebRTC IoT

Blockchain

Architecture & Design Sieve

#VoxxedVienna #10TipsMicroservices @koenighotze

…works on larger scale, too

Architecture & Design Sieve

Customer AccountCredit Security

#VoxxedVienna #10TipsMicroservices @koenighotze

Frustrate your coworkers Irritate motivated colleagues

If you are older than 30…play the “This is _real_ enterprise, kid” card Ivory towers are beautiful

Assume people are dumb, and you are smart

#VoxxedVienna #10TipsMicroservices @koenighotze

2 The monolithic

business

#VoxxedVienna #10TipsMicroservices @koenighotze

MS is for Devs only

Credit Account Payment

… … …

Branch Office Toolset Something

#VoxxedVienna #10TipsMicroservices @koenighotze

Let’s force the user to always enter a valid address

#VoxxedVienna #10TipsMicroservices @koenighotze

No, the customer should be able to enter partial

addresses

#VoxxedVienna #10TipsMicroservices @koenighotze

Requirements Ping Pong

Credit Account Payment

Branch Office Toolset Something

?????

#VoxxedVienna #10TipsMicroservices @koenighotze

Change Management

#VoxxedVienna #10TipsMicroservices @koenighotze

Requirements Management

#VoxxedVienna #10TipsMicroservices @koenighotze

Waterfall!!!11!!!

#VoxxedVienna #10TipsMicroservices @koenighotze

Slow means more time for Twitter! The servant of many kings is a free man

Change / Requirement Mgmt. are your allies Business people don’t know Eric Evans

Conway’s law works both ways

#VoxxedVienna #10TipsMicroservices @koenighotze

And ignore Ops!

#VoxxedVienna #10TipsMicroservices @koenighotze

1 - Use a HR driven Architecture

#VoxxedVienna #10TipsMicroservices @koenighotze

It is easier to search for React developers than for general

craftswomen

#VoxxedVienna #10TipsMicroservices @koenighotze

Frontend Development

Service Development

DevOps Team

Test

Business

#VoxxedVienna #10TipsMicroservices @koenighotze

Magic Specification Success Template

#VoxxedVienna #10TipsMicroservices @koenighotze

Frontend Microservice

Service Microservice

Persistence Microservice

#VoxxedVienna #10TipsMicroservices @koenighotze

Frontend Microservice

Service Microservice

Persistence Microservice

Shared stability

Shared release

Convoluted domains

#VoxxedVienna #10TipsMicroservices @koenighotze

And ignore Ops!

#VoxxedVienna #10TipsMicroservices @koenighotze

Programmers do not like other people

Avoid spread of knowledge

Business knows the domain. Devs know tech

Nobody should have a big picture, keep them in the dark

Meetings mean coffee and biscuits

#VoxxedVienna #10TipsMicroservices @koenighotze

And: In case of bugs… It’s always the other team’s fault!

And: In case of bugs… It’s always the other team’s fault!

#VoxxedVienna #10TipsMicroservices @koenighotze

Wrapping up….

#VoxxedVienna #10TipsMicroservices @koenighotze

The key to failure is the hidden monolith

#VoxxedVienna #10TipsMicroservices @koenighotze

The hidden monolith

Data

Frontend

Framework

Deployment and Release

Process

#VoxxedVienna #10TipsMicroservices @koenighotze

And ignore Ops!

#VoxxedVienna #10TipsMicroservices @koenighotze

SummaryMS mean Work - Fight them

Greenfield != Brownfield - The perfect excuse

Think of the organisational impact. You do not want to change!

Embrace the monolith

Microservices are a fad. Wait for SOAP 4.0

Dont’t underestimate the power of broken windows

#VoxxedVienna #10TipsMicroservices @koenighotze

Thank you! Questions?

Thank you!

#VoxxedVienna #10TipsMicroservices @koenighotze

BACKUP