Microservice architectures (MSA) are becoming popular and a lot of enterprises have already segregated their monolithic applications to fine-grained services. But, a major challenge they're faced with is how to integrate/orchestrate among those microservices and create composite services. This slide deck explores how to overcome this challenge and real-world use cases.
3. Evolution of Microservices
SOA and ESB
Consumers
ESB
System
Service 1 Service 2 Service 3 Service 4 Service 5
Application server
4. Evolution of Microservices
SOA with APIs
Consumers
ESB
System
Service 1 Service 2 Service 3 Service 4 Service 5
API Management
Application server
5. • 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
6. 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
7. 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
8. 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
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
• ‘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
11. 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
12. 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
13. 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
14. 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
15. 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
17. 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
18. 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
19. 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)
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
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
When to Use Ballerina?
• Write integration/composite microservices
• Building API service
• Write integration scripts
• Replacement for shell scripts that use curl a lot
26. Conclusion
• How to eliminate the centralized ESB with MSA
• Importance of creating composite services and
using a dedicated technology
• Integration microservices with Ballerina