goproxy icon indicating copy to clipboard operation
goproxy copied to clipboard

Should DisableKeepAlives be set to true?

Open sybrandy opened this issue 10 years ago • 1 comments

Hello,

I'm using your code and when I got the logic working for my service, I noticed that it would only connect to one of the nodes I wanted to proxy to and not switch. What I was hoping for was that it would switch between nodes on every connection. (FYI, I implemented a round-robin algorithm)

So, my question is: should DisableKeepAlives be set to true on the http.Transport variable created in NewMultipleHostReverseProxy? Or am I missing something? Perhaps this could be something that is set when you call the method?

sybrandy avatar Sep 04 '15 18:09 sybrandy

Sorry for the late answer, I have been traveling.

This is the expected behavior. If you start multiple connections, it will switch to an other node. I explain the behavior here: https://www.youtube.com/watch?v=OKZ1Pea_qsg&list=PL2ntRZ1ySWBeHqlHM8DmvS8axgbrpvF9b&index=11 (7 mins).

If you think that DisableKeepAlives would be important, feel free to submit a PR :) I'll be happy to merge it.

creack avatar Sep 10 '15 11:09 creack