-
Notifications
You must be signed in to change notification settings - Fork 43
Support TCP_NODELAY #18
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
Conversation
|
This is awesome and I think we should merge this 👍 But I think we should do a small change for this PR. The So can you modify this PR, and add a new |
|
@aisk Thank you for review, i changed the implement. But And there are some problems.
So, I thinks pass options by query is more better such as How dou you think it? |
|
@alu Good idea! |
|
@aisk I tried it, please review again. |
src/connection.rs
Outdated
| let stream = TcpStream::connect(addr.clone())?; | ||
| let tcp_nodelay = addr.query_pairs() | ||
| .find(|&(ref k, ref v)| { | ||
| k == &Cow::Borrowed("tcp_nodelay") && v == &Cow::Borrowed("true") |
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.
We can compare them by k == "tcp_nodelay" since Cow have implemented the Eq trait.
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.
Thanks, fixed it.
|
Sorry for another thing, I think we can add a simple test at the end of #[cfg(test)]
mod tests {
#[test]
fn tcp_nodelay() {
super::Connection::connect("memcache://localhost:12345?tcl_nodelay=true").unwrap();
}
} |
|
@aisk Added the test, thanks. |
|
Merged, thank you @alu ! I will release a new version now. |
|
@aisk Thank! I did not rebase for cleanup commits, it's ok? |
|
@alu No problem, I've merged this PR using squash merge. 0.7.0 is released, thanks! |
Support TCP_NODELAY for performance improvement.
I tested performance in my environment, but that was not well.
It was caused by TCP_NODELAY being disabled.
My test code is here
And results is
Thanks.