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
refactor(userspace/falco): re-design stats writer and make it thread-safe #2109
Conversation
/milestone 0.33.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.
Very nice and clean PR! Thank you Jason!
I'll wait for approval until 0.32.1 is out :)
dd08ea6
to
95138c4
Compare
This new model uses an async worker and a concurrent queue to handle stats writing. This ensures better performance, because the live event processing loop will just need to do a push on the queue instead of writing to a file (only when the timer triggers), and should be thread-safe by design. Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
…ction Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
95138c4
to
efa9af2
Compare
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.
SGMT, just the copyright year to be updated :)
Co-authored-by: Leonardo Grasso <me@leonardograsso.com> Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
Co-authored-by: Leonardo Grasso <me@leonardograsso.com> Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
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.
/approve
LGTM label has been added. Git tree hash: e61f31be02c7064be6b4fa5fbd89818ee880587c
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: FedeDP, jasondellaluce The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
Thank you
What type of PR is this?
/kind cleanup
/kind design
Any specific area of the project related to this PR?
/area engine
What this PR does / why we need it:
As for the requirements of #2074, this PR refactors the stats writer of Falco to make it thread-safe. The class has been re-designed as a whole with a multi-producer single-consumer model with a worker and a queue (similar to what we have in the output framework). Moreover, this approach should also perform a little better because during the event processing loop we now push on the queue instead of writing on the file buffer (it just happens once in a while when the periodic timeout ticks, so it's not a big deal). This design also make it easier to add new stats field if needed in the future.
Which issue(s) this PR fixes:
Special notes for your reviewer:
Does this PR introduce a user-facing change?: