-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
[RFC] crimson/net: potential optimizations and evaluation #27430
Conversation
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.
This looks reasonable. Looking forward for the ProtovolV2
implementation! 👍 Thanks, @cyx1231st!
src/crimson/net/ProtocolV1.cc
Outdated
bufferlist bl; | ||
size_t len = msgs.size(); | ||
while (!msgs.empty()) { | ||
auto msg = msgs.front(); |
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.
Maybe there is no need to bump up the counter of MessageRef
. We could ::pop()
after processing current message.
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.
done.
src/crimson/net/ProtocolV1.cc
Outdated
seastar::future<> ProtocolV1::write_messages(std::queue<MessageRef>& msgs) | ||
{ | ||
bufferlist bl; | ||
size_t len = msgs.size(); |
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.
nit: unused?
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.
removed
src/test/crimson/perf_async_msgr.cc
Outdated
{ | ||
bufferptr ptr(msg_len); | ||
memset(ptr.c_str(), 0, msg_len); | ||
msg_data.append(ptr); |
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.
See ceph::bufferlist::append_zero
.
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.
done.
@@ -595,6 +595,45 @@ void ProtocolV1::start_accept(SocketFRef&& sock, | |||
|
|||
// open state | |||
|
|||
seastar::future<> ProtocolV1::write_messages(std::queue<MessageRef>& msgs) | |||
{ | |||
bufferlist bl; |
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.
You might want to ::reserve()
required space for the C-string taking ::append()
calls:
bl.reserve(msgs.size() * (sizeof(CEPH_MSGR_TAG_MSG) + sizeof(header) + sizeof(footer)));
This should prevent from allocating 4k at first call and wasting memory when the queue has few messages.
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.
Sorry not familiar with bufferlist interface, can I still use bl.append(...)
to fill the C-strings, after calling bl.reserve(...)
?
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.
Yup, it's OK.
src/crimson/net/Protocol.cc
Outdated
if (msg == conn.out_q.front()) { | ||
conn.out_q.pop(); | ||
} | ||
return write_messages(conn.out_q) |
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.
👍
59793a2
to
c05484d
Compare
b1d3902
to
bf4919b
Compare
Use gather buffers from pending messages and send them together. Minimize the attempts to check keepalive/keepalive_ack when sending. Signed-off-by: Yingxin Cheng <[email protected]>
Signed-off-by: Yingxin Cheng <[email protected]>
Dispatch cooked messages together, and give chance for dispatchers to slow down reading buffers. Signed-off-by: Yingxin Cheng <[email protected]>
Signed-off-by: Yingxin Cheng <[email protected]>
Signed-off-by: Yingxin Cheng <[email protected]>
Signed-off-by: Yingxin Cheng <[email protected]>
Close this in favor of #27836 #27788 and ceph/seastar#4 |
Got 34.6% better IOPS in average.
Optimizations ideas (PoC implementation with v1):
seastar::net::posix_data_source_impl
withbuf_size = 65536
(NOT included)[E] Batching heavily uses
seastar::promise<>
, so applied optimizations rzarzynski/seastar@682bd90 and rzarzynski/seastar@682bd90 from @rzarzynskiTest command:
Test result (RelWithDebInfo build):