-
Notifications
You must be signed in to change notification settings - Fork 18k
x/net/http2: #18258
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
Comments
Fixed previously by golang/net@3bafa33 |
with golang/net@3bafa33 it still creates lots of garbage, the reason is for requests with no body, putRequestBodyBuf() is never called. Calling it in handlerDone() helps, but it still wastes lots of 64k buffer for requests without body (which is majority). I use this workaround, it saves lots of memory with busy servers:
|
To send changes, see https://golang.org/doc/contribute.html We can't accept diffs over email or github. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go1.7.3 linux/amd64
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build560134607=/tmp/go-build"
CXX="g++"
CGO_ENABLED="1"
What did you do?
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
http2 server getRequestBodyBuf() creates lots garbage and memory usage is high
What did you expect to see?
What did you see instead?
Most requests don't have body, but all allocates a 64K buffer, no request body read is called , therefore, putRequestBodyBuf() won't be called to recycle the buffer.
Is it possible to allocate 64k buffer only if there is a request body?
The text was updated successfully, but these errors were encountered: