27
Director - Integration Architecture, WSO2 Microservice Architecture (MSA) and Integration Microservices Kasun Indrasiri

[WSO2Con EU 2017] Microservice Architecture (MSA) and Integration Microservices

Embed Size (px)

Citation preview

Page 1: [WSO2Con EU 2017] Microservice Architecture (MSA) and Integration Microservices

Director - Integration Architecture, WSO2

Microservice Architecture (MSA) and Integration Microservices

Kasun Indrasiri

Page 2: [WSO2Con EU 2017] Microservice Architecture (MSA) and Integration Microservices

Evolution of Microservices Monolithic Applications

Application 2

Application 1

Application 3

Application 4

Consumers

Page 3: [WSO2Con EU 2017] Microservice Architecture (MSA) and Integration Microservices

Evolution of Microservices SOA and ESB

Consumers

ESB

System

Service 1 Service 2 Service 3 Service 4 Service 5

Application server

Page 4: [WSO2Con EU 2017] Microservice Architecture (MSA) and Integration Microservices

Evolution of Microservices SOA with APIs

Consumers

ESB

System

Service 1 Service 2 Service 3 Service 4 Service 5

API Management

Application server

Page 5: [WSO2Con EU 2017] Microservice Architecture (MSA) and Integration Microservices

• The foundation of MSA is about developing a single application as a suite of fine-grained and independent services running in its own process, developed and deployed independently.

Microservice Architecture

Page 6: [WSO2Con EU 2017] Microservice Architecture (MSA) and Integration Microservices

Evolution of Microservices Microservices

Web Portal Mobile Apps Store Admin Web Storefrons Promotion Mgmt

API Management

Product Details Shopping Cart Order Mgt Payment Proc. Payment Proc. Customer Mgt.

Account Mgt Order Tracking Financial Mgt Fraud Detection Tax Mgt Inventory Mgt Allocation-Release

Self-Service Giftcards Promotions Pricing Subscription Credit service CRM Mgt Shipping

Data Warehouse Finance System Shipping Inventory Payment Gateway Cloud ServicesE.g. Salesforce, Paypal etc

Page 7: [WSO2Con EU 2017] Microservice Architecture (MSA) and Integration Microservices

Smart Endpoints and Dumb Pipes Eliminating the Central ESB

• ESB contains business logic + network communication logic

Consumers

Virtual Service 1

Virtual Service 2

Virtual Service 3

Service A Service B Service C Service D

Page 8: [WSO2Con EU 2017] Microservice Architecture (MSA) and Integration Microservices

Smart Endpoints and Dumb Pipes Eliminating the Central ESB

• With MSA, business logic + network communication logic are dispersed across independent services

Consumers

Microservice X Microservice Y Microservice Z

Microservice P Microservice Q Microservice R Microservice S

JAVA Node.js Python

Page 9: [WSO2Con EU 2017] Microservice Architecture (MSA) and Integration Microservices

Real-World Microservice ImplementationsNetflix API

• The ‘front door’ to Netflix ecosystem of microservices

• Provides logic of composing calls to all services required to construct a response

• Orchestration service that exposes coarse grained APIs by composing fined-grained functionality provided by the microservices

• Orchestration logic built with Java, RxJava

Microservice 1

Microservice 2

Microservice 3

Microservice 4

Microservice 5

Microservice 6

Microservice 7

Microservice 8

...

Microservice 9OR

CH

ESTR

ATI

ON

LA

YER

Playbackrequests

Discovery andNon-member request

Source: https://medium.com/netflix-techblog/engineering-trade-offs-and-the-netflix-api-re-architecture-64f122b277dd

Page 10: [WSO2Con EU 2017] Microservice Architecture (MSA) and Integration Microservices

Real-World Microservice ImplementationsUber

• ‘Edge Services’ exposed to the external client/mobile applications and the service orchestration logic is burnt into the edge service

• Edge services are primarily implemented on top of Node.js

Edge Service

Payments Promos Users

Source: https://www.infoq.com/presentations/uber-darwin

Page 11: [WSO2Con EU 2017] Microservice Architecture (MSA) and Integration Microservices

Real-World MicroserviceImplementationsPayPal

• API façade layer exposes PayPal business functionality to internal/external client applications

• Orchestration logic resides in the API façade layer and implemented using Groovy

Applications(Wallet,

POS)PayPal

2-nd party Applications

(eBay, Braintree)

3-nd party Mobile Applications

(Uber, PhotoCard)

2-nd party Online Applications

(Online websites)

Paypal Web Applications API Facade Batch

Processing

Payments Instruments Customer Invoicing

Credit Risk Compliance Disputes

Event Bus

Webhooks

Batch APIs

External Events

Protocol conversionOAuth,CORS Routing Orchestration

