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

Release event pointers faster as they go through the pipeline #38166

Merged
merged 6 commits into from
Mar 20, 2024

Conversation

faec
Copy link
Contributor

@faec faec commented Mar 4, 2024

Proposed commit message

Make two changes to allow event data to be freed from memory faster:

  • Clear event pointers from the memory queue buffer when they are vended instead of when they're acknowledged. (The data will be preserved in the event batch structure until acknowledgment.)
  • Clear event pointers from the batch structure immediately after it is acknowledged instead of waiting for the batch to be freed naturally.

In benchmarks of Filebeat with saturated Filestream input going to an Elasticsearch output, this lowered average memory footprint by ~10%.

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.

@faec faec added enhancement Team:Elastic-Agent Label for the Agent team labels Mar 4, 2024
@faec faec self-assigned this Mar 4, 2024
@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 Mar 4, 2024
@faec faec marked this pull request as ready for review March 4, 2024 15:00
@faec faec requested a review from a team as a code owner March 4, 2024 15:00
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent (Team:Elastic-Agent)

Copy link
Contributor

mergify bot commented Mar 4, 2024

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @faec? 🙏.
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

@elasticmachine
Copy link
Collaborator

elasticmachine commented Mar 4, 2024

💚 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

  • Duration: 144 min 43 sec

❕ Flaky test report

No test was executed to be analysed.

🤖 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

@ycombinator ycombinator left a comment

Choose a reason for hiding this comment

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

Changes LGTM. Would it be possible to add some unit tests, basically ensuring the appropriate events fields are nil'd out after calls to the methods changed in this PR?

Copy link
Contributor

@leehinman leehinman left a comment

Choose a reason for hiding this comment

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

LGTM

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

cc @faec

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @faec

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

cc @faec

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @faec

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @faec

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

cc @faec

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

cc @faec

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @faec

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @faec

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @faec

@faec faec merged commit 2e4cbdb into elastic:main Mar 20, 2024
118 checks passed
@faec faec mentioned this pull request Mar 22, 2024
6 tasks
@faec faec added the backport-v8.13.0 Automated backport with mergify label Mar 28, 2024
mergify bot pushed a commit that referenced this pull request Mar 28, 2024
Make two changes to allow event data to be freed from memory faster:
- Clear event pointers from the memory queue buffer when they are vended instead of when they're acknowledged. (The data will be preserved in the event batch structure until acknowledgment.)
- Clear event pointers from the batch structure immediately after it is acknowledged instead of waiting for the batch to be freed naturally.

In benchmarks of Filebeat with saturated Filestream input going to an Elasticsearch output, this lowered average memory footprint by ~10%.

(cherry picked from commit 2e4cbdb)
faec added a commit that referenced this pull request Apr 5, 2024
Delete the proxy queue, a prototype written to reduce memory use in the old shipper project. Recent improvements to the memory queue (#37795, #38166) added support for the same early-free mechanisms as the proxy queue, so it is now redundant.

The proxy queue was never used or exposed in a public release, so there are no compatibility concerns.

(This is pre-cleanup for adding early-encoding support, to avoid implementing new functionality in a queue that is no longer used.)
zeynepyz pushed a commit to zeynepyz/beats that referenced this pull request Apr 7, 2024
Delete the proxy queue, a prototype written to reduce memory use in the old shipper project. Recent improvements to the memory queue (elastic#37795, elastic#38166) added support for the same early-free mechanisms as the proxy queue, so it is now redundant.

The proxy queue was never used or exposed in a public release, so there are no compatibility concerns.

(This is pre-cleanup for adding early-encoding support, to avoid implementing new functionality in a queue that is no longer used.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v8.13.0 Automated backport with mergify enhancement Team:Elastic-Agent Label for the Agent team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants