Director - Integration Architecture, WSO2
Microservice Architecture (MSA) and
Integration Microservices
Kasun Indrasiri
Evolution of Microservices
Monolithic Applications
Application 2
Application 1
Application 3
Application 4
Consumers
Evolution of Microservices
SOA and ESB
Consumers
ESB
System
Service 1 Service 2 Service 3 Service 4 Service 5
Application server
Evolution of Microservices
SOA with APIs
Consumers
ESB
System
Service 1 Service 2 Service 3 Service 4 Service 5
API Management
Application server
• 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
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
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
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
Real-World Microservice
Implementations
Netflix 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 9
ORCHESTRATIONLAYER
Playback
requests
Discovery and
Non-member request
Source: https://medium.com/netflix-techblog/engineering-trade-offs-and-the-netflix-api-re-architecture-64f122b277dd
Real-World Microservice
Implementations
Uber
• ‘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
Real-World Microservice
Implementations
PayPal
• 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 conversion
OAuth,CORS Routing
Orchestration
{Experience
Events
{Capability
APIs
Source: https://www.infoq.com/presentations/paypal-api-evolution
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
...
PLAYBACK
ORCHESTRATIONLAYER
Playback
requests
Discovery and
non-member
request
PLAYBACKORCHESTRATION
LAYER
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
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
Organizing Microservices
Microservice Types with Different Granularities
Consumer 1
API Service 1 API Service 2 API Service 3 API Service 4
Consumers
Consumer 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
Organizing Microservices
Microservice Types with Different Granularities
Consumer 1
API Service P API Service Q API Service R API Service S
Consumers
Consumer 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
Organizing Microservices
Core Microservices
• Business logic heavy
• Zero or minimal inter-service calls
• Technologies: General purpose programming
languages
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
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
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)
Technologies for Building Composite/Integration
Microservices
Ballerina - ballerinalang.org
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
Ballerina - ballerinalang.org
Example: Routing Service
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
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
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
Conclusion
• How to eliminate the centralized ESB with MSA
• Importance of creating composite services and
using a dedicated technology
• Integration microservices with Ballerina
wso2.com

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

  • 1.
    Director - IntegrationArchitecture, WSO2 Microservice Architecture (MSA) and Integration Microservices Kasun Indrasiri
  • 2.
    Evolution of Microservices MonolithicApplications Application 2 Application 1 Application 3 Application 4 Consumers
  • 3.
    Evolution of Microservices SOAand ESB Consumers ESB System Service 1 Service 2 Service 3 Service 4 Service 5 Application server
  • 4.
    Evolution of Microservices SOAwith APIs Consumers ESB System Service 1 Service 2 Service 3 Service 4 Service 5 API Management Application server
  • 5.
    • The foundationof 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
  • 6.
    Evolution of Microservices Microservices WebPortal 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
  • 7.
    Smart Endpoints andDumb 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
  • 8.
    Smart Endpoints andDumb 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
  • 9.
    Real-World Microservice Implementations Netflix 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 9 ORCHESTRATIONLAYER Playback requests Discovery and Non-member request Source: https://medium.com/netflix-techblog/engineering-trade-offs-and-the-netflix-api-re-architecture-64f122b277dd
  • 10.
    Real-World Microservice Implementations Uber • ‘EdgeServices’ 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
  • 11.
    Real-World Microservice Implementations PayPal • APIfaç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 conversion OAuth,CORS Routing Orchestration {Experience Events {Capability APIs Source: https://www.infoq.com/presentations/paypal-api-evolution
  • 12.
    The ‘new’ monolith Businesslogic 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 ... PLAYBACK ORCHESTRATIONLAYER Playback requests Discovery and non-member request PLAYBACKORCHESTRATION LAYER 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
  • 13.
    Organizing Microservices Microservice Typeswith 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
  • 14.
    Organizing Microservices Microservice Typeswith Different Granularities Consumer 1 API Service 1 API Service 2 API Service 3 API Service 4 Consumers Consumer 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
  • 15.
    Organizing Microservices Microservice Typeswith Different Granularities Consumer 1 API Service P API Service Q API Service R API Service S Consumers Consumer 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
  • 16.
    Organizing Microservices Core Microservices •Business logic heavy • Zero or minimal inter-service calls • Technologies: General purpose programming languages
  • 17.
    Organizing Microservices Composite orIntegration 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
  • 18.
    Technologies for BuildingComposite/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
  • 19.
    Technologies for BuildingComposite/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)
  • 20.
    Technologies for BuildingComposite/Integration Microservices Ballerina - ballerinalang.org
  • 21.
    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
  • 22.
  • 23.
    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
  • 24.
    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
  • 25.
    Ballerina - ballerinalang.org Whento Use Ballerina? • Write integration/composite microservices • Building API service • Write integration scripts • Replacement for shell scripts that use curl a lot
  • 26.
    Conclusion • How toeliminate the centralized ESB with MSA • Importance of creating composite services and using a dedicated technology • Integration microservices with Ballerina
  • 27.