Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/http: DefaultClient.Get is painfully slow #28188

Closed
opennota opened this issue Oct 13, 2018 · 2 comments
Closed

net/http: DefaultClient.Get is painfully slow #28188

opennota opened this issue Oct 13, 2018 · 2 comments

Comments

@opennota
Copy link

@opennota opennota commented Oct 13, 2018

What version of Go are you using (go version)?

go version go1.11 linux/amd64

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/opennota/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/opennota/gocode"
GOPROXY=""
GORACE=""
GOROOT="/home/opennota/go"
GOTMPDIR=""
GOTOOLDIR="/home/opennota/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build055651916=/tmp/go-build -gno-record-gcc-switches"

What did you do?

package main

import (
	"fmt"
	"net/http"
	"time"
)

func main() {
	const url = "https://gufo.me/dict/epithets/%D0%B0%D0%B3%D1%80%D0%B5%D1%81%D1%81%D0%B8%D1%8F"
	start := time.Now()
	_, err := http.DefaultClient.Get(url)
	if err != nil {
		panic(err)
	}
	fmt.Println(time.Since(start))
}
$ go build -o main main.go
$ ./main
10.813319159s

What did you expect to see?

The request is completed in 1 second at most.

What did you see instead?

The request takes almost 11 seconds: 10.813319159s

wget does the same request in under 1 second.

@agnivade

This comment has been minimized.

Copy link
Contributor

@agnivade agnivade commented Oct 13, 2018

This may be due to the DNS resolution issues that we have been having. Probably a dup of #21906

Can you check with 1.11.1 ? This got backported.

Also, please run with httptrace (#21906 (comment)) so that we know which part of the request is slow.

@opennota

This comment has been minimized.

Copy link
Author

@opennota opennota commented Oct 13, 2018

That was it, thanks. With Go 1.11.1 it's 600-700ms.

@opennota opennota closed this Oct 13, 2018
@golang golang locked and limited conversation to collaborators Oct 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.