Skip to content
Snippets Groups Projects
Commit 8dd8ee4d authored by Nigel Kukard's avatar Nigel Kukard
Browse files

Set maximum flushed stats to 10k

parent ac91d31a
No related branches found
No related tags found
No related merge requests found
...@@ -72,6 +72,8 @@ use constant { ...@@ -72,6 +72,8 @@ use constant {
STATISTICS_DIR_TX => 1, STATISTICS_DIR_TX => 1,
STATISTICS_DIR_RX => 2, STATISTICS_DIR_RX => 2,
STATISTICS_MAXFLUSH_PER_PERIOD => 10000,
}; };
...@@ -349,9 +351,15 @@ sub _session_tick ...@@ -349,9 +351,15 @@ sub _session_tick
my $sthStatsBasicCleanup = $statsPreparedStatements->{'stats_basic_cleanup'}; my $sthStatsBasicCleanup = $statsPreparedStatements->{'stats_basic_cleanup'};
# Even out flushing over 10s to absorb spikes # Even out flushing over 10s to absorb spikes
my $maxFlush = int(@{$statsQueue} / 10) + 100; my $totalFlush = @{$statsQueue};
my $maxFlush = int($totalFlush / 10) + 100;
my $numFlush = 0; my $numFlush = 0;
# Make sure we don't write more than 10k entries per pass
if ($maxFlush > STATISTICS_MAXFLUSH_PER_PERIOD) {
$maxFlush = STATISTICS_MAXFLUSH_PER_PERIOD;
}
# Loop and build the data to create our multi-insert # Loop and build the data to create our multi-insert
my (@insertHolders,@insertBasicHolders); my (@insertHolders,@insertBasicHolders);
my (@insertData,@insertBasicData); my (@insertData,@insertBasicData);
...@@ -418,7 +426,7 @@ sub _session_tick ...@@ -418,7 +426,7 @@ sub _session_tick
my $timediff2 = tv_interval($timer1,$timer2); my $timediff2 = tv_interval($timer1,$timer2);
$logger->log(LOG_INFO,"[STATISTICS] Total stats flush time %s/%s records: %s", $logger->log(LOG_INFO,"[STATISTICS] Total stats flush time %s/%s records: %s",
$numFlush, $numFlush,
$maxFlush, $totalFlush,
sprintf('%.3fs',$timediff2) sprintf('%.3fs',$timediff2)
); );
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment