Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between web service connection timeout and request timeout

Tags:

java

soap

WebClientTestService service = new WebClientTestService() ;
int connectionTimeOutInMs = 5000;
Map<String,Object> context=((BindingProvider)service).getRequestContext();
context.put("com.sun.xml.internal.ws.connect.timeout", connectionTimeOutInMs);
context.put("com.sun.xml.internal.ws.request.timeout", connectionTimeOutInMs);
context.put("com.sun.xml.ws.request.timeout", connectionTimeOutInMs);
context.put("com.sun.xml.ws.connect.timeout", connectionTimeOutInMs);

Please share the differences mainly in connect timeout and request timeout.

I need to know the recommended values for these parameter values.

What are the criteria for setting timeout value ?

like image 539
Shivani Gauryan Avatar asked Dec 18 '15 11:12

Shivani Gauryan


People also ask

What is request timeout?

The HyperText Transfer Protocol (HTTP) 408 Request Timeout response status code means that the server would like to shut down this unused connection. It is sent on an idle connection by some servers, even without any previous request by the client.

What is Web service timeout?

The timeout property specifies the maximum time (in seconds) to wait for a response to be returned. The value minus one (-1) is the default value. The -1 value causes the property to be ignored, and the underlying web service engine's default value of 300 seconds will be used for the request timeout.

What is the difference between connection timeout and connection refused?

Connection timeout probably means either that the host / port is firewalled, OR the host is "off". Connection refused probably means that the host is not running any service on the port you are trying to connect to.

What is maximum timeout for HTTP request?

The default time out value is 30 seconds. Thus, by default, the server will close the connection if idle for more than 30 seconds. The maximum value for this parameter is 300 seconds (5 minutes).


1 Answers

Please share the differences mainly in connect timeout and request timeout.

I need to know the recommended values for these parameter values.

  • Connect timeout (10s-30s): How long to wait to make an initial connection e.g. if service is currently unavailable.
  • Socket timeout (10s-20s): How long to wait if the service stops responding after data is sent.
  • Request timeout (30s-300s): How long to wait for the entire request to complete.

What are the criteria for setting timeout value ?

It depends a web user will get impatient if nothing has happened after 1-2 minutes, however a back end request could be allowed to run longer.

Also consider server resources are not released until request completes (or times out) - so if you have too many requests and long timeouts your server could run out of resources and be unable to service further requests.

request timeout should be set to a value greater then the expected time for the request to complete, perhaps with some room to allow occasionally slower performance under heavy loads.

connect/socket timeouts are often set lower as normally indicate a server problem where waiting another 10-15s usually won't resolve.

like image 171
shnplr Avatar answered Sep 28 '22 02:09

shnplr