51

The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different
Page 2: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

The Microservices journey from a startup

perspective

Susanne KaiserCTO

@suksr

Just Software@JustSocialApps

Page 3: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Each journey is different

Large organization You as a startup

Resources perspective

Page 4: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different
Page 5: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

The beginning … A monolith in every aspect

One team

One collaboration product

One technologystack

Single unit

Page 6: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

After an evolving while …

Productivity suffered

Usability and UX suffered

New features released slowly

Page 7: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

JUST PAGESocial Network

JUST CONNECTReal-time collaboration

JUST DRIVEDocument Sharing

JUST TASKSTask Management

Separate Collaboration Apps

Page 8: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Small, autonomous teams with well-defined responsibilities

JUST PAGESocial Network

JUST CONNECTReal-time collaboration

JUST DRIVEDocument Sharing

JUST TASKSTask Management

Page 9: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

In the long run ...

Page 10: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Looks easy at first glance ...

Page 11: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Microservices come with complexity

Design for FailureMonitoring Deployment

Debugging

Testing

Eventual consistencySkillset is different

Authentication & Authorization

Development environment

Page 12: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Challenges of transformation

Transformation takes longer than anticipated

You still have to take care of your

existing system

Core functionalityis hard to untangle

All involved parties need toagree and to be on board

Page 13: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Our Motivation

● Product and organizational/culture driven● Enabling autonomous teams

with well-defined responsibilities● Develop and deploy independently

to release changes quickly

Page 14: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

How to start?

?

?

? ?

Page 15: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Transformation process

Establish Microservices ecosystem

Identify candidatesDecompose candidates

Page 16: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Transformation process

Identify candidates

Page 17: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Key concepts of modelling Microservices

High cohesion within a service

Loose coupling between services

Page 18: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Identify Bounded Contexts

Well defined business function

Page 19: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Bounded Contexts = Collaboration Apps

Monolith

Page 20: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Transformation process

Decompose candidates

Page 21: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

First approach as a co-existing service

JUST DRIVE

JUST DRIVE

JUST LIST

JUST CONNECT

JUST PAGE

DB Adapter

REST API

Web App

DB Adapter

MessageBroker

Monolith

Page 22: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Heavy undertake if you do all at once

More features

New UI

New data structure

Maintain & runcurrent system

Page 23: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Split in steps – e.g. top down

Page 24: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Split in steps – e.g. top down

DB Adapter

Web Client

Browser

Monolith

Page 25: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Split in steps – Step 1) Extracting Web App

Business Logic

DB Adapter

Web Client

Browser

Web Client Web AppMonolith

Page 26: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Split in steps – Step 2) Extracting Business Logic

Business Logic

DB Adapter

Web Client

Browser

Business Logic

DB Adapter

REST API

Web App

Monolith

Page 27: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Split in steps – Step 3) Extracting Data Storage

Business Logic

DB Adapter

Web Client

Browser

Business Logic

DB Adapter

REST API

Web App

Monolith

REST API

Message Broker

Page 28: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Which one first?

Easy to extract Changing frequently

Different resource requirements

Page 29: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Stop feeding the monolith

Monolith

Page 30: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Transformation process

Establish Microservices ecosystem

Page 31: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Direct access over public internet problematicMicroservicesMonolith

● Exposing internal API● CORS required● Multiple roundtrips● Different clients have different needs

User Interface

Business Logic

Data Access Layer

Microservice Microservice

MicroserviceMicroservice

User Interface

Page 32: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

API-Gateway provides simplified access for client

User Interface

Business Logic

Data Access Layer

User Interface

API Gateway

Microservice Microservice

MicroserviceMicroservice

Page 33: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Microservices ecosystem with ...

Spring Cloud & Netflix OSS

Page 34: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Security: Auth-Server with API-Gateway as Token Relay

User Interface

Business Logic

Data Access Layer

Authorization ServerOAuth2

Microservice

MicroserviceMicroservice

User Interface

API Gateway

auth

Access Token Access Token

Access Token

OAuth2 Token Relay

Access Token

/check_token/userinfo

