Microservices Lessons Learned From a Startup Perspective Susanne - - PowerPoint PPT Presentation

microservices lessons learned from a startup perspective
SMART_READER_LITE
LIVE PREVIEW

Microservices Lessons Learned From a Startup Perspective Susanne - - PowerPoint PPT Presentation

Microservices Lessons Learned From a Startup Perspective Susanne Kaiser @suksr CTO at Just Software @JustSocialApps Each journey is different People try to copy Netflix, but they can only copy what they see. They copy the results, not


slide-1
SLIDE 1

Microservices Lessons Learned From a Startup Perspective

Susanne Kaiser @suksr CTO at Just Software @JustSocialApps

slide-2
SLIDE 2

Each journey is different

“People try to copy Netflix, but they can only copy what they see. They copy the results, not the process.”

Adrian Cockcroft, AWS VP Cloud Archtitect, former Netflix Chief Cloud Architect

slide-3
SLIDE 3

Affecting Circumstances

Team

  • Size
  • Skillset
  • Structure

Legacy-System

  • Maintenance effort
  • Environment

Strategy

  • New Features
  • Timeline/Milestones
slide-4
SLIDE 4

Background

JUST PAGE

Social Network

JUST CONNECT

Real-time collaboration

JUST DRIVE

Document Sharing

JUST TASKS

Task Management

JUST PEOPLE

User Management

slide-5
SLIDE 5

Background

One team One collaboration product One technology stack

Single Unit

At The Beginning … A Monolith In Every Aspect

slide-6
SLIDE 6

Productivity suffered Usability and UX suffered New features released slowly

Background

After An Evolving Time ...

slide-7
SLIDE 7

Background

JUST PAGE

Social Network

JUST CONNECT

Real-time collaboration

JUST DRIVE

Document Sharing

JUST TASKS

Task Management

JUST PEOPLE

User Management

Separate Collaboration Apps

slide-8
SLIDE 8

Background

JUST PAGE

Social Network

JUST CONNECT

Real-time collaboration

JUST DRIVE

Document Sharing

JUST TASKS

Task Management

Small, Autonomous Teams

JUST PEOPLE

User Management

With well-defined responsibilities

slide-9
SLIDE 9

Background

Product Organization Software architecture

In The Long Run ...

slide-10
SLIDE 10

Straightforward Process?

Start End

slide-11
SLIDE 11

No Straightforward Process!

Start

Theory Reality

Start End

slide-12
SLIDE 12

First Approach As Co-Existing Service

JUST DRIVE

JUST DRIVE JUST LIST JUST CONNECT JUST PAGE DB Adapter REST API Web App DB Adapter

 

 Message Broker

M e s s a g e B r

  • k

e r A d a p t e r Message Broker Adapter

slide-13
SLIDE 13

Lesson #1: Too Many Steps At Once Slow You Down

More features New UI New data structure Maintain & run current system Timelines

slide-14
SLIDE 14

Start With One Manageable Step At A Time

Easy to extract Changing frequently Different resource requirements Split in steps, e.g. top/down

slide-15
SLIDE 15

Lesson #2: Deferring Solving Authz Handling Hurts

I have a new service that needs authorization. Where is the authz service I could use? Not there, yet. Sorry! Ok, than I am putting my code to the place where authz handling exists … to the monolith.

Feeding the monolith

I have a new service that needs authorization. Where is the authz service I could use? Not there, yet. Sorry! Ok, than I am implementing authz in my local service.

Re-implementing authz w/ every service

slide-16
SLIDE 16

Lesson #2: Deferring Solving Authz Handling Hurts

Solve Authz Handling Early!

slide-17
SLIDE 17

Lesson #3: Less Aligned Strategy Is Expensive

Separate Apps Separate Teams Separate Services Bundled Deployment

slide-18
SLIDE 18

Lesson #4: Data Related Overhead

Setup Maintain Setup Setup Maintain Keep in sync

slide-19
SLIDE 19

Lesson #4: Data Related Overhead

Streams

slide-20
SLIDE 20

How To Interact Between Services?

Request-Driven Event-Driven

command query produce consume Event-Stream

Hybrid

produce consume command/query Event-Stream

slide-21
SLIDE 21

How To Manage Data?

Profile Service Document Service Task Service

Hybrid Model

REST getProfile(ProfileId) Remote query directly to source Event stream purely for notifications

slide-22
SLIDE 22

How To Manage Data?

Profile Service Document Service Task Service

Event-Driven State Transfer

ProfileUpdated Event Local copy/cache

slide-23
SLIDE 23

How To Manage Data?

Source Of Truth

Database Events

“Traditional” Event-Driven System

slide-24
SLIDE 24

How To Manage Data?

Multiple Sources Of Truth

Database Events

Internal source of truth External source of truth Dual writes

“Traditional” Event-Driven System

slide-25
SLIDE 25

How To Manage Data?

Multiple Sources Of Truth

Database Events

Internal source of truth External source of truth Dual writes

“Traditional” Event-Driven System Event Sourcing

Derive state from events

Event-Store

Single Source Of Truth

Events as first-class entities

slide-26
SLIDE 26

Apache Kafka

P0 P1 P2 P3

1 2 3 1 2 1 2 3 1 2 3

Consumer Topic Consumer Consumer Consumer Consumer Consumer Group Consumer Group Producer

Each partition is assigned to one consumer within a consumer group Immutable, ordered sequence of records per partition Each consumer controls its position per partition (offset)

writes reads

Each consumer subscribes to a topic

Consumer

slide-27
SLIDE 27

Apache Kafka

P0 P1 P2 P3

1 2 3 1 2 1 2 3 1 2 3

Consumer Topic Consumer Consumer Consumer Consumer Consumer Group Consumer Group Producer writes reads

Scalable Fault-tolerant

Node/Broker

  • Data stored to disk
  • Replicated partitions
  • Consumer conrols its offset
  • Topic can be scaled out

to several nodes

  • Messages load-balanced

between consumer of one group

  • Add partitions for more parallelism
  • Adding capacity with 0 downtime

Fast

  • O(1) to append messages
  • LinkedIn 2016:

1.4 trillion messages/day across over 1400 brokers Consumer

slide-28
SLIDE 28

Apache Kafka Combines ...

Messaging System Storage System Streaming Platform

slide-29
SLIDE 29

Primary Use Cases Of Streaming Platforms

Stream Processing Data Integration

Source Sink

slide-30
SLIDE 30

Kafka Streams

Topic

Unbounded, ordered sequence Key/value-pair Continuously updating

slide-31
SLIDE 31

Kafka Streams

Topic Service State Store (disk backed) Running in the process of Microservice Loads topic on startup Streams can be:

  • Joined
  • Filtered
  • Grouped
  • Aggregated
  • etc.

Streams make data available wherever it’s needed

slide-32
SLIDE 32

Kafka Streams For Materialized Views

Document Topic Profile Topic Document Service

A P I

Table for enrichment Stream Matererialized View as State Store Stream-Table-Join

slide-33
SLIDE 33

Low Barrier To Entry For New Service

  • No separate data storage to set up
  • No extra local copies / caches to set up and to keep in sync
  • No remote calls
  • Materialized View always up to date
  • Scalable, fault-tolerant, fast

=> reducing overhead, increasing performance & autonomy

slide-34
SLIDE 34

If We Could Start The Journey Again ...

  • Start with one manageable step at a time
  • Take care of Authorization handling early
  • Align strategy w/ Microservices goals
  • Using Kafka Streams for Materialized Views
slide-35
SLIDE 35

THANK YOU!

Susanne Kaiser @suksr CTO at Just Software @JustSocialApps