Keep-Alive property in WSO2 ESB

Posted: June 17, 2014 in Uncategorized
Tags: , , , ,

Imagine a scenario where ESB is configured to forward request to a backend service. Client sends request to the ESB, ESB forward the request to the backend service. Backend service send response to the ESB and then ESB forward the response to the client.

When ESB forward the request to the backend service, ESB create a TCP connection with the backend server.  Below is wireshark TCP stream filter for a single TCP stream.

TCP packets exchanging for a single request response

TCP packets exchanging for a single request response

You can see there are multiple TCP packets exchanging. They are
#other ACK s

You will see there are 6 additional TCP packets other than for the data for a single TCP connection. When client sends multiple requests to the same proxy, ESB has to repeat the same task over and over again. Everytime 6 more TCP packets are wasted. Keep-Alive is the way to avoid it. When Keep-Alive is on, ESB does not create TCP connection for every request-response connection, rather it use the same connection to pass data with the backend. The idea is to use a single persistent connection for multiple requests/responses.

Below image clearly show difference  how ESB communicates with the backend when Keep-Alive is turned off and on.


Difference when Keep-Alive is turned on and off

Disable Keep-Alive

By default Keep-Alive is TRUE in ESB. However there might be scenarios where backend service does not support keep-alive. In that case we have to switch off the keep-live as below

<property name="NO_KEEPALIVE" value="true" scope="axis2"/>

Above will not disable Keep-Alive for every meditations. If you want to disable Keep-Alive globally you have to add the property to the repository/conf/ property file as below



  1. Anuruddha says:

    Nice explanation!! Thanks for sharing this.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s