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

Elasticsearch observer improvements to avoid blocking between workers. #6084

Merged
merged 5 commits into from
Oct 14, 2022

Conversation

barkbay
Copy link
Contributor

@barkbay barkbay commented Oct 12, 2022

This PR implements a few improvements on the observer:

I eventually decided to not introduce a custom, low, timeout as suggested in #6078 for the following reasons:

  • Moving the first synchronous observation out of the lock-protected section should solve the main bottleneck.
  • Adding an additional timeout value means adding a new flag or/and implement an implicit default value.
  • If the call to _cluster/health is slow then chances are that it'll also be the case for subsequent API calls, not sure why we would treat this one as a special case.

Fixes #6078

@barkbay barkbay added >enhancement Enhancement of existing functionality v2.6.0 labels Oct 12, 2022
default:
// No change, close the provided Client and return the existing observer.
esClient.Close()
Copy link
Contributor

Choose a reason for hiding this comment

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

I had forgotten that. It's not great. I opened:

Copy link
Contributor

@thbkrkr thbkrkr left a comment

Choose a reason for hiding this comment

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

I was about to suggest moving the blocking call outside the lock and you beat me :-)
I checked that it doesn't break the fix made for #5812.

LGTM!

@barkbay barkbay merged commit 1802104 into elastic:main Oct 14, 2022
@barkbay barkbay deleted the observer-improvements branch October 14, 2022 11:51
@naemono naemono changed the title Observer improvements Elasticsearch observer improvements to avoid blocking between workers. Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement Enhancement of existing functionality v2.6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Synchronous observation side effects
2 participants