Skip to content
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

Changed the StreamBuffer wait. #771

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/wbase/SendChannelShared.cc
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ bool SendChannelShared::_transmit(bool erred, Task::Ptr const& task) {

auto sz = _transmitQueue.size();
// Is this really the last message for this SharedSendChannel?
// _lastRecvd means no more data will be added to the queue and
// if the queue size is zero, then `thisTransmit` is really the last one.
bool reallyLast = (_lastRecvd && sz == 0);

TransmitData::Ptr nextTr;
Expand Down Expand Up @@ -248,8 +250,18 @@ bool SendChannelShared::_sendBuf(lock_guard<mutex> const& streamLock, xrdsvc::St
LOGS(_log, LOG_LVL_ERROR, "Failed to transmit " << note << "!");
return false;
} else {
LOGS(_log, LOG_LVL_INFO, "_sendbuf wait start " << note);
streamBuf->waitForDoneWithThis(); // Block until this buffer has been sent.
// Only wait if this is really the last message to finish transmitting for this SendChannelShared.
// Note: If this does speed up transmission of data to the czar then it is probably worth it to
// add code to wait if more than X buffers are in use at the same time, which will likely
// make a big performance crater, but better than crashing due to out of memory.
// It may be best to reduce the number of threads per scheduler to 1 until it clears up instead
// of waiting for every send.
// If this doesn't improve transmission performance, just change it back to waiting all of the
// time.
if (last) {
LOGS(_log, LOG_LVL_INFO, "_sendbuf wait start " << note);
streamBuf->waitForDoneWithThis(); // Block until this buffer has been sent.
}
}
return sent;
}
Expand Down