You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Murat Balkan <mr...@gmail.com> on 2016/10/17 17:12:59 UTC

Disabling pooling of PoolingConnectionManager

Hi,

We are using PoolingHttpClientConnectionManager to open up connections to
multiple URL's in different threads (via different HttpGet objects).

The only reason we are using the PoolingHttpClientConnectionManager is its'
performance in multi-thread environments (as suggested by the
documentation).

However, we are not interested in the actual "pooling" functionality.
That's to say, we want to open up a brand new connection even if the route
is the same.

How can we achieve this? We tried to set maxPerroute to 1 but it seems it
is not the correct way.

Regards,
Murat

Re: Disabling pooling of PoolingConnectionManager

Posted by Murat Balkan <mr...@gmail.com>.
Hi,

I both added "Connection close" header to my requests and
NoConnectionReuseStrategy to my HttpClient. (via the builder)

However, I started seeing the Socket Resets now. (which I assume means
HttpClient tries to use an already existing connection which is already
closed, (it is not connection reset by peer, client connection reset ))

Shouldn't NoConnectionReuse strategy cancel this re-use behavior? Can my
setConnectionManager(cm) call overriding HttpClientBuilder parameters?

Thank you,
Murat





On Tue, Oct 18, 2016 at 8:43 PM, Murat Balkan <mr...@gmail.com> wrote:

> it seems we cannot set a strategy to ClosableHttpClient. the only option
> remaining is the header settings.
>
> On Oct 18, 2016 10:41 AM, "Stefan Magnus Landrø" <st...@gmail.com>
> wrote:
>
>> You could do both.
>>
>> From my experience all serious http server implementations respect the
>> Connection: close header
>>
>> 2016-10-18 16:35 GMT+02:00 Murat Balkan <mr...@gmail.com>:
>>
>> > I checked with the RFC and it seems if provided, "connection: close"
>> header
>> > is a MUST rather than SHOULD. So, it should not up to server
>> > implementation. But I find the TTL and Strategy approaches safer as we
>> have
>> > some kind of control over them.
>> >
>> > On Tue, Oct 18, 2016 at 10:26 AM, Stefan Magnus Landrø <
>> > stefan.landro@gmail.com> wrote:
>> >
>> > > Why would you think so?
>> > >
>> > > 2016-10-18 16:10 GMT+02:00 Murat Balkan <mr...@gmail.com>:
>> > >
>> > > > Thanks Oleg,
>> > > > One question. I think it would be up to server implementation
>> whether
>> > to
>> > > > take these parameters into account right?
>> > > > Regards,
>> > > > Murat
>> > > >
>> > > > On Tue, Oct 18, 2016 at 10:06 AM, Oleg Kalnichevski <
>> olegk@apache.org>
>> > > > wrote:
>> > > >
>> > > > > On Mon, 2016-10-17 at 22:06 -0600, Bhowmik, Bindul wrote:
>> > > > > > Murat,
>> > > > > >
>> > > > > > On Mon, Oct 17, 2016 at 8:11 PM, Murat Balkan <
>> mrbalkan@gmail.com>
>> > > > > wrote:
>> > > > > > > I see. I think that also means that I cannot share the
>> > > > > ClosableHttpClient
>> > > > > > > instance among multiple threads as each client can refer to
>> one
>> > > > > connection
>> > > > > > > manager instance.
>> > > > > > >
>> > > > > > > Can connectionreusestrategy be used so that the pooling
>> > connection
>> > > > > manager
>> > > > > > > will always return a new connection regardless of the route
>> > > provided?
>> > > > > >
>> > > > > > I did not think about that, guess you could use the
>> > > > > NoConnectionReuseStrategy
>> > > > > >
>> > > > >
>> > > > > That would be one option. Another option is to manually evict
>> > > persistent
>> > > > > connections from the pool after each transaction. Another option
>> is
>> > to
>> > > > > set connection TTL (total time to live) to some very low value.
>> > Another
>> > > > > option is to simply use 'connection: close' request header.
>> > > > >
>> > > > > Oleg
>> > > > >
>> > > > > > - Bindul
>> > > > > >
>> > > > > > >
>> > > > > > > Regards.
>> > > > > > > Murat
>> > > > > > >
>> > > > > > > On Mon, Oct 17, 2016 at 5:05 PM, Bhowmik, Bindul <
>> > > > > bindulbhowmik@gmail.com>
>> > > > > > > wrote:
>> > > > > > >
>> > > > > > >> Murat,
>> > > > > > >>
>> > > > > > >> On Mon, Oct 17, 2016 at 12:58 PM, Murat Balkan <
>> > > mrbalkan@gmail.com>
>> > > > > wrote:
>> > > > > > >> > Hi Bindul,
>> > > > > > >> > Thanks for the answer.
>> > > > > > >> > I was thinking that using a shared connection manager will
>> > > > increase
>> > > > > the
>> > > > > > >> > performance. What will be the implications of reusing the
>> same
>> > > > > > >> > BasicHttpClientConnectionManager instance?
>> > > > > > >>
>> > > > > > >> If you see the documentation for the
>> > > BasicHttpClientConnectionManag
>> > > > er
>> > > > > > >> [1], you will see that it only maintains one active
>> connection.
>> > If
>> > > > you
>> > > > > > >> share the the instance, your requests will be waiting for the
>> > > > > > >> connection to be available and that will be your bottleneck.
>> > > > > > >>
>> > > > > > >> I would also recommend reading the connection management
>> section
>> > > of
>> > > > > > >> the Http Client documentation [2]
>> > > > > > >>
>> > > > > > >> - Bindul
>> > > > > > >>
>> > > > > > >> [1] http://hc.apache.org/httpcomponents-client-ga/
>> > > > > > >> httpclient/apidocs/org/apache/http/impl/conn/
>> > > > > > >> BasicHttpClientConnectionManager.html
>> > > > > > >> [2] http://hc.apache.org/httpcomponents-client-4.5.x/
>> > > > > > >> tutorial/html/connmgmt.html
>> > > > > > >>
>> > > > > > >> > Regards,
>> > > > > > >> > Murat
>> > > > > > >> >
>> > > > > > >> > On Mon, Oct 17, 2016 at 2:31 PM, Bhowmik, Bindul <
>> > > > > > >> bindulbhowmik@gmail.com>
>> > > > > > >> > wrote:
>> > > > > > >> >
>> > > > > > >> >> Murat,
>> > > > > > >> >>
>> > > > > > >> >> On Mon, Oct 17, 2016 at 11:12 AM, Murat Balkan <
>> > > > mrbalkan@gmail.com
>> > > > > >
>> > > > > > >> wrote:
>> > > > > > >> >> > Hi,
>> > > > > > >> >> >
>> > > > > > >> >> > We are using PoolingHttpClientConnectionManager to
>> open up
>> > > > > > >> connections
>> > > > > > >> >> to
>> > > > > > >> >> > multiple URL's in different threads (via different
>> HttpGet
>> > > > > objects).
>> > > > > > >> >> >
>> > > > > > >> >> > The only reason we are using the
>> > > PoolingHttpClientConnectionMan
>> > > > > ager
>> > > > > > >> is
>> > > > > > >> >> its'
>> > > > > > >> >> > performance in multi-thread environments (as suggested
>> by
>> > the
>> > > > > > >> >> > documentation).
>> > > > > > >> >> >
>> > > > > > >> >> > However, we are not interested in the actual "pooling"
>> > > > > functionality.
>> > > > > > >> >> > That's to say, we want to open up a brand new connection
>> > even
>> > > > if
>> > > > > the
>> > > > > > >> >> route
>> > > > > > >> >> > is the same.
>> > > > > > >> >>
>> > > > > > >> >> The performance enhancements you achieve from
>> > > > > > >> >> PoolingHttpClientConnectionManager are due to its
>> connection
>> > > > > pooling
>> > > > > > >> >> feature, that saves you to cost of establishing the
>> > connection
>> > > > when
>> > > > > > >> >> another request goes to the same route.
>> > > > > > >> >>
>> > > > > > >> >> >
>> > > > > > >> >> > How can we achieve this? We tried to set maxPerroute to
>> 1
>> > but
>> > > > it
>> > > > > > >> seems it
>> > > > > > >> >> > is not the correct way.
>> > > > > > >> >>
>> > > > > > >> >> I have not tested, but setting maxPerRoute to 1 would
>> degrade
>> > > > > > >> >> performance for you as you will have a number of Http
>> clients
>> > > > > waiting
>> > > > > > >> >> for the single connection.
>> > > > > > >> >>
>> > > > > > >> >> If you do not want to use pooled connections, you can use
>> > > > > > >> >> BasicHttpClientConnectionManager and not share it.
>> > > > > > >> >>
>> > > > > > >> >> >
>> > > > > > >> >> > Regards,
>> > > > > > >> >> > Murat
>> > > > > > >> >>
>> > > > > > >> >> ------------------------------
>> ------------------------------
>> > > > > ---------
>> > > > > > >> >> To unsubscribe, e-mail: httpclient-users-unsubscribe@
>> > > > hc.apache.org
>> > > > > > >> >> For additional commands, e-mail: httpclient-users-help@hc.
>> > > > > apache.org
>> > > > > > >> >>
>> > > > > > >> >>
>> > > > > > >> >
>> > > > > > >> >
>> > > > > > >> > --
>> > > > > > >> > Murat Balkan
>> > > > > > >>
>> > > > > > >> ------------------------------------------------------------
>> > > > ---------
>> > > > > > >> To unsubscribe, e-mail: httpclient-users-unsubscribe@
>> > > hc.apache.org
>> > > > > > >> For additional commands, e-mail: httpclient-users-help@hc.
>> > > > apache.org
>> > > > > > >>
>> > > > > > >>
>> > > > > > >
>> > > > > > >
>> > > > > > > --
>> > > > > > > Murat Balkan
>> > > > > >
>> > > > > > ------------------------------------------------------------
>> > > ---------
>> > > > > > To unsubscribe, e-mail: httpclient-users-unsubscribe@h
>> c.apache.org
>> > > > > > For additional commands, e-mail: httpclient-users-help@hc.
>> > apache.org
>> > > > > >
>> > > > >
>> > > > >
>> > > > >
>> > > > > ------------------------------------------------------------
>> > ---------
>> > > > > To unsubscribe, e-mail: httpclient-users-unsubscribe@h
>> c.apache.org
>> > > > > For additional commands, e-mail: httpclient-users-help@hc.apach
>> e.org
>> > > > >
>> > > > >
>> > > >
>> > > >
>> > > > --
>> > > > Murat Balkan
>> > > >
>> > >
>> > >
>> > >
>> > > --
>> > > BEKK Open
>> > > http://open.bekk.no
>> > >
>> > > TesTcl - a unit test framework for iRules
>> > > http://testcl.com
>> > >
>> >
>> >
>> >
>> > --
>> > Murat Balkan
>> >
>>
>>
>>
>> --
>> BEKK Open
>> http://open.bekk.no
>>
>> TesTcl - a unit test framework for iRules
>> http://testcl.com
>>
>


-- 
Murat Balkan

Re: Disabling pooling of PoolingConnectionManager

Posted by Murat Balkan <mr...@gmail.com>.
it seems we cannot set a strategy to ClosableHttpClient. the only option
remaining is the header settings.

On Oct 18, 2016 10:41 AM, "Stefan Magnus Landrø" <st...@gmail.com>
wrote:

> You could do both.
>
> From my experience all serious http server implementations respect the
> Connection: close header
>
> 2016-10-18 16:35 GMT+02:00 Murat Balkan <mr...@gmail.com>:
>
> > I checked with the RFC and it seems if provided, "connection: close"
> header
> > is a MUST rather than SHOULD. So, it should not up to server
> > implementation. But I find the TTL and Strategy approaches safer as we
> have
> > some kind of control over them.
> >
> > On Tue, Oct 18, 2016 at 10:26 AM, Stefan Magnus Landrø <
> > stefan.landro@gmail.com> wrote:
> >
> > > Why would you think so?
> > >
> > > 2016-10-18 16:10 GMT+02:00 Murat Balkan <mr...@gmail.com>:
> > >
> > > > Thanks Oleg,
> > > > One question. I think it would be up to server implementation whether
> > to
> > > > take these parameters into account right?
> > > > Regards,
> > > > Murat
> > > >
> > > > On Tue, Oct 18, 2016 at 10:06 AM, Oleg Kalnichevski <
> olegk@apache.org>
> > > > wrote:
> > > >
> > > > > On Mon, 2016-10-17 at 22:06 -0600, Bhowmik, Bindul wrote:
> > > > > > Murat,
> > > > > >
> > > > > > On Mon, Oct 17, 2016 at 8:11 PM, Murat Balkan <
> mrbalkan@gmail.com>
> > > > > wrote:
> > > > > > > I see. I think that also means that I cannot share the
> > > > > ClosableHttpClient
> > > > > > > instance among multiple threads as each client can refer to one
> > > > > connection
> > > > > > > manager instance.
> > > > > > >
> > > > > > > Can connectionreusestrategy be used so that the pooling
> > connection
> > > > > manager
> > > > > > > will always return a new connection regardless of the route
> > > provided?
> > > > > >
> > > > > > I did not think about that, guess you could use the
> > > > > NoConnectionReuseStrategy
> > > > > >
> > > > >
> > > > > That would be one option. Another option is to manually evict
> > > persistent
> > > > > connections from the pool after each transaction. Another option is
> > to
> > > > > set connection TTL (total time to live) to some very low value.
> > Another
> > > > > option is to simply use 'connection: close' request header.
> > > > >
> > > > > Oleg
> > > > >
> > > > > > - Bindul
> > > > > >
> > > > > > >
> > > > > > > Regards.
> > > > > > > Murat
> > > > > > >
> > > > > > > On Mon, Oct 17, 2016 at 5:05 PM, Bhowmik, Bindul <
> > > > > bindulbhowmik@gmail.com>
> > > > > > > wrote:
> > > > > > >
> > > > > > >> Murat,
> > > > > > >>
> > > > > > >> On Mon, Oct 17, 2016 at 12:58 PM, Murat Balkan <
> > > mrbalkan@gmail.com>
> > > > > wrote:
> > > > > > >> > Hi Bindul,
> > > > > > >> > Thanks for the answer.
> > > > > > >> > I was thinking that using a shared connection manager will
> > > > increase
> > > > > the
> > > > > > >> > performance. What will be the implications of reusing the
> same
> > > > > > >> > BasicHttpClientConnectionManager instance?
> > > > > > >>
> > > > > > >> If you see the documentation for the
> > > BasicHttpClientConnectionManag
> > > > er
> > > > > > >> [1], you will see that it only maintains one active
> connection.
> > If
> > > > you
> > > > > > >> share the the instance, your requests will be waiting for the
> > > > > > >> connection to be available and that will be your bottleneck.
> > > > > > >>
> > > > > > >> I would also recommend reading the connection management
> section
> > > of
> > > > > > >> the Http Client documentation [2]
> > > > > > >>
> > > > > > >> - Bindul
> > > > > > >>
> > > > > > >> [1] http://hc.apache.org/httpcomponents-client-ga/
> > > > > > >> httpclient/apidocs/org/apache/http/impl/conn/
> > > > > > >> BasicHttpClientConnectionManager.html
> > > > > > >> [2] http://hc.apache.org/httpcomponents-client-4.5.x/
> > > > > > >> tutorial/html/connmgmt.html
> > > > > > >>
> > > > > > >> > Regards,
> > > > > > >> > Murat
> > > > > > >> >
> > > > > > >> > On Mon, Oct 17, 2016 at 2:31 PM, Bhowmik, Bindul <
> > > > > > >> bindulbhowmik@gmail.com>
> > > > > > >> > wrote:
> > > > > > >> >
> > > > > > >> >> Murat,
> > > > > > >> >>
> > > > > > >> >> On Mon, Oct 17, 2016 at 11:12 AM, Murat Balkan <
> > > > mrbalkan@gmail.com
> > > > > >
> > > > > > >> wrote:
> > > > > > >> >> > Hi,
> > > > > > >> >> >
> > > > > > >> >> > We are using PoolingHttpClientConnectionManager to open
> up
> > > > > > >> connections
> > > > > > >> >> to
> > > > > > >> >> > multiple URL's in different threads (via different
> HttpGet
> > > > > objects).
> > > > > > >> >> >
> > > > > > >> >> > The only reason we are using the
> > > PoolingHttpClientConnectionMan
> > > > > ager
> > > > > > >> is
> > > > > > >> >> its'
> > > > > > >> >> > performance in multi-thread environments (as suggested by
> > the
> > > > > > >> >> > documentation).
> > > > > > >> >> >
> > > > > > >> >> > However, we are not interested in the actual "pooling"
> > > > > functionality.
> > > > > > >> >> > That's to say, we want to open up a brand new connection
> > even
> > > > if
> > > > > the
> > > > > > >> >> route
> > > > > > >> >> > is the same.
> > > > > > >> >>
> > > > > > >> >> The performance enhancements you achieve from
> > > > > > >> >> PoolingHttpClientConnectionManager are due to its
> connection
> > > > > pooling
> > > > > > >> >> feature, that saves you to cost of establishing the
> > connection
> > > > when
> > > > > > >> >> another request goes to the same route.
> > > > > > >> >>
> > > > > > >> >> >
> > > > > > >> >> > How can we achieve this? We tried to set maxPerroute to 1
> > but
> > > > it
> > > > > > >> seems it
> > > > > > >> >> > is not the correct way.
> > > > > > >> >>
> > > > > > >> >> I have not tested, but setting maxPerRoute to 1 would
> degrade
> > > > > > >> >> performance for you as you will have a number of Http
> clients
> > > > > waiting
> > > > > > >> >> for the single connection.
> > > > > > >> >>
> > > > > > >> >> If you do not want to use pooled connections, you can use
> > > > > > >> >> BasicHttpClientConnectionManager and not share it.
> > > > > > >> >>
> > > > > > >> >> >
> > > > > > >> >> > Regards,
> > > > > > >> >> > Murat
> > > > > > >> >>
> > > > > > >> >> ------------------------------
> ------------------------------
> > > > > ---------
> > > > > > >> >> To unsubscribe, e-mail: httpclient-users-unsubscribe@
> > > > hc.apache.org
> > > > > > >> >> For additional commands, e-mail: httpclient-users-help@hc.
> > > > > apache.org
> > > > > > >> >>
> > > > > > >> >>
> > > > > > >> >
> > > > > > >> >
> > > > > > >> > --
> > > > > > >> > Murat Balkan
> > > > > > >>
> > > > > > >> ------------------------------------------------------------
> > > > ---------
> > > > > > >> To unsubscribe, e-mail: httpclient-users-unsubscribe@
> > > hc.apache.org
> > > > > > >> For additional commands, e-mail: httpclient-users-help@hc.
> > > > apache.org
> > > > > > >>
> > > > > > >>
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > Murat Balkan
> > > > > >
> > > > > > ------------------------------------------------------------
> > > ---------
> > > > > > To unsubscribe, e-mail: httpclient-users-unsubscribe@
> hc.apache.org
> > > > > > For additional commands, e-mail: httpclient-users-help@hc.
> > apache.org
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > ------------------------------------------------------------
> > ---------
> > > > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > > > > For additional commands, e-mail: httpclient-users-help@hc.
> apache.org
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Murat Balkan
> > > >
> > >
> > >
> > >
> > > --
> > > BEKK Open
> > > http://open.bekk.no
> > >
> > > TesTcl - a unit test framework for iRules
> > > http://testcl.com
> > >
> >
> >
> >
> > --
> > Murat Balkan
> >
>
>
>
> --
> BEKK Open
> http://open.bekk.no
>
> TesTcl - a unit test framework for iRules
> http://testcl.com
>

Re: Disabling pooling of PoolingConnectionManager

Posted by Stefan Magnus Landrø <st...@gmail.com>.
You could do both.

From my experience all serious http server implementations respect the
Connection: close header

2016-10-18 16:35 GMT+02:00 Murat Balkan <mr...@gmail.com>:

> I checked with the RFC and it seems if provided, "connection: close" header
> is a MUST rather than SHOULD. So, it should not up to server
> implementation. But I find the TTL and Strategy approaches safer as we have
> some kind of control over them.
>
> On Tue, Oct 18, 2016 at 10:26 AM, Stefan Magnus Landrø <
> stefan.landro@gmail.com> wrote:
>
> > Why would you think so?
> >
> > 2016-10-18 16:10 GMT+02:00 Murat Balkan <mr...@gmail.com>:
> >
> > > Thanks Oleg,
> > > One question. I think it would be up to server implementation whether
> to
> > > take these parameters into account right?
> > > Regards,
> > > Murat
> > >
> > > On Tue, Oct 18, 2016 at 10:06 AM, Oleg Kalnichevski <ol...@apache.org>
> > > wrote:
> > >
> > > > On Mon, 2016-10-17 at 22:06 -0600, Bhowmik, Bindul wrote:
> > > > > Murat,
> > > > >
> > > > > On Mon, Oct 17, 2016 at 8:11 PM, Murat Balkan <mr...@gmail.com>
> > > > wrote:
> > > > > > I see. I think that also means that I cannot share the
> > > > ClosableHttpClient
> > > > > > instance among multiple threads as each client can refer to one
> > > > connection
> > > > > > manager instance.
> > > > > >
> > > > > > Can connectionreusestrategy be used so that the pooling
> connection
> > > > manager
> > > > > > will always return a new connection regardless of the route
> > provided?
> > > > >
> > > > > I did not think about that, guess you could use the
> > > > NoConnectionReuseStrategy
> > > > >
> > > >
> > > > That would be one option. Another option is to manually evict
> > persistent
> > > > connections from the pool after each transaction. Another option is
> to
> > > > set connection TTL (total time to live) to some very low value.
> Another
> > > > option is to simply use 'connection: close' request header.
> > > >
> > > > Oleg
> > > >
> > > > > - Bindul
> > > > >
> > > > > >
> > > > > > Regards.
> > > > > > Murat
> > > > > >
> > > > > > On Mon, Oct 17, 2016 at 5:05 PM, Bhowmik, Bindul <
> > > > bindulbhowmik@gmail.com>
> > > > > > wrote:
> > > > > >
> > > > > >> Murat,
> > > > > >>
> > > > > >> On Mon, Oct 17, 2016 at 12:58 PM, Murat Balkan <
> > mrbalkan@gmail.com>
> > > > wrote:
> > > > > >> > Hi Bindul,
> > > > > >> > Thanks for the answer.
> > > > > >> > I was thinking that using a shared connection manager will
> > > increase
> > > > the
> > > > > >> > performance. What will be the implications of reusing the same
> > > > > >> > BasicHttpClientConnectionManager instance?
> > > > > >>
> > > > > >> If you see the documentation for the
> > BasicHttpClientConnectionManag
> > > er
> > > > > >> [1], you will see that it only maintains one active connection.
> If
> > > you
> > > > > >> share the the instance, your requests will be waiting for the
> > > > > >> connection to be available and that will be your bottleneck.
> > > > > >>
> > > > > >> I would also recommend reading the connection management section
> > of
> > > > > >> the Http Client documentation [2]
> > > > > >>
> > > > > >> - Bindul
> > > > > >>
> > > > > >> [1] http://hc.apache.org/httpcomponents-client-ga/
> > > > > >> httpclient/apidocs/org/apache/http/impl/conn/
> > > > > >> BasicHttpClientConnectionManager.html
> > > > > >> [2] http://hc.apache.org/httpcomponents-client-4.5.x/
> > > > > >> tutorial/html/connmgmt.html
> > > > > >>
> > > > > >> > Regards,
> > > > > >> > Murat
> > > > > >> >
> > > > > >> > On Mon, Oct 17, 2016 at 2:31 PM, Bhowmik, Bindul <
> > > > > >> bindulbhowmik@gmail.com>
> > > > > >> > wrote:
> > > > > >> >
> > > > > >> >> Murat,
> > > > > >> >>
> > > > > >> >> On Mon, Oct 17, 2016 at 11:12 AM, Murat Balkan <
> > > mrbalkan@gmail.com
> > > > >
> > > > > >> wrote:
> > > > > >> >> > Hi,
> > > > > >> >> >
> > > > > >> >> > We are using PoolingHttpClientConnectionManager to open up
> > > > > >> connections
> > > > > >> >> to
> > > > > >> >> > multiple URL's in different threads (via different HttpGet
> > > > objects).
> > > > > >> >> >
> > > > > >> >> > The only reason we are using the
> > PoolingHttpClientConnectionMan
> > > > ager
> > > > > >> is
> > > > > >> >> its'
> > > > > >> >> > performance in multi-thread environments (as suggested by
> the
> > > > > >> >> > documentation).
> > > > > >> >> >
> > > > > >> >> > However, we are not interested in the actual "pooling"
> > > > functionality.
> > > > > >> >> > That's to say, we want to open up a brand new connection
> even
> > > if
> > > > the
> > > > > >> >> route
> > > > > >> >> > is the same.
> > > > > >> >>
> > > > > >> >> The performance enhancements you achieve from
> > > > > >> >> PoolingHttpClientConnectionManager are due to its connection
> > > > pooling
> > > > > >> >> feature, that saves you to cost of establishing the
> connection
> > > when
> > > > > >> >> another request goes to the same route.
> > > > > >> >>
> > > > > >> >> >
> > > > > >> >> > How can we achieve this? We tried to set maxPerroute to 1
> but
> > > it
> > > > > >> seems it
> > > > > >> >> > is not the correct way.
> > > > > >> >>
> > > > > >> >> I have not tested, but setting maxPerRoute to 1 would degrade
> > > > > >> >> performance for you as you will have a number of Http clients
> > > > waiting
> > > > > >> >> for the single connection.
> > > > > >> >>
> > > > > >> >> If you do not want to use pooled connections, you can use
> > > > > >> >> BasicHttpClientConnectionManager and not share it.
> > > > > >> >>
> > > > > >> >> >
> > > > > >> >> > Regards,
> > > > > >> >> > Murat
> > > > > >> >>
> > > > > >> >> ------------------------------------------------------------
> > > > ---------
> > > > > >> >> To unsubscribe, e-mail: httpclient-users-unsubscribe@
> > > hc.apache.org
> > > > > >> >> For additional commands, e-mail: httpclient-users-help@hc.
> > > > apache.org
> > > > > >> >>
> > > > > >> >>
> > > > > >> >
> > > > > >> >
> > > > > >> > --
> > > > > >> > Murat Balkan
> > > > > >>
> > > > > >> ------------------------------------------------------------
> > > ---------
> > > > > >> To unsubscribe, e-mail: httpclient-users-unsubscribe@
> > hc.apache.org
> > > > > >> For additional commands, e-mail: httpclient-users-help@hc.
> > > apache.org
> > > > > >>
> > > > > >>
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Murat Balkan
> > > > >
> > > > > ------------------------------------------------------------
> > ---------
> > > > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > > > > For additional commands, e-mail: httpclient-users-help@hc.
> apache.org
> > > > >
> > > >
> > > >
> > > >
> > > > ------------------------------------------------------------
> ---------
> > > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > > > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > Murat Balkan
> > >
> >
> >
> >
> > --
> > BEKK Open
> > http://open.bekk.no
> >
> > TesTcl - a unit test framework for iRules
> > http://testcl.com
> >
>
>
>
> --
> Murat Balkan
>



-- 
BEKK Open
http://open.bekk.no

TesTcl - a unit test framework for iRules
http://testcl.com

Re: Disabling pooling of PoolingConnectionManager

Posted by Murat Balkan <mr...@gmail.com>.
I checked with the RFC and it seems if provided, "connection: close" header
is a MUST rather than SHOULD. So, it should not up to server
implementation. But I find the TTL and Strategy approaches safer as we have
some kind of control over them.

On Tue, Oct 18, 2016 at 10:26 AM, Stefan Magnus Landrø <
stefan.landro@gmail.com> wrote:

> Why would you think so?
>
> 2016-10-18 16:10 GMT+02:00 Murat Balkan <mr...@gmail.com>:
>
> > Thanks Oleg,
> > One question. I think it would be up to server implementation whether to
> > take these parameters into account right?
> > Regards,
> > Murat
> >
> > On Tue, Oct 18, 2016 at 10:06 AM, Oleg Kalnichevski <ol...@apache.org>
> > wrote:
> >
> > > On Mon, 2016-10-17 at 22:06 -0600, Bhowmik, Bindul wrote:
> > > > Murat,
> > > >
> > > > On Mon, Oct 17, 2016 at 8:11 PM, Murat Balkan <mr...@gmail.com>
> > > wrote:
> > > > > I see. I think that also means that I cannot share the
> > > ClosableHttpClient
> > > > > instance among multiple threads as each client can refer to one
> > > connection
> > > > > manager instance.
> > > > >
> > > > > Can connectionreusestrategy be used so that the pooling connection
> > > manager
> > > > > will always return a new connection regardless of the route
> provided?
> > > >
> > > > I did not think about that, guess you could use the
> > > NoConnectionReuseStrategy
> > > >
> > >
> > > That would be one option. Another option is to manually evict
> persistent
> > > connections from the pool after each transaction. Another option is to
> > > set connection TTL (total time to live) to some very low value. Another
> > > option is to simply use 'connection: close' request header.
> > >
> > > Oleg
> > >
> > > > - Bindul
> > > >
> > > > >
> > > > > Regards.
> > > > > Murat
> > > > >
> > > > > On Mon, Oct 17, 2016 at 5:05 PM, Bhowmik, Bindul <
> > > bindulbhowmik@gmail.com>
> > > > > wrote:
> > > > >
> > > > >> Murat,
> > > > >>
> > > > >> On Mon, Oct 17, 2016 at 12:58 PM, Murat Balkan <
> mrbalkan@gmail.com>
> > > wrote:
> > > > >> > Hi Bindul,
> > > > >> > Thanks for the answer.
> > > > >> > I was thinking that using a shared connection manager will
> > increase
> > > the
> > > > >> > performance. What will be the implications of reusing the same
> > > > >> > BasicHttpClientConnectionManager instance?
> > > > >>
> > > > >> If you see the documentation for the
> BasicHttpClientConnectionManag
> > er
> > > > >> [1], you will see that it only maintains one active connection. If
> > you
> > > > >> share the the instance, your requests will be waiting for the
> > > > >> connection to be available and that will be your bottleneck.
> > > > >>
> > > > >> I would also recommend reading the connection management section
> of
> > > > >> the Http Client documentation [2]
> > > > >>
> > > > >> - Bindul
> > > > >>
> > > > >> [1] http://hc.apache.org/httpcomponents-client-ga/
> > > > >> httpclient/apidocs/org/apache/http/impl/conn/
> > > > >> BasicHttpClientConnectionManager.html
> > > > >> [2] http://hc.apache.org/httpcomponents-client-4.5.x/
> > > > >> tutorial/html/connmgmt.html
> > > > >>
> > > > >> > Regards,
> > > > >> > Murat
> > > > >> >
> > > > >> > On Mon, Oct 17, 2016 at 2:31 PM, Bhowmik, Bindul <
> > > > >> bindulbhowmik@gmail.com>
> > > > >> > wrote:
> > > > >> >
> > > > >> >> Murat,
> > > > >> >>
> > > > >> >> On Mon, Oct 17, 2016 at 11:12 AM, Murat Balkan <
> > mrbalkan@gmail.com
> > > >
> > > > >> wrote:
> > > > >> >> > Hi,
> > > > >> >> >
> > > > >> >> > We are using PoolingHttpClientConnectionManager to open up
> > > > >> connections
> > > > >> >> to
> > > > >> >> > multiple URL's in different threads (via different HttpGet
> > > objects).
> > > > >> >> >
> > > > >> >> > The only reason we are using the
> PoolingHttpClientConnectionMan
> > > ager
> > > > >> is
> > > > >> >> its'
> > > > >> >> > performance in multi-thread environments (as suggested by the
> > > > >> >> > documentation).
> > > > >> >> >
> > > > >> >> > However, we are not interested in the actual "pooling"
> > > functionality.
> > > > >> >> > That's to say, we want to open up a brand new connection even
> > if
> > > the
> > > > >> >> route
> > > > >> >> > is the same.
> > > > >> >>
> > > > >> >> The performance enhancements you achieve from
> > > > >> >> PoolingHttpClientConnectionManager are due to its connection
> > > pooling
> > > > >> >> feature, that saves you to cost of establishing the connection
> > when
> > > > >> >> another request goes to the same route.
> > > > >> >>
> > > > >> >> >
> > > > >> >> > How can we achieve this? We tried to set maxPerroute to 1 but
> > it
> > > > >> seems it
> > > > >> >> > is not the correct way.
> > > > >> >>
> > > > >> >> I have not tested, but setting maxPerRoute to 1 would degrade
> > > > >> >> performance for you as you will have a number of Http clients
> > > waiting
> > > > >> >> for the single connection.
> > > > >> >>
> > > > >> >> If you do not want to use pooled connections, you can use
> > > > >> >> BasicHttpClientConnectionManager and not share it.
> > > > >> >>
> > > > >> >> >
> > > > >> >> > Regards,
> > > > >> >> > Murat
> > > > >> >>
> > > > >> >> ------------------------------------------------------------
> > > ---------
> > > > >> >> To unsubscribe, e-mail: httpclient-users-unsubscribe@
> > hc.apache.org
> > > > >> >> For additional commands, e-mail: httpclient-users-help@hc.
> > > apache.org
> > > > >> >>
> > > > >> >>
> > > > >> >
> > > > >> >
> > > > >> > --
> > > > >> > Murat Balkan
> > > > >>
> > > > >> ------------------------------------------------------------
> > ---------
> > > > >> To unsubscribe, e-mail: httpclient-users-unsubscribe@
> hc.apache.org
> > > > >> For additional commands, e-mail: httpclient-users-help@hc.
> > apache.org
> > > > >>
> > > > >>
> > > > >
> > > > >
> > > > > --
> > > > > Murat Balkan
> > > >
> > > > ------------------------------------------------------------
> ---------
> > > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > > > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> > > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> > >
> > >
> >
> >
> > --
> > Murat Balkan
> >
>
>
>
> --
> BEKK Open
> http://open.bekk.no
>
> TesTcl - a unit test framework for iRules
> http://testcl.com
>



-- 
Murat Balkan

Re: Disabling pooling of PoolingConnectionManager

Posted by Stefan Magnus Landrø <st...@gmail.com>.
Why would you think so?

2016-10-18 16:10 GMT+02:00 Murat Balkan <mr...@gmail.com>:

> Thanks Oleg,
> One question. I think it would be up to server implementation whether to
> take these parameters into account right?
> Regards,
> Murat
>
> On Tue, Oct 18, 2016 at 10:06 AM, Oleg Kalnichevski <ol...@apache.org>
> wrote:
>
> > On Mon, 2016-10-17 at 22:06 -0600, Bhowmik, Bindul wrote:
> > > Murat,
> > >
> > > On Mon, Oct 17, 2016 at 8:11 PM, Murat Balkan <mr...@gmail.com>
> > wrote:
> > > > I see. I think that also means that I cannot share the
> > ClosableHttpClient
> > > > instance among multiple threads as each client can refer to one
> > connection
> > > > manager instance.
> > > >
> > > > Can connectionreusestrategy be used so that the pooling connection
> > manager
> > > > will always return a new connection regardless of the route provided?
> > >
> > > I did not think about that, guess you could use the
> > NoConnectionReuseStrategy
> > >
> >
> > That would be one option. Another option is to manually evict persistent
> > connections from the pool after each transaction. Another option is to
> > set connection TTL (total time to live) to some very low value. Another
> > option is to simply use 'connection: close' request header.
> >
> > Oleg
> >
> > > - Bindul
> > >
> > > >
> > > > Regards.
> > > > Murat
> > > >
> > > > On Mon, Oct 17, 2016 at 5:05 PM, Bhowmik, Bindul <
> > bindulbhowmik@gmail.com>
> > > > wrote:
> > > >
> > > >> Murat,
> > > >>
> > > >> On Mon, Oct 17, 2016 at 12:58 PM, Murat Balkan <mr...@gmail.com>
> > wrote:
> > > >> > Hi Bindul,
> > > >> > Thanks for the answer.
> > > >> > I was thinking that using a shared connection manager will
> increase
> > the
> > > >> > performance. What will be the implications of reusing the same
> > > >> > BasicHttpClientConnectionManager instance?
> > > >>
> > > >> If you see the documentation for the BasicHttpClientConnectionManag
> er
> > > >> [1], you will see that it only maintains one active connection. If
> you
> > > >> share the the instance, your requests will be waiting for the
> > > >> connection to be available and that will be your bottleneck.
> > > >>
> > > >> I would also recommend reading the connection management section of
> > > >> the Http Client documentation [2]
> > > >>
> > > >> - Bindul
> > > >>
> > > >> [1] http://hc.apache.org/httpcomponents-client-ga/
> > > >> httpclient/apidocs/org/apache/http/impl/conn/
> > > >> BasicHttpClientConnectionManager.html
> > > >> [2] http://hc.apache.org/httpcomponents-client-4.5.x/
> > > >> tutorial/html/connmgmt.html
> > > >>
> > > >> > Regards,
> > > >> > Murat
> > > >> >
> > > >> > On Mon, Oct 17, 2016 at 2:31 PM, Bhowmik, Bindul <
> > > >> bindulbhowmik@gmail.com>
> > > >> > wrote:
> > > >> >
> > > >> >> Murat,
> > > >> >>
> > > >> >> On Mon, Oct 17, 2016 at 11:12 AM, Murat Balkan <
> mrbalkan@gmail.com
> > >
> > > >> wrote:
> > > >> >> > Hi,
> > > >> >> >
> > > >> >> > We are using PoolingHttpClientConnectionManager to open up
> > > >> connections
> > > >> >> to
> > > >> >> > multiple URL's in different threads (via different HttpGet
> > objects).
> > > >> >> >
> > > >> >> > The only reason we are using the PoolingHttpClientConnectionMan
> > ager
> > > >> is
> > > >> >> its'
> > > >> >> > performance in multi-thread environments (as suggested by the
> > > >> >> > documentation).
> > > >> >> >
> > > >> >> > However, we are not interested in the actual "pooling"
> > functionality.
> > > >> >> > That's to say, we want to open up a brand new connection even
> if
> > the
> > > >> >> route
> > > >> >> > is the same.
> > > >> >>
> > > >> >> The performance enhancements you achieve from
> > > >> >> PoolingHttpClientConnectionManager are due to its connection
> > pooling
> > > >> >> feature, that saves you to cost of establishing the connection
> when
> > > >> >> another request goes to the same route.
> > > >> >>
> > > >> >> >
> > > >> >> > How can we achieve this? We tried to set maxPerroute to 1 but
> it
> > > >> seems it
> > > >> >> > is not the correct way.
> > > >> >>
> > > >> >> I have not tested, but setting maxPerRoute to 1 would degrade
> > > >> >> performance for you as you will have a number of Http clients
> > waiting
> > > >> >> for the single connection.
> > > >> >>
> > > >> >> If you do not want to use pooled connections, you can use
> > > >> >> BasicHttpClientConnectionManager and not share it.
> > > >> >>
> > > >> >> >
> > > >> >> > Regards,
> > > >> >> > Murat
> > > >> >>
> > > >> >> ------------------------------------------------------------
> > ---------
> > > >> >> To unsubscribe, e-mail: httpclient-users-unsubscribe@
> hc.apache.org
> > > >> >> For additional commands, e-mail: httpclient-users-help@hc.
> > apache.org
> > > >> >>
> > > >> >>
> > > >> >
> > > >> >
> > > >> > --
> > > >> > Murat Balkan
> > > >>
> > > >> ------------------------------------------------------------
> ---------
> > > >> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > > >> For additional commands, e-mail: httpclient-users-help@hc.
> apache.org
> > > >>
> > > >>
> > > >
> > > >
> > > > --
> > > > Murat Balkan
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> > >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> >
> >
>
>
> --
> Murat Balkan
>



-- 
BEKK Open
http://open.bekk.no

TesTcl - a unit test framework for iRules
http://testcl.com

Re: Disabling pooling of PoolingConnectionManager

Posted by Murat Balkan <mr...@gmail.com>.
Thanks Oleg,
One question. I think it would be up to server implementation whether to
take these parameters into account right?
Regards,
Murat

On Tue, Oct 18, 2016 at 10:06 AM, Oleg Kalnichevski <ol...@apache.org>
wrote:

> On Mon, 2016-10-17 at 22:06 -0600, Bhowmik, Bindul wrote:
> > Murat,
> >
> > On Mon, Oct 17, 2016 at 8:11 PM, Murat Balkan <mr...@gmail.com>
> wrote:
> > > I see. I think that also means that I cannot share the
> ClosableHttpClient
> > > instance among multiple threads as each client can refer to one
> connection
> > > manager instance.
> > >
> > > Can connectionreusestrategy be used so that the pooling connection
> manager
> > > will always return a new connection regardless of the route provided?
> >
> > I did not think about that, guess you could use the
> NoConnectionReuseStrategy
> >
>
> That would be one option. Another option is to manually evict persistent
> connections from the pool after each transaction. Another option is to
> set connection TTL (total time to live) to some very low value. Another
> option is to simply use 'connection: close' request header.
>
> Oleg
>
> > - Bindul
> >
> > >
> > > Regards.
> > > Murat
> > >
> > > On Mon, Oct 17, 2016 at 5:05 PM, Bhowmik, Bindul <
> bindulbhowmik@gmail.com>
> > > wrote:
> > >
> > >> Murat,
> > >>
> > >> On Mon, Oct 17, 2016 at 12:58 PM, Murat Balkan <mr...@gmail.com>
> wrote:
> > >> > Hi Bindul,
> > >> > Thanks for the answer.
> > >> > I was thinking that using a shared connection manager will increase
> the
> > >> > performance. What will be the implications of reusing the same
> > >> > BasicHttpClientConnectionManager instance?
> > >>
> > >> If you see the documentation for the BasicHttpClientConnectionManager
> > >> [1], you will see that it only maintains one active connection. If you
> > >> share the the instance, your requests will be waiting for the
> > >> connection to be available and that will be your bottleneck.
> > >>
> > >> I would also recommend reading the connection management section of
> > >> the Http Client documentation [2]
> > >>
> > >> - Bindul
> > >>
> > >> [1] http://hc.apache.org/httpcomponents-client-ga/
> > >> httpclient/apidocs/org/apache/http/impl/conn/
> > >> BasicHttpClientConnectionManager.html
> > >> [2] http://hc.apache.org/httpcomponents-client-4.5.x/
> > >> tutorial/html/connmgmt.html
> > >>
> > >> > Regards,
> > >> > Murat
> > >> >
> > >> > On Mon, Oct 17, 2016 at 2:31 PM, Bhowmik, Bindul <
> > >> bindulbhowmik@gmail.com>
> > >> > wrote:
> > >> >
> > >> >> Murat,
> > >> >>
> > >> >> On Mon, Oct 17, 2016 at 11:12 AM, Murat Balkan <mrbalkan@gmail.com
> >
> > >> wrote:
> > >> >> > Hi,
> > >> >> >
> > >> >> > We are using PoolingHttpClientConnectionManager to open up
> > >> connections
> > >> >> to
> > >> >> > multiple URL's in different threads (via different HttpGet
> objects).
> > >> >> >
> > >> >> > The only reason we are using the PoolingHttpClientConnectionMan
> ager
> > >> is
> > >> >> its'
> > >> >> > performance in multi-thread environments (as suggested by the
> > >> >> > documentation).
> > >> >> >
> > >> >> > However, we are not interested in the actual "pooling"
> functionality.
> > >> >> > That's to say, we want to open up a brand new connection even if
> the
> > >> >> route
> > >> >> > is the same.
> > >> >>
> > >> >> The performance enhancements you achieve from
> > >> >> PoolingHttpClientConnectionManager are due to its connection
> pooling
> > >> >> feature, that saves you to cost of establishing the connection when
> > >> >> another request goes to the same route.
> > >> >>
> > >> >> >
> > >> >> > How can we achieve this? We tried to set maxPerroute to 1 but it
> > >> seems it
> > >> >> > is not the correct way.
> > >> >>
> > >> >> I have not tested, but setting maxPerRoute to 1 would degrade
> > >> >> performance for you as you will have a number of Http clients
> waiting
> > >> >> for the single connection.
> > >> >>
> > >> >> If you do not want to use pooled connections, you can use
> > >> >> BasicHttpClientConnectionManager and not share it.
> > >> >>
> > >> >> >
> > >> >> > Regards,
> > >> >> > Murat
> > >> >>
> > >> >> ------------------------------------------------------------
> ---------
> > >> >> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > >> >> For additional commands, e-mail: httpclient-users-help@hc.
> apache.org
> > >> >>
> > >> >>
> > >> >
> > >> >
> > >> > --
> > >> > Murat Balkan
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > >> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> > >>
> > >>
> > >
> > >
> > > --
> > > Murat Balkan
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>


-- 
Murat Balkan

Re: Disabling pooling of PoolingConnectionManager

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, 2016-10-17 at 22:06 -0600, Bhowmik, Bindul wrote:
> Murat,
> 
> On Mon, Oct 17, 2016 at 8:11 PM, Murat Balkan <mr...@gmail.com> wrote:
> > I see. I think that also means that I cannot share the ClosableHttpClient
> > instance among multiple threads as each client can refer to one connection
> > manager instance.
> >
> > Can connectionreusestrategy be used so that the pooling connection manager
> > will always return a new connection regardless of the route provided?
> 
> I did not think about that, guess you could use the NoConnectionReuseStrategy
> 

