output/eve: reduce fflush call count #12288
Open
+655
−93
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Continuation of #12135
Reduce fflush calls on output streams (regular files only).
Output can be buffered, specify the buffer-size with
outputs.<type>.buffer-size
. A value of 0 selects no buffering; otherwise, up to the buffer-size value can be buffered. Note that this buffering is part of the stdio library.Since output can be buffered, a mechanism that periodically flushes the output streams has been added. The
heartbeat.output-flush-interval
configuration setting specifies at what interval the output should be flushed. A value of 0 means never flush.Link to redmine ticket: 3449
Describe changes:
buffer-size
. When 0, unbuffered I/O is used; other values are used to set the stdio buffer size. The value isoutputs.eve-log.buffer-size
heartbeat.output-flush-interval
-- to set cadence for Suricata periodically directing detect threads to flush EVE output. To be used in conjunction withbuffer-size
. Setheartbeat.output-flush-interval
to the number of seconds Suricata should periodically cause the EVE output to be flushed. The default value is0
which instructs Suricata never to cause the EVE output to be flushed.heartbeat.output-flush-interval
heartbeat.output-flush-interval
is between 1 and 60 in seconds).Updates:
Suricata build information
Benchmarks/Measurements
Hyperfine was used to measure results with my pcap collection and ET Pro
Summary: Buffering had the biggest impact; using the flushing mechanism had little impact but is necessary for integrity.
Recommendation:
eve-log.buffer-size
: TBDheartbeat.output-flush-interval
TBDPermutations benchmarked for
buffer-size
andoutput-flush-interval
Hyperfine output