Add postponed send loop to QEMU driver

This commit is contained in:
Vitaliy Filippov
2023-07-03 02:29:01 +03:00
parent c8d61568b5
commit c3ec6dd3b9
5 changed files with 87 additions and 5 deletions
+16 -4
View File
@@ -111,22 +111,28 @@ void osd_messenger_t::outbox_push(osd_op_t *cur_op)
return;
}
#endif
if (!ringloop)
if (!ringloop && !has_send_loop)
{
// FIXME: It's worse because it doesn't allow batching
// "Send loop" should be used, like in QEMU driver, or performance will suffer
// due to a large number of sendmsg() syscalls where they can be avoided.
// "Send loop" increases 4k T1Q128 randread from ~55k iops to ~90k on a 1 OSD.
// The difference is smaller when there are more OSDs though...
while (cl->outbox.size())
{
try_send(cl);
}
}
else if (cl->write_msg.msg_iovlen > 0 || !try_send(cl))
else if (cl->write_msg.msg_iovlen > 0 || has_send_loop || !try_send(cl))
{
if (cl->write_state == 0)
{
cl->write_state = CL_WRITE_READY;
write_ready_clients.push_back(cur_op->peer_fd);
}
ringloop->wakeup();
if (ringloop)
{
ringloop->wakeup();
}
}
}
@@ -218,6 +224,12 @@ void osd_messenger_t::send_replies()
write_ready_clients.clear();
}
bool osd_messenger_t::can_send()
{
has_send_loop = true;
return write_ready_clients.size() > 0;
}
void osd_messenger_t::handle_send(int result, osd_client_t *cl)
{
cl->write_msg.msg_iovlen = 0;