That would be one option. Another option is to manually evict persistent
connections from the pool after each transaction. Another option is to
set connection TTL (total time to live) to some very low value. Another
option is to simply use 'connection: close' request header.

Oleg  

> - Bindul
> 
> >
> > Regards.
> > Murat
> >
> > On Mon, Oct 17, 2016 at 5:05 PM, Bhowmik, Bindul <bi...@gmail.com>
> > wrote:
> >
> >> Murat,
> >>
> >> On Mon, Oct 17, 2016 at 12:58 PM, Murat Balkan <mr...@gmail.com> wrote:
> >> > Hi Bindul,
> >> > Thanks for the answer.
> >> > I was thinking that using a shared connection manager will increase the
> >> > performance. What will be the implications of reusing the same
> >> > BasicHttpClientConnectionManager instance?
> >>
> >> If you see the documentation for the BasicHttpClientConnectionManager
> >> [1], you will see that it only maintains one active connection. If you
> >> share the the instance, your requests will be waiting for the
> >> connection to be available and that will be your bottleneck.
> >>
> >> I would also recommend reading the connection management section of
> >> the Http Client documentation [2]
> >>
> >> - Bindul
> >>
> >> [1] http://hc.apache.org/httpcomponents-client-ga/
> >> httpclient/apidocs/org/apache/http/impl/conn/
> >> BasicHttpClientConnectionManager.html
> >> [2] http://hc.apache.org/httpcomponents-client-4.5.x/
> >> tutorial/html/connmgmt.html
> >>
> >> > Regards,
> >> > Murat
> >> >
> >> > On Mon, Oct 17, 2016 at 2:31 PM, Bhowmik, Bindul <
> >> bindulbhowmik@gmail.com>
> >> > wrote:
> >> >
> >> >> Murat,
> >> >>
> >> >> On Mon, Oct 17, 2016 at 11:12 AM, Murat Balkan <mr...@gmail.com>
> >> wrote:
> >> >> > Hi,
> >> >> >
> >> >> > We are using PoolingHttpClientConnectionManager to open up
> >> connections
> >> >> to
> >> >> > multiple URL's in different threads (via different HttpGet objects).
> >> >> >
> >> >> > The only reason we are using the PoolingHttpClientConnectionManager
> >> is
> >> >> its'
> >> >> > performance in multi-thread environments (as suggested by the
> >> >> > documentation).
> >> >> >
> >> >> > However, we are not interested in the actual "pooling" functionality.
> >> >> > That's to say, we want to open up a brand new connection even if the
> >> >> route
> >> >> > is the same.
> >> >>
> >> >> The performance enhancements you achieve from
> >> >> PoolingHttpClientConnectionManager are due to its connection pooling
> >> >> feature, that saves you to cost of establishing the connection when
> >> >> another request goes to the same route.
> >> >>
> >> >> >
> >> >> > How can we achieve this? We tried to set maxPerroute to 1 but it
> >> seems it
> >> >> > is not the correct way.
> >> >>
> >> >> I have not tested, but setting maxPerRoute to 1 would degrade
> >> >> performance for you as you will have a number of Http clients waiting
> >> >> for the single connection.
> >> >>
> >> >> If you do not want to use pooled connections, you can use
> >> >> BasicHttpClientConnectionManager and not share it.
> >> >>
> >> >> >
> >> >> > Regards,
> >> >> > Murat
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> >> >> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> >> >>
> >> >>
> >> >
> >> >
> >> > --
> >> > Murat Balkan
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> >> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> >>
> >>
> >
> >
> > --
> > Murat Balkan
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: Disabling pooling of PoolingConnectionManager

Posted by "Bhowmik, Bindul" <bi...@gmail.com>.
Murat,

On Mon, Oct 17, 2016 at 8:11 PM, Murat Balkan <mr...@gmail.com> wrote:
> I see. I think that also means that I cannot share the ClosableHttpClient
> instance among multiple threads as each client can refer to one connection
> manager instance.
>
> Can connectionreusestrategy be used so that the pooling connection manager
> will always return a new connection regardless of the route provided?

I did not think about that, guess you could use the NoConnectionReuseStrategy

- Bindul

>
> Regards.
> Murat
>
> On Mon, Oct 17, 2016 at 5:05 PM, Bhowmik, Bindul <bi...@gmail.com>
> wrote:
>
>> Murat,
>>
>> On Mon, Oct 17, 2016 at 12:58 PM, Murat Balkan <mr...@gmail.com> wrote:
>> > Hi Bindul,
>> > Thanks for the answer.
>> > I was thinking that using a shared connection manager will increase the
>> > performance. What will be the implications of reusing the same
>> > BasicHttpClientConnectionManager instance?
>>
>> If you see the documentation for the BasicHttpClientConnectionManager
>> [1], you will see that it only maintains one active connection. If you
>> share the the instance, your requests will be waiting for the
>> connection to be available and that will be your bottleneck.
>>
>> I would also recommend reading the connection management section of
>> the Http Client documentation [2]
>>
>> - Bindul
>>
>> [1] http://hc.apache.org/httpcomponents-client-ga/
>> httpclient/apidocs/org/apache/http/impl/conn/
>> BasicHttpClientConnectionManager.html
>> [2] http://hc.apache.org/httpcomponents-client-4.5.x/
>> tutorial/html/connmgmt.html
>>
>> > Regards,
>> > Murat
>> >
>> > On Mon, Oct 17, 2016 at 2:31 PM, Bhowmik, Bindul <
>> bindulbhowmik@gmail.com>
>> > wrote:
>> >
>> >> Murat,
>> >>
>> >> On Mon, Oct 17, 2016 at 11:12 AM, Murat Balkan <mr...@gmail.com>
>> wrote:
>> >> > Hi,
>> >> >
>> >> > We are using PoolingHttpClientConnectionManager to open up
>> connections
>> >> to
>> >> > multiple URL's in different threads (via different HttpGet objects).
>> >> >
>> >> > The only reason we are using the PoolingHttpClientConnectionManager
>> is
>> >> its'
>> >> > performance in multi-thread environments (as suggested by the
>> >> > documentation).
>> >> >
>> >> > However, we are not interested in the actual "pooling" functionality.
>> >> > That's to say, we want to open up a brand new connection even if the
>> >> route
>> >> > is the same.
>> >>
>> >> The performance enhancements you achieve from
>> >> PoolingHttpClientConnectionManager are due to its connection pooling
>> >> feature, that saves you to cost of establishing the connection when
>> >> another request goes to the same route.
>> >>
>> >> >
>> >> > How can we achieve this? We tried to set maxPerroute to 1 but it
>> seems it
>> >> > is not the correct way.
>> >>
>> >> I have not tested, but setting maxPerRoute to 1 would degrade
>> >> performance for you as you will have a number of Http clients waiting
>> >> for the single connection.
>> >>
>> >> If you do not want to use pooled connections, you can use
>> >> BasicHttpClientConnectionManager and not share it.
>> >>
>> >> >
>> >> > Regards,
>> >> > Murat
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>> >> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>> >>
>> >>
>> >
>> >
>> > --
>> > Murat Balkan
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>>
>>
>
>
> --
> Murat Balkan

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: Disabling pooling of PoolingConnectionManager

Posted by Murat Balkan <mr...@gmail.com>.
I see. I think that also means that I cannot share the ClosableHttpClient
instance among multiple threads as each client can refer to one connection
manager instance.

Can connectionreusestrategy be used so that the pooling connection manager
will always return a new connection regardless of the route provided?

Regards.
Murat

On Mon, Oct 17, 2016 at 5:05 PM, Bhowmik, Bindul <bi...@gmail.com>
wrote:

