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: http/2 throughput is very slow compared to http/1.1 #47840

Open
kgersen opened this issue Aug 20, 2021 · 3 comments
Open

net/http: http/2 throughput is very slow compared to http/1.1 #47840

kgersen opened this issue Aug 20, 2021 · 3 comments

Comments

@kgersen
Copy link

@kgersen kgersen commented Aug 20, 2021

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

1.7

$ go version
go version go1.17 linux/amd64

Does this issue reproduce with the latest release?

yes

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

Linux, Windows, etc

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/user/.cache/go-build"
GOENV="/home/user/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/user/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/user/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.17"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/user/dev/http2issue/go.mod"
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-build38525640=/tmp/go-build -gno-record-gcc-switches"

What did you do?

test http/2 vs http1.1 transfert speed with client and server from standard lib

see a complete POC here: https://github.com/nspeed-app/http2issue

The issue is general, loopback (localhost) or over the wire.

What did you expect to see?

same speed order than http1.1

What did you see instead?

http/2 is at least x5 slower or worst

@neild
Copy link
Contributor

@neild neild commented Aug 20, 2021

You're comparing encrypted HTTP/2 with unencrypted HTTP. You need to compare HTTP/2 with HTTPS to compare like with like.

@mknyszek mknyszek added this to the Backlog milestone Aug 20, 2021
@kgersen
Copy link
Author

@kgersen kgersen commented Aug 20, 2021

hi, the POC is using H2C to avoid encryption.
I also compared encrypted versions with the product we're developing and we have the same issue.

@kgersen
Copy link
Author

@kgersen kgersen commented Aug 25, 2021

Caddy a web server written in Go has the same issue. I've updated the POC with a sample Caddy config: https://github.com/nspeed-app/http2issue/tree/main/3rd-party/Caddy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants