Open multiple keep-alives to a server in Go -


i have application opens keep-alive few remote servers (that control). sends heart beat packet keep connection alive before timeout.

this how created transport:

// keep-alive connection servers tr := &http.transport{} client := &http.client{transport: tr} 

if use &http.transport{maxidleconnsperhost: 2} , set > 2, i'm able maintain multiple keep-alives per remote connection. however, these additional keep-alives per remote server created go when there concurrent requests have made, , terminated automatically after timeout expires.

my question is: how can create additional keep-alives, 5 keep-alives per remote server myself when initialize transport (when start go) , keep them alive? speed subsequent requests , speed important.

based on inputs go-nuts group, manually open multiple keep-alives 1 server, make many simultaneous requests. go keeps these alive till remote server times them out (default 5 seconds in apache).

please note these connections cannot more maxidleconnsperhost 2 default.

you can verify behaviour using netstat -p tcp


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

django - CSRF verification failed. Request aborted. CSRF cookie not set -