A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with...

33
A competitive food retail architecture with microservices A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum Köln

Transcript of A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with...

Page 1: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

A competitive food retail architecture with microservicesA five year journey with microservices

Sebastian GauderSoftware Architect eCommerce

@rattakresch

11.02.2019 ObjektForum Köln

Page 2: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

Our history

Page 3: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

3

Details REWE GROUPTurnover

>57 bn

History

>90 years

Employees

>345.000

InudstriesFood Retail,

Tourism, DIY

Shops

>15.000

Page 4: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

Our history (Spoiler alert)

Page 5: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

Our history

2014

40 15

100 28

200

46

2015 2016 2017

# Services

# Dev Teams

1 2

2018

270

48

Page 6: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

Organization and Architecture at Rewe Digital

Domain Subdomain Bounded Context

Tribe Squad Team

Platform Service

Is modelledas

Consists of

Consistsof

1 N 1 N

1 N

Consistsof

1 N

Consists of

1 N

1

1

1

1

N

1

Builds Builds

1

NImplementsFulfills requirements

of

1

1

Is responsiblefor

Page 7: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

How to scale monoliths?

Page 8: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

Design Goals

Vertical Boundaries

Decentralization

Page 9: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

“Any organization that designs a system (defined broadly) will produce a design whose structure is a copy of the

organization's communication structure.”

Melvin Conway (1967)

Conway’s law

Page 10: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

How to organize teams to build a scalable system?Functional and vertical teams

Page 11: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

How to determine boundaries?

Page 12: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

Customer journey defines subdomains

Page 13: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

How to guide developers?

Page 14: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

Design Goals- Vertical boundaries

- Decentralization

Architectural principles- Collection of 9 basic ‘laws’

- Autonomy, Automation and Communication

Guides- Practical manual for common tasks (RFC 2119)

- e.g. Eventing, REST, Authentication

Guarding rails for developers

MUSTSHOULDCOULD

Page 15: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

autonomy

Page 16: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

Autonomy principlesDeploy independentlyEnsure that the services can and are deployed by the teams themselves.

Isolate failureMake the services as resilient as possible.

Hide implementation DetailsDifferent verticals must not share state. Verticals hide their implementation details.

Encapsulate Data StorageFor any data resource exactly one service is responsible. If possible, the data supply should proceed asynchronously in the background

Page 17: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

Autonomous Teams - challenge for product owners as they have to rethink their features

- they might have to reduce the scope

- split the original feature into smaller ones for each team / bounded context

Data-integration pattern- Change your service behavior depending on the data you have to display

- Enable others to deliver functionality later

Evolving Implementations- Start with a fitting but simple solution and get better by every team implementing it

Challenges

Page 18: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

Autonomy opens your tech stacks

Page 19: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

automation

Page 20: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

Automation principles

Be ScalableServices are scaled horizontally

Embrace a Culture of AutomationTest, deployment and operations are completely automated

Be Highly ObservableUse of semantic monitoring to see if the whole platform works correctly.

Page 21: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

communication

Page 22: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

Communication principles

Follow REST PrinciplesThe API of a service follows the RESTful paradigm (REST maturity level 2)

Standardize Service communicationInter-service communication is standardized and if possible asynchronous

Page 23: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

Problems in HTTP/REST-only architectures

Gateway

µService 1

µService 2

µService 5µService 4

Things that help:

● Timeouts

● Fallbacks

● Circuit Breakers

● EventingµService 3

Page 24: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

Asynchronous > Synchronous- Have as much needed data locally as possible ->

resilience at request time

- Duplication of data is accepted and wanted

- Problem of eventual consistency

Communication in microservice worldsHaving data is better than fetching data

Page 25: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

Eventing with Apache Kafka● Eventing != Messaging

○ Publish events that already happened

○ One owning service per queue/topic

○ Autonomy at request time

● Complete entities - not deltas

○ Transactional completeness

○ Allows log compaction

● Re-writing and Re-reading

○ needed in case of additional data

○ useful in case of data loss

Page 26: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

Eventing is an API as well- Events have to behave like APIs and avoid breaking changes.

Writing APIs is hard- Teams tend to write APIs for special clients (e.g. mobile apps)

- New clients often don’t match and require API changes

Breaking changes require a strict procedure- Could be solved by new endpoints, new topics

Lessons learned with microservice APIs

Page 27: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

How to access?

Page 28: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

Usage of API gateways as entry pointsHow to access Microservices?

Page 29: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

Dynamic frontend compositionHow UIs in microservice architectures should be composed

Page 30: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

Dynamic UI composition with DUCWhere does my UI come from?

Page 31: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

Git Project: rewe-digital/integration-patterns

https://git.io/vA2MY

Page 32: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

Thank youQuestions ?

Page 33: A five year journey with microservices 11.02.2019 ... 02.11.2019  · A five year journey with microservices Sebastian Gauder Software Architect eCommerce @rattakresch 11.02.2019 ObjektForum

A competitive food retail architecture with microservicesA five year journey with microservices

Sebastian GauderSoftware Architect eCommerce

@rattakresch

11.02.2019 ObjektForum Köln