Page 35: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Security: Auth-Server with API-Gateway as Token Translation

Authorization ServerOAuth2

Microservice

MicroserviceMicroservice

User Interface

API Gateway

Access Token JWT Token

JWT Token

Token Translation

Access Token

JWT Token

JWT Token

Page 36: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Service-Discovery

Service DiscoveryService Discovery

Microservice Microservice

1.) Register 2.) Discover

3.) Connect

Page 37: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Service Discovery

Microservice 1 Microservice 2

1.) Register 2.) Discover

3.) Connect

@EnableEurekaServer

@EnableDiscoveryClient

Service-Discovery w/ Spring Cloud & Eureka@Configurationpublic class MyConfiguration { @LoadBalanced @Bean RestTemplate restTemplate() { return new RestTemplate(); }}

public class MicroserviceTwo { @Autowired private RestTemplate restTemplate; public String doOtherStuff() { String results = restTemplate .getForObject( "http://microservice-one/stuff", String.class); return results; }}

service id

Page 38: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Client-side Loadbalancing

Service Instance 1

Service Instance 2

Service Instance 3

Page 39: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Dynamic client-side Loadbalancing w/ Ribbon

Load Balancer Ribbon

1.) Register 2.) Obtain server list

3.) Loadbalance

Service Discovery (Eureka)

Page 40: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Design for Failure

Timeout-Handling

Circuit Breakers Provide fallbacks

Page 41: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Design for Failure w/ Hystrix

Circuit Breaker

Monitors remote call

Fallback (e.g. cached values, default values)

Fallback (fail-silent) or Exception (fail-fast)

define

returns

Microservice 2

Microservice 1

Microservice 2

Microservice 1

Page 42: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Design for Failure w/ Hystrix

public class MicroserviceTwo { @Autowired private RestTemplate restTemplate;

@HystrixCommand(fallbackMethod = "defaultValues") public String doOtherStuff() { String results = restTemplate .getForObject( "http://microservice-one/stuff", String.class); return results; }

public String defaultValues() { ... }}

@EnableCircuitBreaker@Configurationpublic class MyConfiguration { @LoadBalanced @Bean RestTemplate restTemplate() { return new RestTemplate(); }}

-Dsun.net.client.defaultConnectTimeout=TimeoutInMiliSec -Dsun.net.client.defaultReadTimeout=TimeoutInMiliSec

Timeout Setting (e.g. startup params)

Monitors remote call

Fallback (e.g. cached values, default values)

define

Microservice 2Microservice 1

Page 43: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Monitoring w/ Hystrix Dashboard & Turbine

Source: http://www.programering.com/a/MDN3gzNwATE.html

Page 44: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Current ecosystem so far ...

Auth ServerOAuth2

Microservice

MicroserviceMicroservice

User Interface

API Gateway

Microservice

Service Discovery

MonitoringDashboard

Circuit Breaker

Load Balancer

Page 45: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Auth ServerOAuth2

Microservice

MicroserviceMicroservice

User Interface

API Gateway

Microservice

Service Discovery

MonitoringDashboard

Configuration Management

Logging AnalysesDashboard

A lot to cover to establish a Microservices ecosystem

Build process, CI/CD-pipeline, testing, development environment

Circuit Breaker

Load Balancer

Page 46: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Lessons learned● Starting with decomposing big chunks frustrates● Establishing Microservices ecosystem takes time and requires

different skills & tools ● No explicit infrastructure team slows down the process● A holistic picture of target architecture helps to stay focussed● It takes far longer than originally anticipated

Page 47: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

Summary

Establish teams for Microservices & infrastructure

Start small & split in manageable steps

Transformation can be handled even withlimited resources

Define a target architecture

Page 48: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

*) Quarter of Hamburg, famous for its soccer club & entertainment district :)

*

Page 49: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

… AND W/ MICROSERVISES !

Page 50: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different

THANK YOU!Susanne Kaiser

CTO@suksr

Just Software@JustSocialApps

Page 51: The Microservices journey from a startup€¦ · The Microservices journey from a startup perspective Susanne Kaiser CTO @suksr Just Software @JustSocialApps. Each journey is different