Top Banner
Modelling Microservices Petter Måhlén, Spoti petter@spoti .com May 2016
57

Modelling Microservices at Spotify - Petter Mahlen

Apr 13, 2017

Download

Technology

J On The Beach
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Modelling Microservices at Spotify - Petter Mahlen

Modelling Microservices

Petter Måhlén, Spotify [email protected]

May 2016

Page 2: Modelling Microservices at Spotify - Petter Mahlen

About meInfrastructure at Spotify since 2013

• Service Discovery (Nameless) • Service Framework (http://spotify.github.io/

apollo/) • System-Z • And some more

Page 3: Modelling Microservices at Spotify - Petter Mahlen

About this talk• Why model microservices? • Our solution: System-Z • Design • Learnings and Impact

=> Ideas about running microservices at scale

Page 4: Modelling Microservices at Spotify - Petter Mahlen

Why model microservices?

Z axis: ShardingY axis: Splitting

X axis: Cloning

http://artofscalability.com/

Page 5: Modelling Microservices at Spotify - Petter Mahlen

Why model microservices?

Z axis: ShardingY axis: Splitting

X axis: Cloning

http://artofscalability.com/

~14k servers

~1600 things

Page 6: Modelling Microservices at Spotify - Petter Mahlen

Why model microservices?

Z axis: ShardingY axis: Splitting

X axis: Cloning

http://artofscalability.com/

plus ~100 teamswriting code

~14k servers

~1600 things

Page 7: Modelling Microservices at Spotify - Petter Mahlen

Spotify Organisation

https://labs.spotify.com/2014/03/27/spotify-engineering-culture-part-1/

Page 8: Modelling Microservices at Spotify - Petter Mahlen

Problems to Solve

Discovering and understanding: • What things are “out there” • Deployments and configurations • The system as a whole, how do things fit together? • How to get more information: ownership • What’s broken and how to fix it.

Page 9: Modelling Microservices at Spotify - Petter Mahlen

What came before

Emil

Page 10: Modelling Microservices at Spotify - Petter Mahlen

What came before

Emil

ServiceDB

Page 11: Modelling Microservices at Spotify - Petter Mahlen

What came before

Emil

ServiceDB

System-Z

Page 12: Modelling Microservices at Spotify - Petter Mahlen

Enter System-Z

Page 13: Modelling Microservices at Spotify - Petter Mahlen

Some terminology

• Component - a thing • microservice • data store • data pipeline • client component

• System - some components

These terms, like most things Z, are intentionally vague

Page 14: Modelling Microservices at Spotify - Petter Mahlen

As anyone

Overviews of ‘everything’, e.g. • Container versions used

• 30, by 240 components • Various kinds of metrics

• 212 experimental components • 14 squads don’t indicate a slack channel

Page 15: Modelling Microservices at Spotify - Petter Mahlen

As anyone

Overviews of ‘everything’, e.g. • Container versions used

• 30, by 240 components • Various kinds of metrics

• 212 experimental components • 14 squads don’t indicate a slack channel

Page 16: Modelling Microservices at Spotify - Petter Mahlen

As anyone

Overviews of ‘everything’, e.g. • Container versions used

• 30, by 240 components • Various kinds of metrics

• 212 experimental components • 14 squads don’t indicate a slack channel

Page 17: Modelling Microservices at Spotify - Petter Mahlen

As anyone

Overviews of ‘everything’, e.g. • Container versions used

• 30, by 240 components • Various kinds of metrics

• 212 experimental components • 14 squads don’t indicate a slack channel

Page 18: Modelling Microservices at Spotify - Petter Mahlen

As a component user

For some component: • Figure out who owns it • Understand its API • See its state • Find documentation

Page 19: Modelling Microservices at Spotify - Petter Mahlen

As a component user

Page 20: Modelling Microservices at Spotify - Petter Mahlen

As a component user

Page 21: Modelling Microservices at Spotify - Petter Mahlen

As a component user

Page 22: Modelling Microservices at Spotify - Petter Mahlen

As a component user

Page 23: Modelling Microservices at Spotify - Petter Mahlen

As a component user

Page 24: Modelling Microservices at Spotify - Petter Mahlen

As an owner

• Understand deployment status/configuration • Provision servers • Managing deployments • Understand dependencies

Page 25: Modelling Microservices at Spotify - Petter Mahlen

As an owner

• Understand deployment status/configuration • Provision servers • Managing deployments • Understand dependencies

Page 26: Modelling Microservices at Spotify - Petter Mahlen

As an owner

• Understand deployment status/configuration • Provision servers • Managing deployments • Understand dependencies

Page 27: Modelling Microservices at Spotify - Petter Mahlen

As an owner

• Understand deployment status/configuration • Provision servers • Managing deployments • Understand dependencies

Page 28: Modelling Microservices at Spotify - Petter Mahlen

As an owner

• Understand deployment status/configuration • Provision servers • Managing deployments • Understand dependencies

Page 29: Modelling Microservices at Spotify - Petter Mahlen

As an owner

• Understand deployment status/configuration • Provision servers • Managing deployments • Understand dependencies

Page 30: Modelling Microservices at Spotify - Petter Mahlen

As an owner

• Understand deployment status/configuration • Provision servers • Managing deployments • Understand dependencies

Page 31: Modelling Microservices at Spotify - Petter Mahlen

As an owner

• Understand deployment status/configuration • Provision servers • Managing deployments • Understand dependencies

Page 32: Modelling Microservices at Spotify - Petter Mahlen

As an owner

• Understand deployment status/configuration • Provision servers • Managing deployments • Understand dependencies

Page 33: Modelling Microservices at Spotify - Petter Mahlen

As an owner

• Understand deployment status/configuration • Provision servers • Managing deployments • Understand dependencies

Page 34: Modelling Microservices at Spotify - Petter Mahlen

Dependency Maps

Page 35: Modelling Microservices at Spotify - Petter Mahlen

And...• Create new components • Configure routing between data centres • Check activity (logins, system updates, etc) • Set up service monitoring dashboards • Check historical build information • Configure data processing pipeline monitoring • Store miscellaneous component metadata • …

Page 36: Modelling Microservices at Spotify - Petter Mahlen

Core data model

• Many many-to-many relations • Features add specific data • Discovery names as

indirection

Page 37: Modelling Microservices at Spotify - Petter Mahlen

user2

user2

login

CALLERS

Page 38: Modelling Microservices at Spotify - Petter Mahlen

user2

user2

login

user3

attributes

create

CALLERS

Page 39: Modelling Microservices at Spotify - Petter Mahlen

user2

user2

login

user2-legacy

user3

attributes

create

CALLERS

Page 40: Modelling Microservices at Spotify - Petter Mahlen

user2

user2

login

user2-legacy

user2-

user3

attributes

create

CALLERS

Page 41: Modelling Microservices at Spotify - Petter Mahlen

user2

user2

login

user2-legacy

user2-

user3

attributes

create

CALLERS

Page 42: Modelling Microservices at Spotify - Petter Mahlen

user2

user2

login

user2-legacy

user2-

user3

attributes

create

CALLERS

Page 43: Modelling Microservices at Spotify - Petter Mahlen

user2

user2

login

user2-legacy

user2-

user3

attributes

createcreate

attributes

CALLERSuser3

Page 44: Modelling Microservices at Spotify - Petter Mahlen

user2

user2

login

user2-legacy

user2-

user3

attributes

createcreate

attributes

CALLERSuser3

Page 45: Modelling Microservices at Spotify - Petter Mahlen

user2

user2

login

user2-legacy

user2-

user3

attributes

createcreate

attributes

CALLERSuser3

Page 46: Modelling Microservices at Spotify - Petter Mahlen

user2

login user2-

user3

attributes

createcreate

attributes

CALLERSuser3

Page 47: Modelling Microservices at Spotify - Petter Mahlen

user2

login user2-

user3

attributes

createcreate

attributes

CALLERSuser3

Page 48: Modelling Microservices at Spotify - Petter Mahlen

user3

attributes

createcreate

attributes

CALLERSuser3

Page 49: Modelling Microservices at Spotify - Petter Mahlen

Frontend

Backend

UI Platform

Base Capacity Deployment

Cortana Helios

Sysmodel

RDCSquab BargeServerDB

Git repos

Page 50: Modelling Microservices at Spotify - Petter Mahlen

YAML files

• Loose/multiple schemas • Files live with code

Page 51: Modelling Microservices at Spotify - Petter Mahlen

Dirty Data• Organisational change => ownership confusion • Infrastructure evolution => runtime confusion • Owners don’t benefit from metadata quality

Page 52: Modelling Microservices at Spotify - Petter Mahlen
Page 53: Modelling Microservices at Spotify - Petter Mahlen

Usage

Page 54: Modelling Microservices at Spotify - Petter Mahlen

What users say• The administration panel of the entire Spotify

backend. • Cthulhu • The IO product to rule them all! • Hydra-headed • Kickin rad. • A source of truth to discover services and libraries

at Spotify • A service without a definition of done.

Page 55: Modelling Microservices at Spotify - Petter Mahlen

Impact

• Teams integrating features, making them easier to find

• Teams talking about features => more consistent • System-Z mentioned as ‘great’ in 2016 ‘What

sucks’ • Swiss Army Knife (good?)

Page 56: Modelling Microservices at Spotify - Petter Mahlen

Conclusions• Microservices => many small things, big picture is

hard • Metadata about microservices helps understand

the system • Our metadata is dirty; this is probably unavoidable • Combining many tools => better collaboration and

consistency • The metadata is useful in different ways for

different users

Page 57: Modelling Microservices at Spotify - Petter Mahlen

Questions?