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
THRIFT-5490: Use pooled buffer for THeaderTransport #2492
Conversation
42abbe8
to
3622f30
Compare
Note: similar things can be done in |
if err != nil { | ||
return NewTTransportExceptionFromError(err) | ||
} | ||
if _, err := io.Copy(writer, &t.writeBuffer); err != nil { | ||
if _, err := io.Copy(writer, t.writeBuffer); err != nil { | ||
return NewTTransportExceptionFromError(err) | ||
} | ||
if err := writer.Close(); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious. If we return an error on line 655 would that mean the writer
is never closed? Reason why I ask is because at first glance, NewTransformWriter
could potentially allocate a new zlib writer (line 221) which would never get closed. But I could just be missing something in my understand of how this works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's a local variable, so it will be garbage collected later after it's no longer reachable by any code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
3622f30
to
2e1f150
Compare
Added a unit test to make sure that a |
Client: go Instead of binding 2 buffers (read/write) to each THeaderTransport, grab one from the pool to be used for the whole read/write, and return it back to the pool after the read/write is done. This would help reduce the memory footprint from idle connections.
2e1f150
to
6936563
Compare
not seeing issues on staging. merging. |
Client: go
Instead of binding 2 buffers (read/write) to each THeaderTransport, grab
one from the pool to be used for the whole read/write, and return it
back to the pool after the read/write is done. This would help reduce
the memory footprint from idle connections.
[skip ci]
anywhere in the commit message to free up build resources.