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

Add a buffer around the broker's net.Conn for reads #584

Merged
merged 2 commits into from
Dec 15, 2015
Merged

Add a buffer around the broker's net.Conn for reads #584

merged 2 commits into from
Dec 15, 2015

Conversation

benburkert
Copy link

Reduces the number of read syscalls issued by short, sequential reads on the broker's net.Conn. A similar technique is used in the net/http package.

Reduces the number of read syscalls caused by small, sequential reads on
the broker's net.Conn.
@ashishgandhi
Copy link

👍

@eapache
Copy link
Contributor

eapache commented Dec 11, 2015

I am actually incredibly surprised to learn that the Go stdlib doesn't do this for you...

Do you have any benchmarks showing how much of an improvement this is?

@benburkert
Copy link
Author

I don't have anything scientific, but I did manually profile an app before & after this change and saw a reduction in time spent in syscall.Syscall from ~20% to ~10%.

buf *bufio.Reader
}

func NewBufConn(conn net.Conn) *bufConn {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

method should not be public

@wvanbergen
Copy link
Contributor

👍 from me if you un-export NewBufConn

eapache added a commit that referenced this pull request Dec 15, 2015
Add a buffer around the broker's net.Conn for reads
@eapache eapache merged commit fada641 into IBM:master Dec 15, 2015
@benburkert benburkert deleted the broker-conn-buffer branch December 16, 2015 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants