-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
output/eve: reduce fflush call count #11059
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #11059 +/- ##
==========================================
- Coverage 84.08% 84.05% -0.04%
==========================================
Files 925 926 +1
Lines 250562 250804 +242
==========================================
+ Hits 210687 210808 +121
- Misses 39875 39996 +121
Flags with carried forward coverage won't be shown. Click here to find out more. |
Information: QA ran without warnings. Pipeline 20584 |
Are you working on getting a green CI ? |
Yes, that's why this is a draft. |
2a7caba
to
ee0c87b
Compare
ERROR: ERROR: QA failed on build_fetch. Pipeline 20658 |
Issue: 3449 Add a flush function to packet logger registration and collapse the parameter count for registration functions.
This commit adds 2 EVE output buffering settings - buffer-size value which specifies the amount of buffering, if any, for regular/file output types. - flush-interval Specifies the cadence at which Suricata will direct detect threads to flush EVE output. Issue: 3449
Issue: 3449
Issue: 3449 Add flushing functions and infrastructure. This includes: - Flushing functions for packet loggers - Log file flushing support
Issue: 3449 Add a flush directive to the packet that is distinct from the existing "log flush" flag as the new flag is to distinguish between the 2 use cases.
Information: QA ran without warnings. Pipeline 20684 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the work :-)
- CI : 🟢
- Code : Checking now
- Commits segmentation : looks ok, but not sure as I did not dive into the code...
- Commit messages : I no longer see
flush-interval
in the code, only in a git message... - Git ID set : looks fine for me
- CLA : you already contributed :-p
- Doc update : ok
- Redmine ticket : ok
- Rustfmt : no rust
- Tests : What is the good way to test it ? QAlab for perf improvement ?
- Dependencies added: none
# Specify the amount of buffering, in bytes, for | ||
# this output type. The default value 0 means "no | ||
# buffering". | ||
#buffer-size: 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flush-interval is missing ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be nice to be squashed into the suricata.yaml.in commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flush-interval is missing ?
output-flush-interval
is in the heartbeat
section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see it added in suricata.yaml.in but not in docs
setbuf(ret, NULL); | ||
SCLogConfig("Setting output to %s non-buffered", filename); | ||
} else { | ||
if (setvbuf(ret, NULL, _IOFBF, buffer_size) < 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the important line, right ?
* | ||
* \author Jeff Lucovsky <jlucovsky@oisf.net> | ||
*/ | ||
#ifndef __LOG_FLUSH_H__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new guard style
# Logging configuration. This is not about logging IDS alerts/events, but | ||
# output about what Suricata is doing, like startup messages, errors, etc. | ||
logging: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit
Continuation of #9832
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 to never cause the EVE output to be flushed.heartbeat.output-flush-interval
heartbeat.output-flush-interval
is between 1 and 60).Updates:
Benchmarks/Measurements
Hyperfine used to measure results with my pcap collection and ET Pro
Summary: buffer-size=0, output-flush-interval=0 was the slowest. Buffer-size gave a (slight) performance boost and adding a non-zero output-flush-interval did not degrade performance
Recommendation:
Permutations for
buffer-size
andoutput-flush-interval