mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Performance logging and counters:
* Tally and duration counters for Job Queue tasks and RPC calls
optionally rendered by server_info and server_state, and
optionally printed to a distinct log file.
- Tally each Job Queue task as it is queued, starts, and
finishes running. Track total duration queued and running.
- Tally each RPC call as it starts and either finishes
successfully or throws an exception. Track total running
duration for each.
* Track currently executing Job Queue tasks and RPC methods
along with durations.
* Json-formatted performance log file written by a dedicated
thread, for above-described data.
* New optional parameter, "counters", for server_info and
server_state. If set, render Job Queue and RPC call counters
as well as currently executing tasks.
* New configuration section, "[perf]", to optionally control
performance logging to a file.
* Support optional sub-second periods when rendering human-readable
time points.
This commit is contained in:
committed by
Nikolaos D. Bougalis
parent
ef3bc92b82
commit
8eb8c77886
1072
src/test/basics/PerfLog_test.cpp
Normal file
1072
src/test/basics/PerfLog_test.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@@ -40,7 +40,7 @@ class ByzantineFailureSim_test : public beast::unit_test::suite
|
||||
ConsensusParms const parms{};
|
||||
|
||||
SimDuration const delay =
|
||||
round<milliseconds>(0.2 * parms.ledgerGRANULARITY);
|
||||
date::round<milliseconds>(0.2 * parms.ledgerGRANULARITY);
|
||||
PeerGroup a = sim.createGroup(1);
|
||||
PeerGroup b = sim.createGroup(1);
|
||||
PeerGroup c = sim.createGroup(1);
|
||||
|
||||
@@ -146,7 +146,7 @@ public:
|
||||
|
||||
// Connected trust and network graphs with single fixed delay
|
||||
peers.trustAndConnect(
|
||||
peers, round<milliseconds>(0.2 * parms.ledgerGRANULARITY));
|
||||
peers, date::round<milliseconds>(0.2 * parms.ledgerGRANULARITY));
|
||||
|
||||
// everyone submits their own ID as a TX
|
||||
for (Peer * p : peers)
|
||||
@@ -194,10 +194,11 @@ public:
|
||||
|
||||
// Fast and slow network connections
|
||||
fast.connect(
|
||||
fast, round<milliseconds>(0.2 * parms.ledgerGRANULARITY));
|
||||
fast, date::round<milliseconds>(0.2 * parms.ledgerGRANULARITY));
|
||||
|
||||
slow.connect(
|
||||
network, round<milliseconds>(1.1 * parms.ledgerGRANULARITY));
|
||||
network,
|
||||
date::round<milliseconds>(1.1 * parms.ledgerGRANULARITY));
|
||||
|
||||
// All peers submit their own ID as a transaction
|
||||
for (Peer* peer : network)
|
||||
@@ -250,10 +251,12 @@ public:
|
||||
|
||||
// Fast and slow network connections
|
||||
fast.connect(
|
||||
fast, round<milliseconds>(0.2 * parms.ledgerGRANULARITY));
|
||||
fast,
|
||||
date::round<milliseconds>(0.2 * parms.ledgerGRANULARITY));
|
||||
|
||||
slow.connect(
|
||||
network, round<milliseconds>(1.1 * parms.ledgerGRANULARITY));
|
||||
network,
|
||||
date::round<milliseconds>(1.1 * parms.ledgerGRANULARITY));
|
||||
|
||||
for (Peer* peer : slow)
|
||||
peer->runAsValidator = isParticipant;
|
||||
@@ -377,7 +380,7 @@ public:
|
||||
|
||||
network.trust(network);
|
||||
network.connect(
|
||||
network, round<milliseconds>(0.2 * parms.ledgerGRANULARITY));
|
||||
network, date::round<milliseconds>(0.2 * parms.ledgerGRANULARITY));
|
||||
|
||||
// Run consensus without skew until we have a short close time
|
||||
// resolution
|
||||
@@ -447,7 +450,7 @@ public:
|
||||
PeerGroup network = minority + majority;
|
||||
|
||||
SimDuration delay =
|
||||
round<milliseconds>(0.2 * parms.ledgerGRANULARITY);
|
||||
date::round<milliseconds>(0.2 * parms.ledgerGRANULARITY);
|
||||
minority.trustAndConnect(minority + majorityA, delay);
|
||||
majority.trustAndConnect(majority, delay);
|
||||
|
||||
@@ -552,7 +555,8 @@ public:
|
||||
|
||||
PeerGroup network = loner + clique;
|
||||
network.connect(
|
||||
network, round<milliseconds>(0.2 * parms.ledgerGRANULARITY));
|
||||
network,
|
||||
date::round<milliseconds>(0.2 * parms.ledgerGRANULARITY));
|
||||
|
||||
// initial round to set prior state
|
||||
sim.run(1);
|
||||
@@ -606,9 +610,10 @@ public:
|
||||
|
||||
// Fast and slow network connections
|
||||
fast.connect(
|
||||
fast, round<milliseconds>(0.2 * parms.ledgerGRANULARITY));
|
||||
fast, date::round<milliseconds>(0.2 * parms.ledgerGRANULARITY));
|
||||
slow.connect(
|
||||
network, round<milliseconds>(1.1 * parms.ledgerGRANULARITY));
|
||||
network,
|
||||
date::round<milliseconds>(1.1 * parms.ledgerGRANULARITY));
|
||||
|
||||
// Run to the ledger *prior* to decreasing the resolution
|
||||
sim.run(increaseLedgerTimeResolutionEvery - 2);
|
||||
@@ -757,7 +762,7 @@ public:
|
||||
PeerGroup network = a + b;
|
||||
|
||||
SimDuration delay =
|
||||
round<milliseconds>(0.2 * parms.ledgerGRANULARITY);
|
||||
date::round<milliseconds>(0.2 * parms.ledgerGRANULARITY);
|
||||
a.trustAndConnect(a, delay);
|
||||
b.trustAndConnect(b, delay);
|
||||
|
||||
@@ -804,7 +809,7 @@ public:
|
||||
center.trust(validators);
|
||||
|
||||
SimDuration delay =
|
||||
round<milliseconds>(0.2 * parms.ledgerGRANULARITY);
|
||||
date::round<milliseconds>(0.2 * parms.ledgerGRANULARITY);
|
||||
validators.connect(center, delay);
|
||||
|
||||
center[0]->runAsValidator = false;
|
||||
@@ -928,8 +933,10 @@ public:
|
||||
PeerGroup groupNotFastC = groupABD + groupCsplit;
|
||||
PeerGroup network = groupABD + groupCsplit + groupCfast;
|
||||
|
||||
SimDuration delay = round<milliseconds>(0.2 * parms.ledgerGRANULARITY);
|
||||
SimDuration fDelay = round<milliseconds>(0.1 * parms.ledgerGRANULARITY);
|
||||
SimDuration delay = date::round<milliseconds>(
|
||||
0.2 * parms.ledgerGRANULARITY);
|
||||
SimDuration fDelay = date::round<milliseconds>(
|
||||
0.1 * parms.ledgerGRANULARITY);
|
||||
|
||||
network.trust(network);
|
||||
// C must have a shorter delay to see all the validations before the
|
||||
|
||||
@@ -57,7 +57,7 @@ class ScaleFreeSim_test : public beast::unit_test::suite
|
||||
|
||||
// nodes with a trust line in either direction are network-connected
|
||||
network.connectFromTrust(
|
||||
round<milliseconds>(0.2 * parms.ledgerGRANULARITY));
|
||||
date::round<milliseconds>(0.2 * parms.ledgerGRANULARITY));
|
||||
|
||||
// Initialize collectors to track statistics to report
|
||||
TxCollector txCollector;
|
||||
|
||||
@@ -19,9 +19,66 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
#include <ripple/core/impl/Workers.h>
|
||||
#include <ripple/beast/unit_test.h>
|
||||
#include <ripple/basics/PerfLog.h>
|
||||
#include <ripple/core/JobTypes.h>
|
||||
#include <ripple/json/json_value.h>
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
/**
|
||||
* Dummy class for unit tests.
|
||||
*/
|
||||
|
||||
namespace perf {
|
||||
|
||||
class PerfLogTest
|
||||
: public PerfLog
|
||||
{
|
||||
void rpcStart(std::string const &method, std::uint64_t requestId) override
|
||||
{}
|
||||
|
||||
void rpcFinish(std::string const &method, std::uint64_t requestId) override
|
||||
{}
|
||||
|
||||
void rpcError(std::string const &method, std::uint64_t dur) override
|
||||
{}
|
||||
|
||||
void jobQueue(JobType const type) override
|
||||
{}
|
||||
|
||||
void jobStart(JobType const type,
|
||||
std::chrono::microseconds dur,
|
||||
std::chrono::time_point<std::chrono::steady_clock> startTime,
|
||||
int instance) override
|
||||
{}
|
||||
|
||||
void jobFinish(JobType const type, std::chrono::microseconds dur,
|
||||
int instance) override
|
||||
{}
|
||||
|
||||
Json::Value countersJson() const override
|
||||
{
|
||||
return Json::Value();
|
||||
}
|
||||
|
||||
Json::Value currentJson() const override
|
||||
{
|
||||
return Json::Value();
|
||||
}
|
||||
|
||||
void resizeJobs(int const resize) override
|
||||
{}
|
||||
|
||||
void rotate() override
|
||||
{}
|
||||
};
|
||||
|
||||
} // perf
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class Workers_test : public beast::unit_test::suite
|
||||
@@ -35,7 +92,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
void processTask()
|
||||
void processTask(int instance) override
|
||||
{
|
||||
if (--count == 0)
|
||||
finished.signal();
|
||||
@@ -51,8 +108,10 @@ public:
|
||||
" -> " + std::to_string(tc2) + " -> " + std::to_string(tc3));
|
||||
|
||||
TestCallback cb;
|
||||
std::unique_ptr<perf::PerfLog> perfLog =
|
||||
std::make_unique<perf::PerfLogTest>();
|
||||
|
||||
Workers w(cb, "Test", tc1);
|
||||
Workers w(cb, *perfLog, "Test", tc1);
|
||||
BEAST_EXPECT(w.getNumberOfThreads() == tc1);
|
||||
|
||||
auto testForThreadCount = [this, &cb, &w] (int const threadCount)
|
||||
|
||||
@@ -104,7 +104,7 @@ pretty_time(std::ostream& os, std::chrono::duration<Rep, Period> d)
|
||||
else
|
||||
{
|
||||
// use integral
|
||||
os << round<nanoseconds>(d).count();
|
||||
os << date::round<nanoseconds>(d).count();
|
||||
}
|
||||
os << "ns";
|
||||
}
|
||||
@@ -120,7 +120,7 @@ pretty_time(std::ostream& os, std::chrono::duration<Rep, Period> d)
|
||||
else
|
||||
{
|
||||
// use integral
|
||||
os << round<microseconds>(d).count();
|
||||
os << date::round<microseconds>(d).count();
|
||||
}
|
||||
os << "us";
|
||||
}
|
||||
@@ -136,7 +136,7 @@ pretty_time(std::ostream& os, std::chrono::duration<Rep, Period> d)
|
||||
else
|
||||
{
|
||||
// use integral
|
||||
os << round<milliseconds>(d).count();
|
||||
os << date::round<milliseconds>(d).count();
|
||||
}
|
||||
os << "ms";
|
||||
}
|
||||
@@ -152,7 +152,7 @@ pretty_time(std::ostream& os, std::chrono::duration<Rep, Period> d)
|
||||
else
|
||||
{
|
||||
// use integral
|
||||
os << round<seconds>(d).count();
|
||||
os << date::round<seconds>(d).count();
|
||||
}
|
||||
os << "s";
|
||||
}
|
||||
@@ -168,7 +168,7 @@ pretty_time(std::ostream& os, std::chrono::duration<Rep, Period> d)
|
||||
else
|
||||
{
|
||||
// use integral
|
||||
os << round<minutes>(d).count();
|
||||
os << date::round<minutes>(d).count();
|
||||
}
|
||||
os << "min";
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <test/basics/hardened_hash_test.cpp>
|
||||
#include <test/basics/KeyCache_test.cpp>
|
||||
#include <test/basics/mulDiv_test.cpp>
|
||||
#include <test/basics/PerfLog_test.cpp>
|
||||
#include <test/basics/RangeSet_test.cpp>
|
||||
#include <test/basics/Slice_test.cpp>
|
||||
#include <test/basics/StringUtilities_test.cpp>
|
||||
|
||||
Reference in New Issue
Block a user