high volume web api management with the wso2 esb

29
High Volume Web API Management with WSO2 ESB Paul Fremantle, CTO and Co-Founder Hiranya Jayathilaka, Associate Technical Lead © WSO2 2011. Not for redistribution. lean enterprise middleware

Upload: paul-fremantle

Post on 20-May-2015

3.273 views

Category:

Technology


5 download

DESCRIPTION

In this webinar Paul Fremantle and Hiranya Jayathilaka describe how to use the WSO2 ESB to manage high volume Web APIs including REST and JSON

TRANSCRIPT

Page 1: High Volume Web API Management with the WSO2 ESB

High Volume Web API Managementwith WSO2 ESB

Paul Fremantle, CTO and Co-FounderHiranya Jayathilaka, Associate Technical Lead

© WSO2 2011. Not for redistribution.

lean enterprise middleware

Page 2: High Volume Web API Management with the WSO2 ESB

WSO2 Offerings• WSO2 Carbon– On premise product platform– Consistent products sharing the same OSGi core

• WSO2 Stratos– A “Cloud-Enabled Application Platform” (CEAP)– Multi-tenant, Elastic, Metered/Billed deployment– An extension of the Carbon platform

• Same SVN code tree

• WSO2 StratosLive– http://cloud.wso2.com– A running Platform-as-a-Service (PaaS)– An instance of Stratos

© WSO2 2011

Page 3: High Volume Web API Management with the WSO2 ESB

ForresterWaveTM ESB Q2 2011 - Leader

Page 4: High Volume Web API Management with the WSO2 ESB

© WSO2 2011

WSO2 ESB 4.0

Page 5: High Volume Web API Management with the WSO2 ESB

WSO2 ESB Features• The WSO2 Enterprise Service Bus offers:– Easy configuration through an intuitive graphical interface – Lean, high-performance design conserves resources through

maximum efficiency.– Built on the WSO2 Carbon OSGi platform: adding new capabilities

as you need them is a snap.– Integrates with your existing systems, with support for EDI, CSV,

Files, FIX, HL7, SAP, JMS, etc• Asynchronous architecture supports very high loads with

fixed resources• Routing, mediation and transformation are modular,

extensible but provide most use-cases simply by sequencing built-in mediators

• Full support for SOAP/WS-* and REST

© WSO2 2011

Page 6: High Volume Web API Management with the WSO2 ESB

Key Features for High Volume Web API

• Load Balancing and Failover built-in– Pluggable models can include affinity based LB

• Full REST Support (XML and JSON)– Especially used in Mobile environments– Can bridge into SOAP or other enterprise systems

• Message Relay Mode and Relay Transport– Excellent performance for 100% streaming

• Priority Execution, Cache and Throttling– Manage workloads within the ESB as well as throttle

backend– Cache content locally if appropriate

• Service Chaining– Asynchronous lightweight orchestration

© WSO2 2011

Page 7: High Volume Web API Management with the WSO2 ESB

eBay Case Study – High Volume• Requirements:

– “The solutions we were using no longer met our needs, so we considered whether to build a new internal system or to adopt third-party technology”, Abhinav Kumar, eBay

– Needed enhanced service mediation and orchestration capabilities – Scalability and performance to sustain increasing loads

• Evaluation:– eBay evaluated several industry leading hardware and software ESB solutions, looking at

open source, commercially licensed ESBs and hardware– Test production during 2009 holiday season proved that our system was rock solid– 1m messages/day with zero downtime, zero memory growth

• Results– Shared-nothing architecture on RedHat Linux on x86 hardware– Currently running at more than 1 billion messages / day – Low resource utilization and flat memory usage

• The benefits– “Using the WSO2 ESBs, we've been able to provide customers and partners with the

quality experience they expect on eBay, even as our global customer base has grown,” Abhinav Kumar

© WSO2 2011

Page 8: High Volume Web API Management with the WSO2 ESB

Memory Usage at eBay

© WSO2 2011

Page 9: High Volume Web API Management with the WSO2 ESB

Deployment

© WSO2 2011

Page 10: High Volume Web API Management with the WSO2 ESB

Configuring for High Volume

• Operating System • JVM• ESB• Management

© WSO2 2011

Page 11: High Volume Web API Management with the WSO2 ESB

Tuning the OS

Optimize core network settings for high throughput network activity /etc/sysctl.conf

Increase the number of open file descriptors allowed by the OS /etc/security/limits.conf

Page 12: High Volume Web API Management with the WSO2 ESB

Tuning the JVM

Allocate sufficient memory for the heap -Xms256m -Xmx2048m -XX:MaxPermSize=256m

Consider reducing the new ratio -XX:NewRatio=n

Consider using the concurrent mark and sweep collector

-XX:+UseConcMarkSweepGC

Read more on JVM and GC tuning http://wso2.org/library/articles/2010/11/taming-java-garbage-

collector

Page 13: High Volume Web API Management with the WSO2 ESB

Tuning the ESB

Configure transport thread pools Configured through nhttp.properties file IO dispatcher threads carry out network IO at the

wire level Recommended to have one IO dispatcher per CPU core

Server workers and client workers mediate the messages More the merrier (But keep memory usage and load in

mind)

Page 14: High Volume Web API Management with the WSO2 ESB

Message Relay Mode

• WSO2 ESB uses Apache AXIOM and the StAX API for processing XML• XML payloads are streamed through the ESB• Pull parsing model

• But for pure routing, load-balancing and header-only mediation we can avoid even this step

• Message relay mode works around this glitch and enables 100% pure streaming of messages• Works regardless of size and format of messages

Page 15: High Volume Web API Management with the WSO2 ESB

Enabling Message Relay

• Enable the binary relay builder (axis2.xml)• Instructs the ESB to stream the incoming messages through

without touching their payloads• Enable the expanding message formatter (axis2.xml)

• Allows the ESB to send messages that were received through the binary relay builder

<messageBuilder contentType="application/xml" class="org.wso2.carbon.relay.BinaryRelayBuilder"/>

<messageFormatter contentType="application/xml" class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>

• Above configuration tells the ESB to process all application/xml messages in message relay mode.

Page 16: High Volume Web API Management with the WSO2 ESB

HTTP Relay Transport

• Brand new in WSO2 ESB 4.0 release• Non blocking HTTP transport implementation

specially designed for streaming messages• Doesn’t require the binary relay builder and

expanding formatter• To enable, simply uncomment the relevant

entries in the axis2.xml file

Page 17: High Volume Web API Management with the WSO2 ESB

Error Handling

In a large scale, high throughput deployment, errors are not unusual – Expect the unexpected

Configure endpoints to gracefully handle the common errors Connection timeouts Connection close/reset Connection refused HTTP protocol violations!!!!

Page 18: High Volume Web API Management with the WSO2 ESB

More on Error Handling

Configure sequences to clearly log errors and if needed notify system administrators

In case the back end server fails to respond, send detailed fault responses to clients – Makes your application more appealing to the customers

Pay attention to HTTP error codes

Page 19: High Volume Web API Management with the WSO2 ESB

Monitoring

In general keep an eye on: CPU usage Memory usage Thread counts Fault counts Latency/Response time Active connections

Page 20: High Volume Web API Management with the WSO2 ESB

Monitoring Tools

Utilities Provided by OS top netstat

Mediation statistics JMX Clients

Jconsole

Page 21: High Volume Web API Management with the WSO2 ESB

Connections

© WSO2 2011

Page 22: High Volume Web API Management with the WSO2 ESB

Endpoints

© WSO2 2011

Page 23: High Volume Web API Management with the WSO2 ESB

Latency

© WSO2 2011

Page 24: High Volume Web API Management with the WSO2 ESB

Listeners

© WSO2 2011

Page 25: High Volume Web API Management with the WSO2 ESB

Memory and Garbage Collection

© WSO2 2011

Page 26: High Volume Web API Management with the WSO2 ESB

S2S Latency

© WSO2 2011

Page 27: High Volume Web API Management with the WSO2 ESB

Threads

© WSO2 2011

Page 28: High Volume Web API Management with the WSO2 ESB

Questions?

28

http://www.flickr.com/photos/oberazzi/