Re: [go-nuts] Maximum number of requests per HTTP connection?

2017-07-05 Thread Kevin Malachowski
Creating an http.RoundTripper which was in charge of delegating to an 
http.Transport as well as swapping out to a new http.Transport when you want to 
swap underlying connections is probably what I'd try first.

Cleaning up the old transport might be a little tricky if your application ever 
leaks http.Response.Body by not closing it appropriately, at which point you 
could also swap out the http.Transport.Dial functions with something which keep 
track of the underlying network connections. That would allow you to 
force-close them after some time out.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Maximum number of requests per HTTP connection?

2017-07-04 Thread Kevin Conway
Unfortunately, neither the http. Client nor the *http. Request expose a
reference to the underlying connection such that you could implement that
behaviour. At least, that's what I've found when trying to do this as well.

One possible strategy we've considered is implementing a wrapper around the
transport that will recycle the wrapped transport after a given time or
number of uses.

I'm definitely interested in hearing other ideas if this is already solved
in the community.

On Mon, Jul 3, 2017, 19:02 Mikhail Mazurskiy 
wrote:

> Hello there,
>
> Is there a way to limit the number of http requests a client will issue
> via a single tcp connection? I cannot find anything relevant to this
> question. Maybe a snippet of code to implement this...
>
> The use case is to force a highly active http connection to be closed
> after certain number of requests and/or time period. It is actively used so
> idle timeout will not work. I'd like it to be closed and re-established to
> pick up DNS changes - start using new ips before the remote side closes the
> connection. Trying to use weighted dns to progressively (in steps)
> transition load from one group of servers to another group.
>
> Thanks in advance for any input.
>
> Cheers,
> Mikhail.
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Maximum number of requests per HTTP connection?

2017-07-03 Thread Mikhail Mazurskiy
Hello there,

Is there a way to limit the number of http requests a client will issue via
a single tcp connection? I cannot find anything relevant to this question.
Maybe a snippet of code to implement this...

The use case is to force a highly active http connection to be closed after
certain number of requests and/or time period. It is actively used so idle
timeout will not work. I'd like it to be closed and re-established to pick
up DNS changes - start using new ips before the remote side closes the
connection. Trying to use weighted dns to progressively (in steps)
transition load from one group of servers to another group.

Thanks in advance for any input.

Cheers,
Mikhail.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.