dachad / tcpgoon

tcpgoon, maximum TCP connections tester
MIT License
193 stars 21 forks source link

Assure DNS resolve is done only once #33

Closed chadell closed 6 years ago

dcaba commented 6 years ago

In order to test individual instances (closer to the mission of the project), this may have sense, but keeping the original mode with a flag could be an option. Any other rationale behind changing the mode?

chadell commented 6 years ago

my goal was just avoid resolving a DNS each TCP connection because the tcpgoon is only to stress TCP not DNS. So I would force this DNS caching by default unless you have other ideas/suggestion on it

chadell commented 6 years ago

I've checked that it's only done once per execution. Not issue at all.

dcaba commented 6 years ago

@chadell : Can you revisit this and provide more details about your tests? Please, use the binary generated by the compilation scripts/travis, or the docker image, rather than a "go run" or a direct "go build" in your machine, as the resolver may differ (we compile without cgo to avoid linking dynamically against libs, so it may mean your binary use the golang resolver, that behaves different)

chadell commented 6 years ago

@dcaba you were right, using the binary I've checked that multiple DNS queries are generated...

chadell commented 6 years ago

https://golang.org/pkg/net/#hdr-Name_Resolution @dcaba , regarding the above document, using -tags netcgo could solve this (I double checked it). do you have any argument to move to cgo resolver instead of pure Go? (I don't think the dns blocking is a big issue because without it we can't do anything)

dcaba commented 6 years ago

It'd be nice, but probably you will generate a binary dynamically linked against libc. So pure go looks the most portable option, but probably means using https://golang.org/pkg/net/#LookupIP before calling the Dial function (this is like the "most basic" discovery mechanism we will need to implement xD)

chadell commented 6 years ago

51