Batch Region ack messages

Reduce CPU utilization by batching release ack messages on the IPC queue.
This commit is contained in:
Gvozden Neskovic
2019-04-30 10:13:24 +02:00
committed by Dennis Klein
parent 9b326c7a71
commit 2ed2177555
5 changed files with 118 additions and 67 deletions

View File

@@ -327,50 +327,19 @@ void FairMQMessageSHM::CloseMessage()
}
else
{
// send notification back to the receiver
// RegionBlock block(fHandle, fSize);
// if (fManager.GetRegionQueue(fRegionId).try_send(static_cast<void*>(&block), sizeof(RegionBlock), 0))
// {
// // LOG(info) << "true";
// }
// // else
// // {
// // LOG(debug) << "could not send ack";
// // }
// timed version
RegionBlock block(fHandle, fSize, fHint);
bool success = false;
do
if (!fRegionPtr)
{
auto sndTill = bpt::microsec_clock::universal_time() + bpt::milliseconds(200);
if (!fRegionPtr)
{
fRegionPtr = fManager.GetRemoteRegion(fRegionId);
}
if (fRegionPtr)
{
// LOG(debug) << "sending ack";
if (fRegionPtr->fQueue->timed_send(&block, sizeof(RegionBlock), 0, sndTill))
{
success = true;
}
else
{
if (fInterrupted)
{
break;
}
LOG(debug) << "region ack queue is full, retrying...";
}
}
else
{
// LOG(warn) << "region ack queue for id " << fRegionId << " no longer exist. Not sending ack";
success = true;
}
fRegionPtr = fManager.GetRemoteRegion(fRegionId);
}
if (fRegionPtr)
{
fRegionPtr->ReleaseBlock({fHandle, fSize, fHint});
}
else
{
LOG(warn) << "region ack queue for id " << fRegionId << " no longer exist. Not sending ack";
}
while (!success);
}
}