Slide 1

Slide 1 text

THE ROCKY ROAD FROM MONOLITHIC TO MICROSERVICES ARCHITECTURE

Slide 2

Slide 2 text

THE ROCKY ROAD FROM MONOLITHIC TO MICROSERVICES ARCHITECTURE

Slide 3

Slide 3 text

SRINIVASAN RANGARAJAN Head of Product Engineering

Slide 4

Slide 4 text

SRINIVASAN RANGARAJAN https://cnu.name Twitter: @cnu Github: @cnu

Slide 5

Slide 5 text

RETAIL AUTOMATION PRODUCT

Slide 6

Slide 6 text

Catalog & User Events Processing Recommendation

Slide 7

Slide 7 text

MONOLITHIC ARCHITECTURE

Slide 8

Slide 8 text

MONOLITHIC ARCHITECTURE Image Processing API Image Searcher File Storage

Slide 9

Slide 9 text

MINIMUM TWO SERVERS BEHIND ELB Load Balancer

Slide 10

Slide 10 text

CLOUD VS BARE METAL

Slide 11

Slide 11 text

EXPENSIVE

Slide 12

Slide 12 text

NOT REALTIME

Slide 13

Slide 13 text

NOT PERSONALIZABLE

Slide 14

Slide 14 text

API Data Store Ingestion Image Processing Image Searcher User Event Personalization Engine

Slide 15

Slide 15 text

GOTHAM

Slide 16

Slide 16 text

API Data Store Ingestion Image Processing Image Searcher User Event Personalization Engine

Slide 17

Slide 17 text

JOKER • Convert client’s catalog into one common MAD Format • Normalization of fields and metadata • Can process batch and streaming data • Major cause of chaos in the system

Slide 18

Slide 18 text

GORDON • Routes the product metadata to the right micro services • Is it a new product? or update to an existing product? • Streaming data from AWS SQS

Slide 19

Slide 19 text

WONDER WOMAN • Not a microservice, But a tool used to generate rules for the catalog • Rules are send to the Image Processing microservice • Works on Samples of data and not entire dataset

Slide 20

Slide 20 text

WATCHTOWER • Central Source of Truth for all metadata • Backed by an RDBMS Database (Postgresql) • Input via SQS and REST API • Output via REST API

Slide 21

Slide 21 text

INGESTION Gordon Joker Joker Joker Wonder Woman Watchtower Next Stage

Slide 22

Slide 22 text

API Data Store Ingestion Image Processing Image Searcher User Event Personalization Engine

Slide 23

Slide 23 text

NIGHTWING • Computer Vision and Deep Learning Models • Convert Image to high dimensional vectors • Tag image with visual attributes • Computer Intensive

Slide 24

Slide 24 text

API Data Store Ingestion Image Processing Image Searcher User Event Personalization Engine

Slide 25

Slide 25 text

BATMAN • Custom very fast Vector Indexer and Search Engine • Stores everything in memory • Two sub-parts: Indexer and Searcher • Store binary information about image in DynamoDB

Slide 26

Slide 26 text

API Data Store Ingestion Image Processing Image Searcher User Event Personalization Engine

Slide 27

Slide 27 text

SUPERMAN • User behaviour based recommendation • Multiple products like Collaborative filtering, Cross Product recommendation • Records every user event data and stores in a data warehouse

Slide 28

Slide 28 text

TWO FACE • Individual User level Personalization • Shows a different “face” to each user • Dynamic and realtime

Slide 29

Slide 29 text

API Data Store Ingestion Image Processing Image Searcher User Event Personalization Engine

Slide 30

Slide 30 text

FLASH • Very fast data structure storage - redis instance • User session level history, Product Availability, etc. • Fast access, but non- expirable

Slide 31

Slide 31 text

GCPD • “Global Cache for Products Digested” • Rough first level of cache for the results

Slide 32

Slide 32 text

API Data Store Ingestion Image Processing Image Searcher User Event Personalization Engine

Slide 33

Slide 33 text

ROBIN • API Gateway for all our products • Combines data from other micro services like Batman, Two Face, Watchtower, Superman, etc and returns JSON Response

Slide 34

Slide 34 text

API Data Store Ingestion Image Processing Image Searcher User Event Personalization Engine Joker, Gordon, Wonder Woman Nightwing Batman Robin Watchtower, GCPD, Flash Superman, Two Face

Slide 35

Slide 35 text

LESSONS WE LEARNT

Slide 36

Slide 36 text

START WITH A MONOLITH. CHIP OFF PIECES AND BUILD THE MICROSERVICES. Lesson 0

Slide 37

Slide 37 text

–Melvin Conway “… organizations which design systems ... are constrained to produce designs which are copies of the communication structures of these organizations."

Slide 38

Slide 38 text

DEPLOY HETEROGENOUS MICROSERVICES IN A SINGLE SERVER Lesson 1

Slide 39

Slide 39 text

Compute Optimized Server Memory Optimized Server Nightwing Batman Robin Robin Robin Joker Joker Joker Gordon Watch tower Watch tower Joker

Slide 40

Slide 40 text

IMMUTABLE MICROSERVICES Lesson 2

Slide 41

Slide 41 text

Constable Inspector Assistant Commissioner Commissioner

Slide 42

Slide 42 text

ASYNCHRONOUS IS BETTER THAN SYNCHRONOUS Lesson 3

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

NOT ALL MICROSERVICES NEED TO BE SERVERS Lesson 4

Slide 45

Slide 45 text

ADD REQUEST ID OR TRANSACTION ID TO DEBUG EASILY Lesson 5

Slide 46

Slide 46 text

GIVE A CHARACTER TO YOUR MICROSERVICES Lesson 6

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

THANK YOU

Slide 49

Slide 49 text

http://cnu.name/talks/ @cnu