[RFC] crimson/net: potential optimizations and evaluation#27430
[RFC] crimson/net: potential optimizations and evaluation#27430cyx1231st wants to merge 6 commits intoceph:masterfrom
Conversation
rzarzynski
left a comment
There was a problem hiding this comment.
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.
Maybe there is no need to bump up the counter of MessageRef. We could ::pop() after processing current message.
src/crimson/net/ProtocolV1.cc
Outdated
| seastar::future<> ProtocolV1::write_messages(std::queue<MessageRef>& msgs) | ||
| { | ||
| bufferlist bl; | ||
| size_t len = msgs.size(); |
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.
See ceph::bufferlist::append_zero.
|
|
||
| seastar::future<> ProtocolV1::write_messages(std::queue<MessageRef>& msgs) | ||
| { | ||
| bufferlist bl; |
There was a problem hiding this comment.
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.
Sorry not familiar with bufferlist interface, can I still use bl.append(...) to fill the C-strings, after calling bl.reserve(...)?
src/crimson/net/Protocol.cc
Outdated
| if (msg == conn.out_q.front()) { | ||
| conn.out_q.pop(); | ||
| } | ||
| return write_messages(conn.out_q) |
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 <yingxincheng@gmail.com>
Signed-off-by: Yingxin Cheng <yingxincheng@gmail.com>
Dispatch cooked messages together, and give chance for dispatchers to slow down reading buffers. Signed-off-by: Yingxin Cheng <yingxincheng@gmail.com>
Signed-off-by: Yingxin Cheng <yingxincheng@gmail.com>
Signed-off-by: Yingxin Cheng <yingxincheng@gmail.com>
Signed-off-by: Yingxin Cheng <yingxincheng@gmail.com>
|
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_implwithbuf_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):