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

Corrects BlockingBuffer's bufferUsage metric and adds capacityUsed metric #3937

Merged
merged 1 commit into from
Jan 10, 2024

Conversation

dlvenable
Copy link
Member

@dlvenable dlvenable commented Jan 10, 2024

Description

This PR has two changes for the bounded_blocking buffer:

  1. Adds a new capacityUsed metric which tracks the capacity used within the buffer as determined by the semaphore which controls admission to the buffer.
  2. Corrects the bufferUsage metric to track the percentage of the capacity used against the total capacity. This is done by tracking the semaphore. But, it is also logically equivalent to tracking the sum of recordsInBuffer and recordsInFlight. Previously, this metric only tracked recordsInBuffer.

I configured a tight buffer to fill it quickly and test the changes.

  buffer:
    bounded_blocking:
      buffer_size: 1000
      batch_size: 20

The following CloudWatch graphs show the metrics in action.

This graph shows the metrics and how the values correspond to each other correctly.

3936-new-metrics

This is the same graph, but I pinpointed a specific point it time to show the values at that time.

3936-new-metrics-pinpoint

Issues Resolved

Resolves #3936.

Check List

  • New functionality includes testing.
  • New functionality has a documentation issue. Please link to it in this PR.
    • New functionality has javadoc added
  • Commits are signed with a real name per the DCO

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

…between the bufferCapacity and the available permits in the semaphore. Adds a new capacityUsed metric which tracks the actual capacity used by the semaphore which blocks. Resolves opensearch-project#3936.

Signed-off-by: David Venable <[email protected]>
Copy link
Member

@graytaylor0 graytaylor0 left a comment

Choose a reason for hiding this comment

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

Nice!

@dlvenable
Copy link
Member Author

What do we think about backporting this change to the 2.6 branch as a possible patch?

On one hand, this could be thought of a somewhat breaking change since the percentage is now calculated differently and any tooling that uses this would be affected. But, on the other hand, I think it is correctly calculated. Thus, tooling is most likely affected by a correction.

@dlvenable dlvenable merged commit d61b0c5 into opensearch-project:main Jan 10, 2024
46 of 49 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jan 10, 2024
…between the bufferCapacity and the available permits in the semaphore. Adds a new capacityUsed metric which tracks the actual capacity used by the semaphore which blocks. Resolves #3936. (#3937)

Signed-off-by: David Venable <[email protected]>
(cherry picked from commit d61b0c5)
dlvenable added a commit that referenced this pull request Jan 10, 2024
…between the bufferCapacity and the available permits in the semaphore. Adds a new capacityUsed metric which tracks the actual capacity used by the semaphore which blocks. Resolves #3936. (#3937) (#3940)

Signed-off-by: David Venable <[email protected]>
(cherry picked from commit d61b0c5)

Co-authored-by: David Venable <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] BlockingBuffer.bufferUsage metric does not include records in-flight
3 participants