{Experience Events

{CapabilityAPIs

Source: https://www.infoq.com/presentations/paypal-api-evolution

Page 12: [WSO2Con EU 2017] Microservice Architecture (MSA) and Integration Microservices

The ‘new’ monolith

Business logic inside API-GW?

• A central gateway with heavy composition logic is becoming an anti-pattern

• Ability to develop, deploy and scale APIs independently -> Micro-API Gateways

PB Microservice 1

PB Microservice 2

PB Microservice 3

...

PB Microservice m

Shared Microservice 1

D/NM Microservice 1

Microservice 8

...

Microservice 9

PLA

YBA

CK

OR

CH

ESTR

ATI

ON

LA

YER

Playbackrequests

Discovery and non-memberrequest

PLA

YBA

CK

OR

CH

ESTR

ATI

ON

LA

YER

Shared Microservice 2

D/NM Microservice 2

D/NM Microservice 3

D/NM Microservice n

Source: https://medium.com/netflix-techblog/engineering-trade-offs-and-the-netflix-api-re-architecture-64f122b277dd

Page 13: [WSO2Con EU 2017] Microservice Architecture (MSA) and Integration Microservices

Organizing Microservices Microservice Types with Different Granularities

• Not all microservices are similar• Some services are business logic heavy, while some

contain a lot of interservice calls• Some services are too fine-grained to be exposed as a

business functionality• Some services are exposed as APIs

Page 14: [WSO2Con EU 2017] Microservice Architecture (MSA) and Integration Microservices

Organizing Microservices Microservice Types with Different Granularities

Consumer 1

API Service 1 API Service 2 API Service 3 API Service 4

ConsumersConsumer 2 Consumer 3

Service 6 Service 7 Service 8 Service 9

Service 1 Service 2 Service 3 Service 4 Service 5 Proprietary & Legacy

Systems

Web API / SaaS

API Services/Edge Services

Composite Service/Integration Services

Core Services/Atomic Services

Page 15: [WSO2Con EU 2017] Microservice Architecture (MSA) and Integration Microservices

Organizing Microservices Microservice Types with Different Granularities

Consumer 1

API Service P API Service Q API Service R API Service S

ConsumersConsumer 2 Consumer 3

μ Service A μ Service B

μ Service F

μ Service G

Proprietary & Legacy

Systems

Web API / SaaS

API Services/Edge Services

Composite Service/Integration Services

Core Services/Atomic Services

μ Service I

μ Service H

μ Service J

μ Service E

μ Service C

μ Service D

Page 16: [WSO2Con EU 2017] Microservice Architecture (MSA) and Integration Microservices

Organizing Microservices Core Microservices

• Business logic heavy• Zero or minimal inter-service calls• Technologies: General purpose programming

languages

Page 17: [WSO2Con EU 2017] Microservice Architecture (MSA) and Integration Microservices

Organizing Microservices Composite or Integration Microservices

• A microservice with multiple network interactions • Create composite microservices by integrating web

APIs/SaaS, legacy systems, and microservices• API service or edge service is also an integration

microservice with some API gateway capabilities

Page 18: [WSO2Con EU 2017] Microservice Architecture (MSA) and Integration Microservices

Technologies for Building Composite/Integration Microservices Frameworks Based on General Purpose Lang

• Java, Node.js, Groovy, e.g. SpringBoot, Dropwizard • Not designed with suitable abstractions for

integration/network interactions• Developers spend more time on building service

interactions than focusing on business logic• Compositions cannot be illustrated graphically

Page 19: [WSO2Con EU 2017] Microservice Architecture (MSA) and Integration Microservices

Technologies for Building Composite/Integration Microservices Conventional ESBs

• Bulky traditional ESB architecture -> Not fully compatible with MSA principles

• High level DSLs with a lot of tweaks to make it a powerful programming language (e.g. expression languages, properties)

Page 20: [WSO2Con EU 2017] Microservice Architecture (MSA) and Integration Microservices

Technologies for Building Composite/Integration Microservices Ballerina - ballerinalang.org

Page 21: [WSO2Con EU 2017] Microservice Architecture (MSA) and Integration Microservices

Ballerina - ballerinalang.org

• An event-driven, parallel programming language for networked applications.

• Graphical and textual syntax built on top of sequence diagram metaphor

• Designed for network interactions with JSON/XML/SQL/MIME and HTTP/JMS/File/WebSockets

• Modular and designed for modern development practices• Microservices, serverless, and container friendly

Page 22: [WSO2Con EU 2017] Microservice Architecture (MSA) and Integration Microservices

Ballerina - ballerinalang.orgExample: Routing Service

Page 23: [WSO2Con EU 2017] Microservice Architecture (MSA) and Integration Microservices

Ballerina - ballerinalang.org

• Network protocols – HTTP/HTTP2, WebSockets, JMS,

File/FTP, Databases – SaaS Integration - Salesforce, Twitter,

Gmail, etc. – Proprietary and legacy connectors

• Service definition and implementation – Swagger, Jax-RS like service

annotations • Data types

– Native support for JSON, XML and SQL data

– Graphical type mapping

Page 24: [WSO2Con EU 2017] Microservice Architecture (MSA) and Integration Microservices

Ballerina - ballerinalang.org

• High performance and container native – One of the fastest HTTP transport based

on Netty – Minimal Startup time, low resource

consumption – Built-in ability to create Docker image

with executable Ballerina program package

– Run on any container management platform

Page 25: [WSO2Con EU 2017] Microservice Architecture (MSA) and Integration Microservices

Ballerina - ballerinalang.org When to Use Ballerina?

• Write integration/composite microservices• Building API service• Write integration scripts• Replacement for shell scripts that use curl a lot

Page 26: [WSO2Con EU 2017] Microservice Architecture (MSA) and Integration Microservices

Conclusion

• How to eliminate the centralized ESB with MSA• Importance of creating composite services and

using a dedicated technology• Integration microservices with Ballerina

Page 27: [WSO2Con EU 2017] Microservice Architecture (MSA) and Integration Microservices

wso2.com