Post on 21-Jan-2018
transcript
Bridging Microservices, APIs and Integration
Microservices and Cloud Native Apps - SF Bay AreaCloud Field Day Edition, Santa Clara July 2017
Kasun IndrasiriDirector-Integration Architecture at WSO2
About Me ● Director - Integration Architecture at WSO2● Committer/PMC Apache Synapse, an architect of WSO2 ESB ● Author ‘Beginning WSO2 ESB’, several microservices articles/white papers
WSO2
● Open source middleware company ● API Management, Integration, IAM and IOT platforms.
Why Microservices Compositions? ● Too many fine-grained microservices. ● Business functionalities often require to interact with more than one
(micro)service. ● Microservices typically don't publish their APIs for direct invocation.● Brown-field reality requires ‘Integration’
○ Green fields enterprises don’t exists. ○ Hybrid usage of Microservices and monolithic architecture is quite common. ○ Need to integrate with existing legacy systems, proprietary systems, databases
and SaaS.
Glimpse of existing Microservice Implementations
● How do the existing microservice implementations handle the service
compositions/service orchestration?
Microservice - Compositions
Netflix
● The Netflix API is the “front door” to the Netflix ecosystem of microservices.
● API provides the logic of composing calls to all services that are required to construct a response.
● The Netflix API is an orchestration service that exposes coarse grained APIs by composing fined grained functionality provided by the microservices.
● Orchestration logic is built with Java, RxJava
Microservice - Compositions
Uber
● ‘Edge Services’ which are 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
Microservice - Compositions
Paypal
● The API façade layer exposes Paypal business functionalities to various internal and external client applications
● The orchestration logic resides in the API façade layer and its implemented using Groovy.
Miniservices “A miniservice is a coarse-grained, independently deployable and independently scalable application component.”
● “Innovation Insight for Miniservices” : Published: February 2017 ○ https://www.gartner.com/doc/3615120/innovation-insight-miniservices
The ‘new’ monolith…
API Gateway
● A central gateway with heavy composition logic is becoming an anti-pattern.
● https://medium.com/netflix-techblog/engineering-trade-offs-and-the-netflix-api-re-architecture-64f122b277dd
● Ability to develop, deploy and scale APIs independently -> Micro-API Gateways
Integration/Composite Microservices ● A composite microservice with multiple network interactions ● Create composite microservices by integrating web APIs/SaaS, legacy
systems and microservices● API services/Edge service is also an integration microservice with some API
gateway capabilities. ● Similar to the ‘Miniservice’ concept wrt to the granularity
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○ Compositions cannot be illustrated graphically.
● Apache Camel and other 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 lang. (e.g. expression
languages, properties)
● Ballerina - ballerinalang.org - Open source microservice composition framework
● Service mesh frameworks - for Inter-service communication
Ballerina (ballerinalang.org) ● Ballerina is a new parallel programming language that is designed and
optimized for integration.● Graphical and textual syntax which is built on top of the sequence diagram
metaphor.● Designed for network interactions with JSON/XML/SQL/MIME and
HTTP/JMS/File/WebSockets ● Lightweight, high-performance and container native Integration runtime ● 100% open source.
Ballerina - Features ● 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
● High performance and container native ○ One of the fastest HTTP transport based on Netty ○ Minimal Startup time(< 1s), low resource consumption. ○ Built-in ability to create Docker image with executable Ballerina program package○ Run on any container management platform
○
Ballerina - Future ● Ballerina 1.0 release on 2017 Q4 ● Why yet another language?
○ Make it easier to consume and produce networked services and applications.○ Ballerina has been influenced by Java, Go, C, Node, Javascript, Maven, Tomcat, and a variety
of other awesome tools.
● When should I use Ballerina?○ Write integration microservices/miniservices: 80-20 rule
■ If 80% of your service is about integrating with other services, data and APIs then use Ballerina.
■ If just 20% is integration then use Java / Node / Go / PHP / XYZ○ Re-compose existing services to be API backends○ Write integration scripts
■ Replacement for shell scripts that use curl a lot
Ballerina - Try it! ● DOWNLOAD v0.91 and twirl away:
○ http://ballerinalang.org/● Source Code : https://github.com/ballerinalang/● NOTE: Still work-in-progress. New releases every two weeks with major
features still coming along. Missing docs. A (few) bugs. Etc.!
● Managing a network of microservices and inter-service communications ● Not really a composite microservice development technology. ● Eg: Istio - https://istio.io, Linkered https://linkerd.io/
Service Mesh Solutions
● Understanding service granularities. ● Technologies for building integration microservices.
Summary
Thank You! ● kasun@wso2.com● https://twitter.com/kasunindrasiri