MicroMonolith

Top anti-patterns of distributed systems

 

 

@francmichal

 

www.mfranc.com

 

TODO:
read - https://www.nginx.com/blog/event-driven-data-management-microservices/

Add something about Akka ? Erlang ?

Journey

Lead Dev @

 

Poland -> London

 

@francmichal

 

www.mfranc.com

 

Michal Franc

 

Microservices?

Again?

Microservices are on the rise

 

Microsevices are not silver bullet

Antipatterns

  • Tech 4 Good

  • Social Giving Platform

  • 20+ mln awesome users

  • 4 bln $ raised

  • 100k funded causes

1

Powered by

Monolith in Numbers

 
  • 120+ projects

  • Multiple products

  • one DB 1TB+

  • 60 min deploy time

  • 2-3 week release

 

-> Transformation ->

 

Costly Monolith

More Agility

Monolith

Monolith

Monolith

Monolith
Microservices

Microservices

Microservices

Microservices

in Numbers

 
  • 120+ microservices

  • 5-10 minutes deploy time

  • Polyglot persistence

  • Daily releases ( 300+ so far )

 

Monolith First

What can we share?

 

Antipatterns

 
  • MicroMonolith

  • Synchronous Integration

  • One DB to rule them all

  • Underestimating Costs

 

MicroMonolith

 

The Big Ball Of Mud

 

Functional

 

Beautiful

Mess

The Road to
Monolith

  • Complex

  • Development / Exploration

  • Changes

  • Pressure, Good Enough

 

Distributed - Ball of Mud

 

First iteration

 

MicroMonolith

Micromonolith was natural effect of existing habits and experience bias

"Organizations which design systems ... are constrained to produce designs which are copies of the communication structures of these organizations"

M. Conway
 

Adopting microservices requires changes in the team structure and culture

 

Distributed system require 'distributed' teams

Change is not easy!

and takes time

Micromonolith was just part of our learning process

Fail fast but learn

Synchronous Integration

HTTP / REST

Synchronous Problem

Underestimated
Network Layer

 
  • latency

  • complexity

  • debbuging

  • security

  • connectivity

 

Assume that there will be problems

 

You can't beat the nature of the network

"Occasionally connected apps" @gregyoung

 

Asynchronous HTTP

Messaging

Middleman

Push

What about pull ?

Distributed Data

 

Denormalized snapshot

of state per service

'Synchronous Consumer'

Monolithic App

Hidden

Disabled - Cached Data

Distributed
App

Scalability

CRITICAL

Reliability

CRITICAL

Bringing It Together

A brief history of one product

Cached data

Static Page

No Interaction

External System - Donation

External Dependancies

Introducing Message Bus

Be Pragmatic

Where do you need scalability?

Where do you need reliability?

One DB

to rule them all

 

Monolithic DB

  • business logic

  • complex reports

  • business transactions

First Iteration

... Single point of failure

Natural step from monolithic DB

 

  • data storage type bias

  • tightly coupled services

  • non-distributed data model

Maintaining existing requirements ...

Code structure follows data model

Distributed data model will encourage distributed code

What else then ?

Good Idea?

Database per service

Multiple Databases

problems

  • data aggregation

  • joins

  • transactions

  • increased maintenance

Pragmatism

start simple

  • table per service

  • schema per service

Be careful 

Monolithic DB habits

Other Team

Start Introducing

Slowly

  • Database per service

  • Database per product

  • Application Joins

Application Side Join

Underestimating

The Costs

 

 

Monolith

  • rented servers

  • prior experience

  • control

Distributed

New world

Cloud

Spending Control

Planned Downtime

Docker

Costs Monitoring

Custom build tools

Make cost control part of your deployment pipeline

Increased ops costs but ....

... decreased dev costs

... more agility

... faster time to market

 Summary

 

It is a learning process

Questions! :)

 

Thank you

@francmichal

www.mfranc.com

 

Micro Oslo

By Michal Franc