summaryrefslogtreecommitdiff
path: root/test/perf-ingest.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2026-03-20 02:17:04 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2026-03-20 02:23:08 +0000
commit0f5a0a8e2d43774288d4d6ea747278ca6e085a2a (patch)
tree08878dff32a636b388c660fd3330f1bddbd98af3 /test/perf-ingest.cpp
parent8c6fecd356003309f8eebec30374344272ca6072 (diff)
downloadwebstat-0f5a0a8e2d43774288d4d6ea747278ca6e085a2a.tar.bz2
webstat-0f5a0a8e2d43774288d4d6ea747278ca6e085a2a.tar.xz
webstat-0f5a0a8e2d43774288d4d6ea747278ca6e085a2a.zip
Insert log entries in batches
Store log lines in memory until threshold is reach or idle occurs, then insert all the lines in a single transaction. Save points handle the case of insertion errors. On success the queue is cleared. Parked lines also saved in bulk, only necessary if queued lines could not be inserted on shutdown, else the queue simply grows until ability to insert is restored. Importing parked lines just adds them to the queue and the normal process then follows.
Diffstat (limited to 'test/perf-ingest.cpp')
-rw-r--r--test/perf-ingest.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/perf-ingest.cpp b/test/perf-ingest.cpp
index 69212de..c403349 100644
--- a/test/perf-ingest.cpp
+++ b/test/perf-ingest.cpp
@@ -25,6 +25,7 @@ namespace {
std::make_shared<WebStat::MockDBPool>("webstat"),
{
.userAgentAPI = {},
+ .maxBatchSize = static_cast<size_t>(state.range(0)),
}};
for (auto loop : state) {
WebStat::FilePtr logFile {fopen(TMP_LOG.c_str(), "r")};
@@ -33,6 +34,6 @@ namespace {
}
}
-BENCHMARK(doIngestFile)->Setup(setup);
+BENCHMARK_RANGE(doIngestFile, 1, 1024)->Setup(setup);
BENCHMARK_MAIN();