WSO2 Gateway
Kasun Indrasiri
Software Architect
WSO2
Outline
• Introduction to WSO2 Gateway
• Motivations/Objectives
• High level architecture and design
• Features
• Message flow
• Performance comparison.
• Use cases
• Conclusion.
Introduction to WSO2 Gateway
• WSO2 GW encapsulates the messaging between source and
target systems which are built with disparate technologies,
protocols and standards.
Motivations
• Paradigm shifts in Non-blocking IO, message/event processing,
concurrent programming - Netty, Disruptor, Java 8, Reactive
Programming.
• Research work - Siddhi CEP based ESB, axis2-Netty transport.
• Overcome the limitations of axis2, synapse etc.
• Reuse the prior knowledge and experience of building high
performance messaging systems to build a better message
Gateway from the ground up.
[1] https://github.com/kasun04/siddhi-esb
Objectives
• To build a high performance, lightweight and reusable message
Gateway based on Gateway Pattern[1]
• To be used as the foundation component of ESB, API GW, Load
Balancer, Security GW, File GW etc.
[1] http://martinfowler.com/eaaCatalog/gateway.html
WSO2 Gateway – Architecture
• Fully decoupled protocol handling layers from message processing layer.
• Carbon Message - Data carrier between protocol handling and message
processing layers, contains message attributes and reference to message
content, Message Consumers - protocol handling of inbound messages.
• Message Producers/Senders - protocol handling of outbound messages.
• Message Processing Engine - process/mediate the messages.
WSO2 Gateway 1.0 – Features
• Ultra high performance and low latency HTTP/S messaging.
• Supports thousands of concurrent connections/clients.
• Header-based routing using Apache Camel as the message mediation
engine.
• Defines REST services/APIs using Camel REST DSL
• Lightweight and stateless service orchestration.
• Load balancing and failover messaging.
• Error handling support.
WSO2 Gateway – Message Flow
• Message receiving, processing and sending are handled with the use of
Callbacks. (No notion of Inflow and Outflow.).
• Message consumer sets consumerCallback which is called by the Engine,
when the response message is ready to be sent to the client (i.e. when
mediation is completed.).
• Engine sets the engineCallback which gets called by Producers when the
response for a given request has arrived
WSO2 Gateway – HTTP Messaging
• WSO2 Gateway uses Netty based HTTP transport implemented on
message WSO2’s Pass-Thru (PT) architecture [1].
• Overcoming the consumer/producer contention in PT shared
buffer/pipe with a new blocking queue and ring buffer architecture
(Disruptor).
[1] http://wso2.com/library/articles/2013/12/demystifying-wso2-esb-pass-thru-transport-part-ii/
WSO2 Gateway – HTTP Transport
• Netty HTTP Transport - Using executors
WSO2 Gateway – HTTP Transport
• Netty HTTP Transport - Using Disruptor
WSO2 Gateway – Mediation Engine
• Using Apache Camel as the mediation engine.
WSO2 Gateway – Performance
• Performance comparison for fast backend.
• WSO2 GW - with Camel mediation for header based routing.
• WSO2 GW is nearly 10x faster than existing WSO2 ESB’s transport.
WSO2 Gateway – Performance
• Handling concurrency with slow backend (5s delay).
• NHTTP/BR failed at c=4k, PTT failed at c=8k, GW can go upto c=12k.
• We are further enhancing high concurrency support in GW
WSO2 Gateway – Performance
• Latency comparison
Use case I – Header-based Routing
• Camel configuration for Header-based routing.
Use case II – Using REST
• Defining REST services for existing web APIs.
Gateway in Microservices Architecture
• API Gateway is used in most real world microservice
implementations to front microservices.
– Eg Netflix API GW[1]
[1] Source : http://microservices.io/patterns/apigateway.html
Resources
• Download WSO2 GW 1.0.0-Alpha
• Source Code - https://github.com/wso2/product-gw
• Getting Started guide.
• Public Jira - https://wso2.org/jira/browse/WGW
• WSO2 GW – 1.0.0 GA is on early December.
Thank You

WSO2 Gateway

  • 1.
  • 2.
    Outline • Introduction toWSO2 Gateway • Motivations/Objectives • High level architecture and design • Features • Message flow • Performance comparison. • Use cases • Conclusion.
  • 3.
    Introduction to WSO2Gateway • WSO2 GW encapsulates the messaging between source and target systems which are built with disparate technologies, protocols and standards.
  • 4.
    Motivations • Paradigm shiftsin Non-blocking IO, message/event processing, concurrent programming - Netty, Disruptor, Java 8, Reactive Programming. • Research work - Siddhi CEP based ESB, axis2-Netty transport. • Overcome the limitations of axis2, synapse etc. • Reuse the prior knowledge and experience of building high performance messaging systems to build a better message Gateway from the ground up. [1] https://github.com/kasun04/siddhi-esb
  • 5.
    Objectives • To builda high performance, lightweight and reusable message Gateway based on Gateway Pattern[1] • To be used as the foundation component of ESB, API GW, Load Balancer, Security GW, File GW etc. [1] http://martinfowler.com/eaaCatalog/gateway.html
  • 6.
    WSO2 Gateway –Architecture • Fully decoupled protocol handling layers from message processing layer. • Carbon Message - Data carrier between protocol handling and message processing layers, contains message attributes and reference to message content, Message Consumers - protocol handling of inbound messages. • Message Producers/Senders - protocol handling of outbound messages. • Message Processing Engine - process/mediate the messages.
  • 7.
    WSO2 Gateway 1.0– Features • Ultra high performance and low latency HTTP/S messaging. • Supports thousands of concurrent connections/clients. • Header-based routing using Apache Camel as the message mediation engine. • Defines REST services/APIs using Camel REST DSL • Lightweight and stateless service orchestration. • Load balancing and failover messaging. • Error handling support.
  • 8.
    WSO2 Gateway –Message Flow • Message receiving, processing and sending are handled with the use of Callbacks. (No notion of Inflow and Outflow.). • Message consumer sets consumerCallback which is called by the Engine, when the response message is ready to be sent to the client (i.e. when mediation is completed.). • Engine sets the engineCallback which gets called by Producers when the response for a given request has arrived
  • 9.
    WSO2 Gateway –HTTP Messaging • WSO2 Gateway uses Netty based HTTP transport implemented on message WSO2’s Pass-Thru (PT) architecture [1]. • Overcoming the consumer/producer contention in PT shared buffer/pipe with a new blocking queue and ring buffer architecture (Disruptor). [1] http://wso2.com/library/articles/2013/12/demystifying-wso2-esb-pass-thru-transport-part-ii/
  • 10.
    WSO2 Gateway –HTTP Transport • Netty HTTP Transport - Using executors
  • 11.
    WSO2 Gateway –HTTP Transport • Netty HTTP Transport - Using Disruptor
  • 12.
    WSO2 Gateway –Mediation Engine • Using Apache Camel as the mediation engine.
  • 13.
    WSO2 Gateway –Performance • Performance comparison for fast backend. • WSO2 GW - with Camel mediation for header based routing. • WSO2 GW is nearly 10x faster than existing WSO2 ESB’s transport.
  • 14.
    WSO2 Gateway –Performance • Handling concurrency with slow backend (5s delay). • NHTTP/BR failed at c=4k, PTT failed at c=8k, GW can go upto c=12k. • We are further enhancing high concurrency support in GW
  • 15.
    WSO2 Gateway –Performance • Latency comparison
  • 16.
    Use case I– Header-based Routing • Camel configuration for Header-based routing.
  • 17.
    Use case II– Using REST • Defining REST services for existing web APIs.
  • 18.
    Gateway in MicroservicesArchitecture • API Gateway is used in most real world microservice implementations to front microservices. – Eg Netflix API GW[1] [1] Source : http://microservices.io/patterns/apigateway.html
  • 19.
    Resources • Download WSO2GW 1.0.0-Alpha • Source Code - https://github.com/wso2/product-gw • Getting Started guide. • Public Jira - https://wso2.org/jira/browse/WGW • WSO2 GW – 1.0.0 GA is on early December.
  • 20.