William Speirs wrote:
> 
> On Mon, Dec 5, 2011 at 6:07 PM, mpindyala <[email protected]>
> wrote:
>> We have a java web application which makes calls to 2 of our third party
>> Services using httpclient.
>>
>> Following are the settings for
>> org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManagerr. the numbers
>> are ridiculously high
>> httpclient.defaultMaxPerRoute = 10000
>> httpclient.maxTotalConnections = 20000
>>
>> Socket and connection timeout on
>> org.apache.http.params.HttpConnectionParams
>> are set as
>> httpclient.socketTimeout = 120000ms
>> httpclient.connectionTimeout = 20000ms
>>
>> we have disabled the
>> org.apache.http.params.HttpConnectionParams#setStaleCheckingEnabled =
>> false.
>> we have a cron process running which checks for idle connections using
>> ClientConnectionManager object every 10 seconds and closes expired & idle
>> connections.
> 
> What do you mean a "cron process"? A thread that checks? Why would you
> do this at all? Why wouldn't you let the connection manager handle
> this for you?
> 
> Yes , its just a thread .  We did this to save 10-30ms for each http
> request that application does to back end providers. It seems connection
> manager takes 10-30ms just to close idle and expired connections before
> they can be reused.  Please let us know if there are any pitfalls of doing
> this.
> 
>> We also have retry handler set on
>> org.apache.http.impl.client.DefaultHttpClient. It retries once with a
>> 40ms
>> delay.
>>
>>
>> So questions are as follows
>> 1. Does above setting look ok for you ? if not what are the optimal
>> numbers.
>> Lets say there are 4 third party services we have to call , how should we
>> set these numbers to support that.
> 
> There are no real "optimal numbers" it is more a matter of the service
> level agreement of the 3rd party and the expectations of your program.
> You have a socket timeout of 2 minutes and a connection timeout of 20
> seconds. Those seem high to me, but again, you might be doing
> something which necessitates this.
> 
> The reason we set those numbers high as a protection, our third responds
> within 500ms most of the time.
> It is just when there is something going on between hops , the delay is
> seem.
> So one questions which still needs clarification is 
>  httpclient.defaultMaxPerRoute = 10000
> httpclient.maxTotalConnections = 20000
> 
> is defaultMaxPerRoute  is per third party service we are calling ? if yes
> then 
> if there are 4 services we have to call then settings should be 
> httpclient.defaultMaxPerRoute = 10000
> httpclient.maxTotalConnections = 40000
> Each route getting 10000 , is that assumption correct ?
> 
> 
>> 2. We sometimes get following errors, which are not able to figure out if
>> it
>> is the third party server or httpclient issue. These errors show up
>> during
>> peak volume hitting our servers.
>> a. java.net.SocketException: Connection reset
> 
> Someone correct me if I'm wrong, but I believe this means the server
> close the connection on you. This brings up another important
> question, are you making HTTP 1.0 or 1.1 requests? Keep-Alive?
> 
> we are using 1.1, keep-alive we left default in connection manager , did
> not change anything there.
> 
>> b. :java.net.SocketTimeoutException: Read timed out
> 
> This is somewhat straightforward, you tried to read, but didn't get data
> in 20s.
> 
>> c. org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting
>> for
>> connection
> 
> This is also somewhat straightforward, there was, "A timeout while
> waiting for an available connection from a connection manager." (from
> the Javadocs) How many outstanding requests did you have? Could all
> 1000 be dealing with some long request?
> 
> I would also see if you can enable logging (this can kill performance)
> and maybe scale-back your numbers a bit and see if you can get it to
> happen again? My guess is that you're simply exhausting resources (#
> connections, etc). How many requests were you making at peak times?
> 
> we want to support upto 4M per hour
> 
> Hope this helps...
> 
> Bill-
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/httpclient.defaultMaxPerRoute-and-maxTotalConnections-questions-tp32921044p32924613.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to