Slide 1

Slide 1 text

Monolith to Event-Driven Microservices Eko Kurniawan Khannedy

Slide 2

Slide 2 text

Eko Kurniawan ● Senior Principal R&D Engineer at Blibli.com ● 10 Years of Experience in IT Industry ● Software Architect behind: ○ Blibli.com New Backend System ○ Blipay

Slide 3

Slide 3 text

Agenda ● Microservices ● Event-Driven Architecture ● Hands-On using Java

Slide 4

Slide 4 text

Microservices

Slide 5

Slide 5 text

Monolith vs Microservices Application Monolith Microservices

Slide 6

Slide 6 text

Monolith vs Microservices Deployment Monolith Microservices

Slide 7

Slide 7 text

Characteristic of Microservices 1. Componentization via Services 2. Organized around Business Capabilities 3. Products not Projects 4. Smart endpoints and dumb pipes 5. Decentralized Governance 6. Decentralized Data Management 7. Infrastructure Automation 8. Design for failure 9. Evolutionary Design https://martinfowler.com/articles/microservices.html

Slide 8

Slide 8 text

Componentization via Services Library Service Product Library Shipping Library Product Service Shipping Service

Slide 9

Slide 9 text

Organized around Business Capabilities Merchant Product Shipping

Slide 10

Slide 10 text

Decentralized Data Management MySQL Mongo Elasticsearch

Slide 11

Slide 11 text

Continuous Delivery Infrastructure Automation Unit Test Integration Test Deploy to Staging Application Acceptance Test Deploy to Production Post Deploy Test

Slide 12

Slide 12 text

Design for failure ● Monitoring ● Circuit Breaker ● Chaos Monkey

Slide 13

Slide 13 text

How Big is Microservices? ● Single Responsibility ● Small enough to fit in in my head ● X people per Service

Slide 14

Slide 14 text

Monolith ● Simplicity ● Consistency ● Easy to Refactor ● Partial Deployment ● Availability ● Multiple Platform ● Easy to Scale Microservices

Slide 15

Slide 15 text

Event-Driven Architecture

Slide 16

Slide 16 text

API-Driven Microservices FRONTEND CART SERVICE ORDER SERVICE PAYMENT SERVICE

Slide 17

Slide 17 text

API-Driven Microservices Problem FRONTEND CART SERVICE ORDER SERVICE PAYMENT SERVICE NOTIF SERVICE

Slide 18

Slide 18 text

Event-Driven Microservices FRONTEND CART SERVICE ORDER SERVICE PAYMENT SERVICE NOTIF SERVICE CART EVENT

Slide 19

Slide 19 text

Event-Driven Microservices FRONTEND CART SERVICE ORDER SERVICE PAYMENT SERVICE NOTIF SERVICE CART EVENT FRAUD SERVICE

Slide 20

Slide 20 text

Event-Driven Microservices Problem FRONTEND CART SERVICE ORDER SERVICE PAYMENT SERVICE NOTIF SERVICE CART EVENT FRAUD SERVICE

Slide 21

Slide 21 text

Event-Carried State Transfer FRONTEND CART SERVICE ORDER SERVICE PAYMENT SERVICE NOTIF SERVICE FULL CART EVENT FRAUD SERVICE CART DETAIL CART DETAIL CART DETAIL CART DETAIL https://martinfowler.com/articles/201701-event-driven.html

Slide 22

Slide 22 text

API-Driven ● Highly-coupled ● Centralized business logic ● Consistent ● Increase response time ● Sync Event-Driven ● Decoupling ● Decentralized business logic ● Eventual consistent ● Reduce load on producer ● Replicated data ● Async

Slide 23

Slide 23 text

The Challenges of Event-Driven Microservices ● Idempoten ● Asynchronous ● Message Schema ● Versioning ● Tracing ● Message Order ● Consumer Complexity ● Message Broker

Slide 24

Slide 24 text

Hands-On using Java

Slide 25

Slide 25 text

Tools Required for This Workshop ● Java Development Kit version 1.8 or Higher ● Apache Maven version 3 ● Apache Kafka version 2.3 ● MongoDB version 4 ● Elasticsearch version 7.2

Slide 26

Slide 26 text

MonoPay ● MonoPay is whitelabel system for e-Wallet ● Merchant can use MonoPay to support e-Wallet feature in their system ● MonoPay support member management, topup management, purchase management and point management ● MonoPay use monolith architecture

Slide 27

Slide 27 text

MonoPay Backend System Merchant Module Cash Module Member Module Transaction Module Mongo DB Partner System HTTP

Slide 28

Slide 28 text

MonoPay Wallet Project https://github.com/khannedy/monopay-wallet

Slide 29

Slide 29 text

How to migrate MonoPay to Event-Driven Microservices?

Slide 30

Slide 30 text

Migrating MonoPay to Microservices MonoPay eWallet Mongo DB Partner System HTTP MonoPay API

Slide 31

Slide 31 text

Migrating MonoPay to Microservices MonoPay eWallet Mongo DB Partner System HTTP MonoPay API MonoPay Merchant

Slide 32

Slide 32 text

Migrating MonoPay to Microservices MonoPay eWallet Mongo DB Partner System HTTP MonoPay API MonoPay Merchant MonoPay Member

Slide 33

Slide 33 text

Migrating MonoPay to Microservices MonoPay eWallet Mongo DB Partner System HTTP MonoPay API MonoPay Merchant MonoPay Member MonoPay Transaction

Slide 34

Slide 34 text

Migrating MonoPay to Microservices Mongo DB Partner System HTTP MonoPay API MonoPay Merchant MonoPay Member MonoPay Transaction MonoPay Cash

Slide 35

Slide 35 text

Migrating MonoPay to Microservices Mongo DB Partner System HTTP MonoPay API MonoPay Merchant MonoPay Member MonoPay Transaction MonoPay Cash Mongo DB Mongo DB Mongo DB

Slide 36

Slide 36 text

How to Integrate between Services?

Slide 37

Slide 37 text

API-Driven vs Event-Driven

Slide 38

Slide 38 text

MonoPay Microservices https://github.com/khannedy/monopay-api https://github.com/khannedy/monopay-merchant https://github.com/khannedy/monopay-member https://github.com/khannedy/monopay-transaction https://github.com/khannedy/monopay-cash

Slide 39

Slide 39 text

Migrating to Event-Driven Microservices Partner System HTTP MonoPay API MonoPay Merchant MonoPay Member MonoPay Transaction MonoPay Cash KAFKA

Slide 40

Slide 40 text

One more thing

Slide 41

Slide 41 text

Migrating to Event-Driven Microservices Partner System HTTP MonoPay API MonoPay Merchant MonoPay Member MonoPay Transaction MonoPay Cash KAFKA MonoPay Analytic ELASTICSEARCH Kibana Cloud

Slide 42

Slide 42 text

MonoPay Microservices https://github.com/khannedy/monopay-analytic

Slide 43

Slide 43 text

Thank You!