You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Серега Красильников <il...@mail.ru> on 2015/07/03 15:31:36 UTC

HttpConnection live time

 Good day ladies and gentlemen!

Short intro: 
We have an APIs on AWS EC2. We have AWS load balancer (LB) and a lot of instances behind. Once a time, depends on load, LB is adding new instance with new DNS.

What we want to have:
Once in a short period of time kill connection to have a reference on a new Amazon instance.

What approaches we've found:
1. Make Use 

Re: HttpConnection live time

Posted by Dmitry Potapov <po...@gmail.com>.
What about custom connection factory and custom connection reuse strategy?
First one will create TimeAwareHttpClientConnection, the second one will kill connections which is older than 1 minute (or what refresh interval you want).
Moreover, you could notify your custom connection reuse strategy about dns changes, so connections refresh could be achieved faster.

-- 
Dmitry Potapov

On Fri, Jul 03, 2015 at 04:38:19PM +0300, Серега Красильников wrote:
> 
> I'm sorry, that was missclick!
> 
> <<<
> Good day ladies and gentlemen!
> 
> Short intro: 
> We have an APIs on AWS EC2. We have AWS load balancer (LB) and a lot of instances behind. Once a time, depends on load, LB is adding new instance with new DNS.
> 
> What we want to have:
> Once in a short period of time kill connection to have a reference on a new Amazon instance.
> 
> What approaches we've found:
> 1. Make HttpClient use NoConnectionReuseStrategy - this might cost a lot for big amount of requests
> 2. Make HttpConnectionMetrics of each connection hold time of creation (and then calculate kill it or no)
> 3. Make custom PoolingHttpClientConnectionManager, which would use our custom HttpClientConnection wrapper to have there creation time.
> 
> Main question we  have is - how  rchitecturally correct do it. 
> >>>
> 
> Thanks, Sergey K.

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


Re: HttpConnection live time

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Fri, 2015-07-03 at 16:38 +0300, Серега Красильников wrote:
> I'm sorry, that was missclick!
> 
> <<<
> Good day ladies and gentlemen!
> 
> Short intro: 
> We have an APIs on AWS EC2. We have AWS load balancer (LB) and a lot of instances behind. Once a time, depends on load, LB is adding new instance with new DNS.
> 
> What we want to have:
> Once in a short period of time kill connection to have a reference on a new Amazon instance.
> 
> What approaches we've found:
> 1. Make HttpClient use NoConnectionReuseStrategy - this might cost a lot for big amount of requests
> 2. Make HttpConnectionMetrics of each connection hold time of creation (and then calculate kill it or no)
> 3. Make custom PoolingHttpClientConnectionManager, which would use our custom HttpClientConnection wrapper to have there creation time.
> 
> Main question we  have is - how  rchitecturally correct do it. 
> >>>
> 
> Thanks, Sergey K.

I second Dmitry here. A combination of a custom connection and a custom
connection re-use strategy sounds like the way to go here. 

Please note though that PoolingHttpClientConnectionManager also supports
Time-To-Live settings out of the box. By using a finite TTL value (say,
one minute) one can ensure that the connection will not get re-used
beyond its TTL. This may also get the job done for you.

Oleg

PS:
Серега, будь ровным пацаном и не кросс-пость 


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


Re: HttpConnection live time

Posted by Серега Красильников <il...@mail.ru>.
I'm sorry, that was missclick!

<<<
Good day ladies and gentlemen!

Short intro: 
We have an APIs on AWS EC2. We have AWS load balancer (LB) and a lot of instances behind. Once a time, depends on load, LB is adding new instance with new DNS.

What we want to have:
Once in a short period of time kill connection to have a reference on a new Amazon instance.

What approaches we've found:
1. Make HttpClient use NoConnectionReuseStrategy - this might cost a lot for big amount of requests
2. Make HttpConnectionMetrics of each connection hold time of creation (and then calculate kill it or no)
3. Make custom PoolingHttpClientConnectionManager, which would use our custom HttpClientConnection wrapper to have there creation time.

Main question we  have is - how  rchitecturally correct do it. 
>>>

Thanks, Sergey K.

Re: HttpConnection live time

Posted by Серега Красильников <il...@mail.ru>.
I'm sorry, that was missclick!

<<<
Good day ladies and gentlemen!

Short intro: 
We have an APIs on AWS EC2. We have AWS load balancer (LB) and a lot of instances behind. Once a time, depends on load, LB is adding new instance with new DNS.

What we want to have:
Once in a short period of time kill connection to have a reference on a new Amazon instance.

What approaches we've found:
1. Make HttpClient use NoConnectionReuseStrategy - this might cost a lot for big amount of requests
2. Make HttpConnectionMetrics of each connection hold time of creation (and then calculate kill it or no)
3. Make custom PoolingHttpClientConnectionManager, which would use our custom HttpClientConnection wrapper to have there creation time.

Main question we  have is - how  rchitecturally correct do it. 
>>>

Thanks, Sergey K.