0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-05-29 00:03:45 +02:00

ircd::db::prefetcher: Integrate ticker items into ircd::stats system.

This commit is contained in:
Jason Volk 2020-12-23 00:13:05 -08:00
parent 9f0c081ac8
commit 1f164304a6
2 changed files with 90 additions and 18 deletions

View file

@ -72,26 +72,30 @@ static_assert
struct ircd::db::prefetcher::ticker
{
template<class T> using item = ircd::stats::item<T>;
// montonic event counts
size_t queries {0}; ///< All incoming user requests
size_t rejects {0}; ///< Queries which were ignored; already cached
size_t request {0}; ///< Prefetcher requests added to the queue
size_t directs {0}; ///< Direct dispatches to db::request pool
size_t handles {0}; ///< Incremented before dispatch to db::request
size_t handled {0}; ///< Incremented after dispatch to db::request
size_t fetches {0}; ///< Incremented before actual database operation
size_t fetched {0}; ///< Incremented after actual database operation
size_t cancels {0}; ///< Count of canceled operations
item<uint64_t> queries; ///< All incoming user requests
item<uint64_t> rejects; ///< Queries which were ignored; already cached
item<uint64_t> request; ///< Prefetcher requests added to the queue
item<uint64_t> directs; ///< Direct dispatches to db::request pool
item<uint64_t> handles; ///< Incremented before dispatch to db::request
item<uint64_t> handled; ///< Incremented after dispatch to db::request
item<uint64_t> fetches; ///< Incremented before actual database operation
item<uint64_t> fetched; ///< Incremented after actual database operation
item<uint64_t> cancels; ///< Count of canceled operations
// throughput totals
size_t fetched_bytes_key {0}; ///< Total bytes of key data received
size_t fetched_bytes_val {0}; ///< Total bytes of value data received
item<uint64_t> fetched_bytes_key; ///< Total bytes of key data received
item<uint64_t> fetched_bytes_val; ///< Total bytes of value data received
// from last operation only
microseconds last_snd_req {0us}; ///< duration request was queued here
microseconds last_req_fin {0us}; ///< duration for database operation
item<microseconds> last_snd_req; ///< duration request was queued here
item<microseconds> last_req_fin; ///< duration for database operation
// accumulated latency totals
microseconds accum_snd_req {0us};
microseconds accum_req_fin {0us};
item<microseconds> accum_snd_req;
item<microseconds> accum_req_fin;
ticker();
};

View file

@ -774,7 +774,7 @@ ircd::db::prefetcher::request_worker()
assert(request->fin == steady_point::min());
request->req = now<steady_point>();
ticker->last_snd_req = duration_cast<microseconds>(request->req - request->snd);
ticker->accum_snd_req += ticker->last_snd_req;
static_cast<microseconds &>(ticker->accum_snd_req) += ticker->last_snd_req;
ticker->fetches++;
request_handle(*request);
@ -832,7 +832,7 @@ try
const ctx::critical_assertion ca;
request.fin = now<steady_point>();
ticker->last_req_fin = duration_cast<microseconds>(request.fin - request.req);
ticker->accum_req_fin += ticker->last_req_fin;
static_cast<microseconds &>(ticker->accum_req_fin) += ticker->last_req_fin;
const bool lte
{
valid_lte(*it, key)
@ -954,6 +954,74 @@ const noexcept
};
}
//
// prefetcher::ticker
//
ircd::db::prefetcher::ticker::ticker()
:queries
{
{ "name", "ircd.db.prefetch.queries" },
}
,rejects
{
{ "name", "ircd.db.prefetch.rejects" },
}
,request
{
{ "name", "ircd.db.prefetch.request" },
}
,directs
{
{ "name", "ircd.db.prefetch.directs" },
}
,handles
{
{ "name", "ircd.db.prefetch.handles" },
}
,handled
{
{ "name", "ircd.db.prefetch.handled" },
}
,fetches
{
{ "name", "ircd.db.prefetch.fetches" },
}
,fetched
{
{ "name", "ircd.db.prefetch.fetched" },
}
,cancels
{
{ "name", "ircd.db.prefetch.cancels" },
}
,fetched_bytes_key
{
{ "name", "ircd.db.prefetch.fetched_bytes_key" },
}
,fetched_bytes_val
{
{ "name", "ircd.db.prefetch.fetched_bytes_val" },
}
,last_snd_req
{
{ "name", "ircd.db.prefetch.last_snd_req" },
}
,last_req_fin
{
{ "name", "ircd.db.prefetch.last_req_fin" },
}
,accum_snd_req
{
{ "name", "ircd.db.prefetch.accum_snd_req" },
}
,accum_req_fin
{
{ "name", "ircd.db.prefetch.accum_req_fin" },
}
{
}
///////////////////////////////////////////////////////////////////////////////
//
// db/txn.h
@ -4654,7 +4722,7 @@ ircd::db::_read(const vector_view<_read_op> &op,
// Find the correct stats to update, one for the specific column and
// one for the database total.
ircd::stats::item<uint64_t *> *item_[2]
ircd::stats::item<uint64_t> *item_[2]
{
parallelize && buf[i].empty()? &c.stats->multiget_referenced:
parallelize? &c.stats->multiget_copied: