Skip to content
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

Make fingerprinting faster #36073

Merged
merged 1 commit into from
Jul 17, 2023
Merged

Make fingerprinting faster #36073

merged 1 commit into from
Jul 17, 2023

Conversation

rdner
Copy link
Member

@rdner rdner commented Jul 15, 2023

What does this PR do?

By using a buffer of the fingerprint's size. This descreases the amount of syscalls for reading the file.

Also added the benchmark for tracking the function's performance.

Benchmark results

Before (avg. ~22917 ns/op)

BenchmarkToFileDescriptor
BenchmarkToFileDescriptor-10               49345             23316 ns/op
BenchmarkToFileDescriptor-10               49766             23090 ns/op
BenchmarkToFileDescriptor-10               50439             22641 ns/op
BenchmarkToFileDescriptor-10               53368             22672 ns/op
BenchmarkToFileDescriptor-10               51948             22865 ns/op

After (avg. ~15501 ns/op)

BenchmarkToFileDescriptor
BenchmarkToFileDescriptor-10               68728             15549 ns/op
BenchmarkToFileDescriptor-10               75000             15558 ns/op
BenchmarkToFileDescriptor-10               73772             15575 ns/op
BenchmarkToFileDescriptor-10               74607             15134 ns/op
BenchmarkToFileDescriptor-10               76077             15690 ns/op

Performance gain is ~32%

Why is it important?

Who does not like performance improvements?

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
    - [ ] I have made corresponding changes to the documentation
    - [ ] I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
    - [ ] I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

How to test this PR locally

Related issues

By using a buffer of the fingerprint's size. This descreases the
amount of syscalls for reading the file.

Also added the benchmark for tracking the function's performance.
@rdner rdner added enhancement Filebeat Filebeat Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team labels Jul 15, 2023
@rdner rdner requested a review from a team as a code owner July 15, 2023 06:14
@rdner rdner self-assigned this Jul 15, 2023
@rdner rdner requested review from belimawr and faec July 15, 2023 06:14
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Jul 15, 2023
@mergify
Copy link
Contributor

mergify bot commented Jul 15, 2023

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @rdner? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v8./d.0 is the label to automatically backport to the 8./d branch. /d is the digit

@rdner rdner added the backport-v7.17.0 Automated backport with mergify label Jul 15, 2023
@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2023-07-15T06:14:33.759+0000

  • Duration: 70 min 2 sec

Test stats 🧪

Test Results
Failed 0
Passed 8046
Skipped 757
Total 8803

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

Copy link
Contributor

@pchila pchila left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pierrehilbert pierrehilbert added the Team:Elastic-Agent Label for the Agent team label Jul 17, 2023
@rdner rdner merged commit 061cb88 into elastic:main Jul 17, 2023
25 checks passed
@rdner rdner deleted the optimise-fingerprint branch July 17, 2023 12:18
mergify bot pushed a commit that referenced this pull request Jul 17, 2023
By using a buffer of the fingerprint's size. This descreases the
amount of syscalls for reading the file.

Also added the benchmark for tracking the function's performance.

(cherry picked from commit 061cb88)
rdner added a commit that referenced this pull request Jul 17, 2023
By using a buffer of the fingerprint's size. This descreases the
amount of syscalls for reading the file.

Also added the benchmark for tracking the function's performance.

(cherry picked from commit 061cb88)

Co-authored-by: Denis <denis.rechkunov@elastic.co>
Scholar-Li pushed a commit to Scholar-Li/beats that referenced this pull request Feb 5, 2024
By using a buffer of the fingerprint's size. This descreases the
amount of syscalls for reading the file.

Also added the benchmark for tracking the function's performance.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v7.17.0 Automated backport with mergify enhancement Filebeat Filebeat Team:Elastic-Agent Label for the Agent team Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants