satish marathe
satish marathe

Reputation: 1133

Mule 3 : http listener persistent connections and Connection Idle timeout

I am new to Mule and trying to learn Mule 3 (some of our existing API in production are using Mule 3).

A production application has an HTTPlistener using 'use Persistent connection' and 'connection idle timeout' as default value of 30000 (30 seconds).

My understanding i that if I call the API that listens to the request at this listener from Postman (the REST client), if the request takes more than 30 seconds, it should receive a timeOut error (504).

We added a Thread.sleep in an expression to simulate this behavior.

<expression-component doc:name="Expression"><![CDATA[Thread.sleep(60000);]]></expression-component>

This will cause the sleep to wait for 1 minute, which is greater than 30 seconds configured for a timeout.

However, the request waits for the thread to wake up after 1 minute and returns a successful response.

So I am not sure what is the purpose of 'connection idle timeout' ? Also, what does 'persistent connection' mean ?

The documentation is vague.

Upvotes: 0

Views: 1921

Answers (2)

Sushil
Sushil

Reputation: 1

Simple answer is, when you send the request to the listner it opens up a new connection and send you the response. Since persistent connection setting is enabled, Listner waits for another 30 seconds if any new request coming from the same connection, if not it time outs. if persistent connection setting is disabled it will always create a new connection which is not recommended from performance perspective. In your case, when you are sending the request after 30 seconds or 1 minute a new connection will open and will send you successful response.

Upvotes: 0

aled
aled

Reputation: 25699

HTTP Persistent Connections are a feature of the HTTP protocol, that the connector implements. The connection idle time indicates how long the persistent connection will remain open if there is no activity. It is not related to a response timeout, that is a timeout on the client side and seems to be what you are expecting. In this case the HTTP Listener is the server and Postman is the client.

A response timeout in the client doesn't has an HTTP status response because the request is aborted. You can get a 504 status if the request is against a proxy and the proxy has a client timeout against a backend. The proxy usually returns a 504 in that scenario.

The documentation for connectors assumes that you are familiar with the protocol or backend concepts. In this case the HTTP protocol.

Upvotes: 1

Related Questions