From 0f5a0a8e2d43774288d4d6ea747278ca6e085a2a Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 20 Mar 2026 02:17:04 +0000 Subject: 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. --- src/webstat_logger_main.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/webstat_logger_main.cpp') diff --git a/src/webstat_logger_main.cpp b/src/webstat_logger_main.cpp index 6d3aeda..39d794a 100644 --- a/src/webstat_logger_main.cpp +++ b/src/webstat_logger_main.cpp @@ -53,6 +53,8 @@ main(int argc, char ** argv) "Maximum number of concurrent write/read write DB connections") ("db.wr.keep", po::value(&settings.dbKeep)->default_value(settings.dbKeep), "Number of write/read write DB connections to keep open") + ("db.maxBatchSize", po::value(&settings.maxBatchSize)->default_value(settings.maxBatchSize), + "Maximum number of access log entries to hold in memory before writing them to the DB") ("fallback.dir", po::value(&settings.fallbackDir)->default_value(settings.fallbackDir), "Path to write access logs to when the database is unavailable") ("jobs.check", po::value(&settings.checkJobsAfter)->default_value(settings.checkJobsAfter), -- cgit v1.3