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

[WIP]Performance[MQB]: do not create tmp MemOutStream #398

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
69 changes: 37 additions & 32 deletions src/groups/mqb/mqbs/mqbs_filestore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2553,7 +2553,7 @@ int FileStore::rollover(bsls::Types::Uint64 timestamp)
// Iterate over outstanding records in the active set, and copy them to the
// rollover set.

QueueKeyCounterMap queueKeyCounterMap;
QueueKeyCounterMap queueKeyCounterMap(d_allocator_p);
for (RecordIterator recordIt = d_records.begin();
recordIt != d_records.end();
++recordIt) {
Expand All @@ -2564,37 +2564,42 @@ int FileStore::rollover(bsls::Types::Uint64 timestamp)
}

// Print summary of rolled over queues.
mwcu::MemOutStream outStream;
outStream << partitionDesc() << "Queue rollover summary:"
<< "\n QueueKey NumMsgs NumBytes QueueUri";

QueueKeyCounterList queueKeyCounters;
queueKeyCounters.reserve(queueKeyCounterMap.size());
for (QueueKeyCounterMapCIter queueKeyCounterCIter =
queueKeyCounterMap.cbegin();
queueKeyCounterCIter != queueKeyCounterMap.cend();
++queueKeyCounterCIter) {
queueKeyCounters.push_back(*queueKeyCounterCIter);
}
bsl::sort(queueKeyCounters.begin(), queueKeyCounters.end(), compareByByte);

for (QueueKeyCounterListCIter queueCountersCIter =
queueKeyCounters.cbegin();
queueCountersCIter != queueKeyCounters.cend();
++queueCountersCIter) {
StorageMapConstIter sit = d_storages.find(queueCountersCIter->first);
BSLS_ASSERT_SAFE(sit != d_storages.cend());

outStream << "\n [" << queueCountersCIter->first << "] "
<< bsl::setw(8)
<< mwcu::PrintUtil::prettyNumber(
static_cast<int>(queueCountersCIter->second.first))
<< " " << bsl::setw(10)
<< mwcu::PrintUtil::prettyBytes(
queueCountersCIter->second.second)
<< " " << sit->second->queueUri();
}
BALL_LOG_INFO << outStream.str();
BALL_LOG_INFO_BLOCK
{
QueueKeyCounterList queueKeyCounters(d_allocator_p);
queueKeyCounters.reserve(queueKeyCounterMap.size());
for (QueueKeyCounterMapCIter queueKeyCounterCIter =
queueKeyCounterMap.cbegin();
queueKeyCounterCIter != queueKeyCounterMap.cend();
++queueKeyCounterCIter) {
queueKeyCounters.push_back(*queueKeyCounterCIter);
}
bsl::sort(queueKeyCounters.begin(),
queueKeyCounters.end(),
compareByByte);

BALL_LOG_OUTPUT_STREAM
<< partitionDesc() << "Queue rollover summary:"
<< "\n QueueKey NumMsgs NumBytes QueueUri";
for (QueueKeyCounterListCIter queueCountersCIter =
queueKeyCounters.cbegin();
queueCountersCIter != queueKeyCounters.cend();
++queueCountersCIter) {
StorageMapConstIter sit = d_storages.find(
queueCountersCIter->first);
BSLS_ASSERT_SAFE(sit != d_storages.cend());

BALL_LOG_OUTPUT_STREAM
<< "\n [" << queueCountersCIter->first << "] "
<< bsl::setw(8)
<< mwcu::PrintUtil::prettyNumber(
static_cast<int>(queueCountersCIter->second.first))
<< " " << bsl::setw(10)
<< mwcu::PrintUtil::prettyBytes(
queueCountersCIter->second.second)
<< " " << sit->second->queueUri();
}
}

// Local refs for convenience.

Expand Down
Loading
Loading