> Murat,
>
> On Mon, Oct 17, 2016 at 12:58 PM, Murat Balkan <mr...@gmail.com> wrote:
> > Hi Bindul,
> > Thanks for the answer.
> > I was thinking that using a shared connection manager will increase the
> > performance. What will be the implications of reusing the same
> > BasicHttpClientConnectionManager instance?
>
> If you see the documentation for the BasicHttpClientConnectionManager
> [1], you will see that it only maintains one active connection. If you
> share the the instance, your requests will be waiting for the
> connection to be available and that will be your bottleneck.
>
> I would also recommend reading the connection management section of
> the Http Client documentation [2]
>
> - Bindul
>
> [1] http://hc.apache.org/httpcomponents-client-ga/
> httpclient/apidocs/org/apache/http/impl/conn/
> BasicHttpClientConnectionManager.html
> [2] http://hc.apache.org/httpcomponents-client-4.5.x/
> tutorial/html/connmgmt.html
>
> > Regards,
> > Murat
> >
> > On Mon, Oct 17, 2016 at 2:31 PM, Bhowmik, Bindul <
> bindulbhowmik@gmail.com>
> > wrote:
> >
> >> Murat,
> >>
> >> On Mon, Oct 17, 2016 at 11:12 AM, Murat Balkan <mr...@gmail.com>
> wrote:
> >> > Hi,
> >> >
> >> > We are using PoolingHttpClientConnectionManager to open up
> connections
> >> to
> >> > multiple URL's in different threads (via different HttpGet objects).
> >> >
> >> > The only reason we are using the PoolingHttpClientConnectionManager
> is
> >> its'
> >> > performance in multi-thread environments (as suggested by the
> >> > documentation).
> >> >
> >> > However, we are not interested in the actual "pooling" functionality.
> >> > That's to say, we want to open up a brand new connection even if the
> >> route
> >> > is the same.
> >>
> >> The performance enhancements you achieve from
> >> PoolingHttpClientConnectionManager are due to its connection pooling
> >> feature, that saves you to cost of establishing the connection when
> >> another request goes to the same route.
> >>
> >> >
> >> > How can we achieve this? We tried to set maxPerroute to 1 but it
> seems it
> >> > is not the correct way.
> >>
> >> I have not tested, but setting maxPerRoute to 1 would degrade
> >> performance for you as you will have a number of Http clients waiting
> >> for the single connection.
> >>
> >> If you do not want to use pooled connections, you can use
> >> BasicHttpClientConnectionManager and not share it.
> >>
> >> >
> >> > Regards,
> >> > Murat
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> >> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> >>
> >>
> >
> >
> > --
> > Murat Balkan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>


-- 
Murat Balkan

Re: Disabling pooling of PoolingConnectionManager

Posted by "Bhowmik, Bindul" <bi...@gmail.com>.
Murat,

On Mon, Oct 17, 2016 at 12:58 PM, Murat Balkan <mr...@gmail.com> wrote:
> Hi Bindul,
> Thanks for the answer.
> I was thinking that using a shared connection manager will increase the
> performance. What will be the implications of reusing the same
> BasicHttpClientConnectionManager instance?

If you see the documentation for the BasicHttpClientConnectionManager
[1], you will see that it only maintains one active connection. If you
share the the instance, your requests will be waiting for the
connection to be available and that will be your bottleneck.

I would also recommend reading the connection management section of
the Http Client documentation [2]

- Bindul

[1] http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/conn/BasicHttpClientConnectionManager.html
[2] http://hc.apache.org/httpcomponents-client-4.5.x/tutorial/html/connmgmt.html

> Regards,
> Murat
>
> On Mon, Oct 17, 2016 at 2:31 PM, Bhowmik, Bindul <bi...@gmail.com>
> wrote:
>
>> Murat,
>>
>> On Mon, Oct 17, 2016 at 11:12 AM, Murat Balkan <mr...@gmail.com> wrote:
>> > Hi,
>> >
>> > We are using PoolingHttpClientConnectionManager to open up connections
>> to
>> > multiple URL's in different threads (via different HttpGet objects).
>> >
>> > The only reason we are using the PoolingHttpClientConnectionManager is
>> its'
>> > performance in multi-thread environments (as suggested by the
>> > documentation).
>> >
>> > However, we are not interested in the actual "pooling" functionality.
>> > That's to say, we want to open up a brand new connection even if the
>> route
>> > is the same.
>>
>> The performance enhancements you achieve from
>> PoolingHttpClientConnectionManager are due to its connection pooling
>> feature, that saves you to cost of establishing the connection when
>> another request goes to the same route.
>>
>> >
>> > How can we achieve this? We tried to set maxPerroute to 1 but it seems it
>> > is not the correct way.
>>
>> I have not tested, but setting maxPerRoute to 1 would degrade
>> performance for you as you will have a number of Http clients waiting
>> for the single connection.
>>
>> If you do not want to use pooled connections, you can use
>> BasicHttpClientConnectionManager and not share it.
>>
>> >
>> > Regards,
>> > Murat
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>>
>>
>
>
> --
> Murat Balkan

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: Disabling pooling of PoolingConnectionManager

Posted by Murat Balkan <mr...@gmail.com>.
Hi Bindul,
Thanks for the answer.
I was thinking that using a shared connection manager will increase the
performance. What will be the implications of reusing the same
BasicHttpClientConnectionManager instance?
Regards,
Murat

On Mon, Oct 17, 2016 at 2:31 PM, Bhowmik, Bindul <bi...@gmail.com>
wrote:

> Murat,
>
> On Mon, Oct 17, 2016 at 11:12 AM, Murat Balkan <mr...@gmail.com> wrote:
> > Hi,
> >
> > We are using PoolingHttpClientConnectionManager to open up connections
> to
> > multiple URL's in different threads (via different HttpGet objects).
> >
> > The only reason we are using the PoolingHttpClientConnectionManager is
> its'
> > performance in multi-thread environments (as suggested by the
> > documentation).
> >
> > However, we are not interested in the actual "pooling" functionality.
> > That's to say, we want to open up a brand new connection even if the
> route
> > is the same.
>
> The performance enhancements you achieve from
> PoolingHttpClientConnectionManager are due to its connection pooling
> feature, that saves you to cost of establishing the connection when
> another request goes to the same route.
>
> >
> > How can we achieve this? We tried to set maxPerroute to 1 but it seems it
> > is not the correct way.
>
> I have not tested, but setting maxPerRoute to 1 would degrade
> performance for you as you will have a number of Http clients waiting
> for the single connection.
>
> If you do not want to use pooled connections, you can use
> BasicHttpClientConnectionManager and not share it.
>
> >
> > Regards,
> > Murat
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>


-- 
Murat Balkan

Re: Disabling pooling of PoolingConnectionManager

Posted by "Bhowmik, Bindul" <bi...@gmail.com>.
Murat,

On Mon, Oct 17, 2016 at 11:12 AM, Murat Balkan <mr...@gmail.com> wrote:
> Hi,
>
> We are using PoolingHttpClientConnectionManager to open up connections to
> multiple URL's in different threads (via different HttpGet objects).
>
> The only reason we are using the PoolingHttpClientConnectionManager is its'
> performance in multi-thread environments (as suggested by the
> documentation).
>
> However, we are not interested in the actual "pooling" functionality.
> That's to say, we want to open up a brand new connection even if the route
> is the same.

The performance enhancements you achieve from
PoolingHttpClientConnectionManager are due to its connection pooling
feature, that saves you to cost of establishing the connection when
another request goes to the same route.

>
> How can we achieve this? We tried to set maxPerroute to 1 but it seems it
> is not the correct way.

I have not tested, but setting maxPerRoute to 1 would degrade
performance for you as you will have a number of Http clients waiting
for the single connection.

If you do not want to use pooled connections, you can use
BasicHttpClientConnectionManager and not share it.

>
> Regards,
> Murat

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org