mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 15:33:54 +01:00
ircd:Ⓜ️:homeserver: Make use of batch size constant for event vector size.
ircd:Ⓜ️:homeserver: Comments; minor cleanup.
This commit is contained in:
parent
312625bc08
commit
7b238fe15d
1 changed files with 13 additions and 10 deletions
|
@ -273,23 +273,19 @@ try
|
||||||
// Outputs to infolog for each event; may be noisy;
|
// Outputs to infolog for each event; may be noisy;
|
||||||
vmopts.infolog_accept = false;
|
vmopts.infolog_accept = false;
|
||||||
|
|
||||||
static const size_t batch_max
|
static const size_t batch_max {2048};
|
||||||
{
|
std::vector<m::event> vec(batch_max);
|
||||||
2048
|
|
||||||
};
|
|
||||||
|
|
||||||
size_t count {0}, ebytes[2] {0, 1}, accept {0};
|
size_t count {0}, ebytes[2] {0, 1}, accept {0};
|
||||||
std::vector<m::event> vec(1024);
|
|
||||||
vm::eval eval
|
vm::eval eval
|
||||||
{
|
{
|
||||||
vmopts
|
vmopts
|
||||||
};
|
};
|
||||||
|
|
||||||
// Perform the eval
|
|
||||||
util::timer stopwatch;
|
util::timer stopwatch;
|
||||||
auto it(begin(events));
|
auto it(begin(events));
|
||||||
while(it != end(events))
|
while(it != end(events))
|
||||||
{
|
{
|
||||||
|
// page in the JSON
|
||||||
size_t i(0);
|
size_t i(0);
|
||||||
for(; i < vec.size() && it != end(events); ++i, ++it)
|
for(; i < vec.size() && it != end(events); ++i, ++it)
|
||||||
{
|
{
|
||||||
|
@ -298,6 +294,7 @@ try
|
||||||
ebytes[1] += elem.size() + 1;
|
ebytes[1] += elem.size() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// process the event batch
|
||||||
const size_t accepted
|
const size_t accepted
|
||||||
{
|
{
|
||||||
execute(eval, vector_view<const m::event>
|
execute(eval, vector_view<const m::event>
|
||||||
|
@ -319,6 +316,7 @@ try
|
||||||
0UL
|
0UL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// advise dontneed
|
||||||
ebytes[0] += evict(map, incore, opts);
|
ebytes[0] += evict(map, incore, opts);
|
||||||
|
|
||||||
const auto db_bytes
|
const auto db_bytes
|
||||||
|
@ -326,6 +324,11 @@ try
|
||||||
db::ticker(*dbs::events, "rocksdb.bytes.written")
|
db::ticker(*dbs::events, "rocksdb.bytes.written")
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const auto elapsed
|
||||||
|
{
|
||||||
|
stopwatch.at<seconds>().count()
|
||||||
|
};
|
||||||
|
|
||||||
log::info
|
log::info
|
||||||
{
|
{
|
||||||
log, "Bootstrap retired:%zu count:%zu accept:%zu %s in %s | %zu event/s; input %s/s; output %s/s",
|
log, "Bootstrap retired:%zu count:%zu accept:%zu %s in %s | %zu event/s; input %s/s; output %s/s",
|
||||||
|
@ -334,9 +337,9 @@ try
|
||||||
accept,
|
accept,
|
||||||
pretty(pbuf[0], iec(ebytes[1])),
|
pretty(pbuf[0], iec(ebytes[1])),
|
||||||
stopwatch.pretty(pbuf[1]),
|
stopwatch.pretty(pbuf[1]),
|
||||||
(count / std::max(stopwatch.at<seconds>().count(), 1L)),
|
(count / std::max(elapsed, 1L)),
|
||||||
pretty(pbuf[2], iec(ebytes[1] / std::max(stopwatch.at<seconds>().count(),1L)), 1),
|
pretty(pbuf[2], iec(ebytes[1] / std::max(elapsed, 1L)), 1),
|
||||||
pretty(pbuf[3], iec(db_bytes / std::max(stopwatch.at<seconds>().count(),1L)), 1),
|
pretty(pbuf[3], iec(db_bytes / std::max(elapsed, 1L)), 1),
|
||||||
};
|
};
|
||||||
|
|
||||||
ctx::yield();
|
ctx::yield();
|
||||||
|
|
Loading…
Reference in a new issue