microservices and devops journey at wix...microservice is owned by a team you build it –you run it...

65
@aviranm Aviran Mordo Head of Microservices and DevOps Journey at Wix.com www.linkedin.com/in/aviran @aviranm http://www.aviransplace.com

Upload: others

Post on 02-Jun-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Aviran Mordo

Head of

Microservices and DevOps

Journey at Wix.com

www.linkedin.com/in/aviran

@aviranm

http://www.aviransplace.com

Page 2: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Page 3: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Wix In Numbers

Over 80M users

Static storage is >2Pb of data

3 data centers + 3 clouds (Google, Amazon, Azure)

2B HTTP requests/day

1000 people work at Wix

Page 4: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Over 200 Microservices on Production

Page 5: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Microservices - What Does it Take

Page 6: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

How to Get There? (Wix’s journey)

http://gpstrackit.com/wp-content/uploads/2013/11/VanishingPointwRoadSigns.jpg

Page 7: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranmhttp://p1.pichost.me/i/11/1339236.jpg

About 5 years ago

Page 8: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

The Monolithic Giant

One monolithic server that handled everything

Dependency between features

Changes in unrelated areas caused deployment of the whole system

Failure in unrelated areas will cause system wide downtime

Lighttpd

(file serving) MySQL

DB

Wix

(Tomcat)

Page 9: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Breaking the System Apart

https://upload.wikimedia.org/wikipedia/commons/6/67/Broken_glass.jpg

Page 10: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Page 11: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Concerns and SLA

Many feature request

Lower performance requirement

Lower availability requirement

Write intensive

Edit websites

Not many product changes

High performance

High availability

Read intensive

View sites, created by Wix editor

Page 12: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Mono-Wix

Phase 1

Page 13: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Extract Public Service

Editor service (Mono-Wix) Public service

Page 14: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Divide and Conquer

Editor service Public service

Guideline: No runtime, deployment or data dependency

Page 15: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Separation by Product Lifecycle

Decouple architecture => Decouple teams

Deployment independence

Areas with frequent changes

Editor service Public service

Page 16: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Separation by Service Level

Scale independently

Use different data store

Optimize data per use case (Read vs Write)

Run on different datacenters / clouds / zones

System resiliency (degradation of service vs. downtime)

Faster recovery time

Editor service Public service

Page 17: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranmhttp://blogs.adobe.com/captivate/2011/03/training-adding-interactivity-to-elearning-courses-with-adobe-captivate-5.html/time-to-learn-clock

Page 18: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Service Boundary

Page 19: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Separation of Databases

Copy data between segments

Optimize data per use case (read vs. write intensive)

Different data stores

Public serviceEditor service

Copy necessary data

Page 20: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Serialization

Page 21: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Serialization / Protocol

Binary?

JSON / XML / Text?

HTTP?

Public serviceEditor service

Page 22: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Serialization / Protocol - Tradeoffs

Readability?

Performance?

Debug?

Tools?

Monitoring?

Dependency?

Public serviceEditor service

Page 23: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

API Transport/Protocol

Page 24: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

How to Expose an API

REST?

RPC?

SOAP?

Public serviceEditor service

Page 25: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Wix’s ChoicesREST

HTTP

Public serviceEditor service

Binary

JSON-RPC

HTTP

Page 26: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

API Versioning

Page 27: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

API Versioning

Public serviceEditor service

Backward compatibility

Maybe here

API Schema /v1/v2

Page 28: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

A-Synchronous

Page 29: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Which Queuing System to Use

Public serviceEditor serviceThreads

Kafka?

RabbitMQ?

ActiveMQ?

???

Page 30: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Service Discovery

Page 31: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Service Discovery

Public serviceEditor serviceConfiguration (DNS+LB)

Zookeeper?

Consul?

Etcd?

Eureka?

Page 32: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Resilience

Page 33: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

What does the Arrow Mean?

Public serviceEditor service

Page 34: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Failure Points = Network I/O

Public serviceEditor service

Retry policy

Circuit breaker

Throttlers Be careful – you may cause downtime

Retry only on idempotent operations

Page 35: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Degradation of Service

Public serviceEditor service

Feature killer (Killer feature)

Fallbacks

Self healing

Page 36: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Testing

Page 37: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Test a Distributed System (at Wix)

Public serviceEditor service

Unit Test

Integration Test

Server E2E

AutomationClient

Page 38: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Distributed Logging

Page 39: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Build visibility into service

Page 40: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Ownership

Page 41: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Team Work

Microservice is owned by a team

You build it – you run it

No microservice is left without a clear owner

Microservice is NOT a library – it is a live production

system

Page 42: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

What is the Right Size of a

Microservice?

Page 43: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

The Size of a Microservice is the Size

of the Team That is Building it.

“Organizations which design systems ... are

constrained to produce designs which are copies of the

communication structures of these organizations”

Conway, Melvin

Page 44: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

What did you Learn from Just 2 Services

● Service boundary

● Monitoring infrastructure

● Serialization format

● Synchronous communication protocol (HTTP/Binary)

● Asynchronous (queuing infra)

● Service SLA

● API definition (REST/ RPC / Versioning)

● Data separation

● Deployment strategy

● Testing infrastructure (integration test, e2e test)

● Compatibility (backwards / forward)

Page 45: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Continue to Extract More Microservices

Page 46: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

HTML

Editor

Flash

Editor

MSM

Private

Media

Public

Media

Editor Segment Public Segment

Premium

Services

List DB

App

Builder

App

Store

App

Market

Dashboard

Mailer

TimeZone

Public

HTML API

Public API

(Flash)

MSP

Public

Server

HTML

Renderer

HTML SEO

Renderer

Flash

Renderer

Flash SEO

Renderer

Sitemap

Renderer

Robots.txt

Renderer

User

Server

Template

Viewer

ContactsHUBActivity

Site

MembersStore Mgr

Comments

Snapshoter

User Pref

Feed Me

Shout-out Hotels

PETRI

Site Pref

Dist LoggerSlicer

eCom

Renderer

eCom Cart

eCom

Checkout

eCom

Catalog

eCom

Orders

Payment

Facade

Account Info

HTML API

HTML

Embeder

BlogMobile

Mostly writes

2 Data centers

Db active-standby (preferably active-active)

Performance < 2s 99%

Serves mostly site builders

Uptime > 99.9

Mostly reads

>2 Data centers

Db active-active-active

Performance < 500ms 99%

Serves mostly site viewers

Uptime > 99.99

Page 47: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

When to Extract a New Microservice

Page 48: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Microservice or Library?

Do I create deployment dependency?

What is DevOps overhead ?

Who owns it?

Does it have its own development lifecycle?

Does it fit the scalability / availability concerns?

Can a different team develop it?

I need time zone from an IP address

Page 49: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Microservice has Ops, Library is Only

Computational

Page 50: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Which Technology Stack to Use

Page 51: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Free to Chose?

Microservices gives the freedom to use a different

technology stacks.

Enables innovation

Page 52: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Default to the Stack You Know how to

Operate.

Page 53: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Innovate on Non Critical Microservices and Take Full

Responsibility for its Operation.

Page 54: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Polyglotic System?

Page 55: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Limit your Stack

Code reuse

Cross cutting concerns (session, security, auditing, testing,

logging…)

Faster system evolution

Development velocity

Page 56: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranmhttp://wallpaperbeta.com/dogs_kiss_noses_animals_hd-wallpaper-242054/

Page 57: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

What else will you learn

● Distributed transactions

● System monitoring

● Distributed traces

● Tradeoff of a new microservice vs. extending an existing one

● Deployment strategy and dependency

● Handling cascading failures

● Team building/splitting

Page 58: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Summary

Page 59: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Microservices is the First Post DevOps

Architecture

Page 60: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Every Microservice is a

Overhead

Page 61: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

It is all about trade-off

Page 62: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Microservices Guidelines & TradeoffsEach service has its own DB schema (if one is needed)

Gain - Easy to scale microservices based on service level concerns

Tradeoff – system complexity, performance

Only one service should write to a specific DB table(s)

Gain - Decoupling architecture – faster development

Tradeoff – system complexity / performance

May have additional read-only services that accesses the DB

Gain - Performance gain

Tradeoff - coupling

Services are stateless

Gain - Easy to scale out (just add more servers)

Tradeoff - performance / consistency

Page 63: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Page 64: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Thank You

Page 65: Microservices and DevOps Journey at Wix...Microservice is owned by a team You build it –you run it No microservice is left without a clear owner Microservice is NOT a library –it

@aviranm

Q&A@aviranm

http://www.aviransplace.com

www.linkedin.com/in/aviranAviran Mordo

Head of Engineering

http://goo.gl/32xOTt

http://engineering.wix.com

@WixEng