net: Allow setting socket options with DialTCP #34743
Labels
FeatureRequest
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
WaitingForInfo
Issue is not actionable because of missing required information, which needs to be provided.
Previous scale testing has shown that
net.Dial
is more expensive thannet.DialTCP
(#18601) since it performs actions such as re-resolving the address on each execution. Since we're making many connections to the same IP:port, we currently avoid these performance penalties by using
net.DialTCP
which allows us to pass in a pre-resolved*net.TCPAddr
.For performance reasons, we also need to set socket options within this same codepath.
As of Go 1.11,
net.Dialer
exposes aControl
function (#9661) which allows setting socket options, but this requires using the more expensivenet.Dial
path.Today, it looks like we only have 2 options:
net.Dial
, ornet.DialTCP
but cannot set socket options.Is the Go team open to exposing some way to use
net.DialTCP
which allows setting socket options? We're happy to contribute code if needed.The text was updated successfully, but these errors were encountered: