Return-Path: X-Original-To: apmail-hc-httpclient-users-archive@www.apache.org Delivered-To: apmail-hc-httpclient-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F39F06741 for ; Mon, 4 Jul 2011 09:18:36 +0000 (UTC) Received: (qmail 976 invoked by uid 500); 4 Jul 2011 09:18:35 -0000 Delivered-To: apmail-hc-httpclient-users-archive@hc.apache.org Received: (qmail 576 invoked by uid 500); 4 Jul 2011 09:18:21 -0000 Mailing-List: contact httpclient-users-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-users@hc.apache.org Received: (qmail 567 invoked by uid 99); 4 Jul 2011 09:18:14 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Jul 2011 09:18:14 +0000 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests=FREEMAIL_FROM,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lists@nabble.com designates 216.139.236.26 as permitted sender) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Jul 2011 09:18:08 +0000 Received: from isper.nabble.com ([192.168.236.156]) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1QdfHn-0005Kf-8l for httpclient-users@hc.apache.org; Mon, 04 Jul 2011 02:17:47 -0700 Message-ID: <31987905.post@talk.nabble.com> Date: Mon, 4 Jul 2011 02:17:47 -0700 (PDT) From: bnijjhar To: httpclient-users@hc.apache.org Subject: Is it good practice to set the connection timeout for ThreadSafeClientConnManager implementation? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: baljeet.nijjhar@accenture.com X-Virus-Checked: Checked by ClamAV on apache.org Hi I've set the socket timeout for my DefaultHttpClient 4.1.1. However, I'm unsure whether to set the connection timeout. It seems that for an HttpClient using the ThreadSafeClientConnManager, the threads are effectively waiting for a connection from the connection manager's pool (rather than whether the connection has been established). So if the connection manager does not manage to establish the connection within the connection timeout (e.g. 100 ms) for the first thread, then the second thread which might have been waiting from about the same time as the first thread, receives a timeout almost immediately (instead of the connection manager trying again and giving a timeout 100 ms later). I feel that if the size of the connection pool was not tuned carefully, or there was a sudden peak in threads, this would result in threads being timed out just because threads before them were timing out also. Does anyone have any advice? In HttpClient 3.1, there seemed to be two sets of parameters, one for the connection manager to establish the connection, and one for the HttpClient to get a connection from the connection manager (as described in this link http://brian.olore.net/wp/2009/08/apache-httpclient-timeout/) and I think I just want the former? -- View this message in context: http://old.nabble.com/Is-it-good-practice-to-set-the-connection-timeout-for-ThreadSafeClientConnManager-implementation--tp31987905p31987905.html Sent from the HttpClient-User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org For additional commands, e-mail: httpclient-users-help@hc.apache.org