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

Create an Elasticsearch client for the observer only if needed #6090

Closed
thbkrkr opened this issue Oct 13, 2022 · 0 comments · Fixed by #6407
Closed

Create an Elasticsearch client for the observer only if needed #6090

thbkrkr opened this issue Oct 13, 2022 · 0 comments · Fixed by #6407
Labels
>enhancement Enhancement of existing functionality

Comments

@thbkrkr
Copy link
Contributor

thbkrkr commented Oct 13, 2022

Since #2916, we close the ES client at each observation to avoid memory leak, because at each reconciliation we create a new ES client even if we don't need it.

default:
esClient.Close()
return observer

It had been identified as a first non-optimal remediation that we had to improve, but ultimately we never did.

#2916 (comment):

I think that instead of passing in a fully instantiated client that gets thrown away most of the time, we should pass a function that creates the client if needed only. This is because creating the client still requires some work like adding the certificates to a trust chain and creating a new HTTP client etc.

@thbkrkr thbkrkr added the >enhancement Enhancement of existing functionality label Oct 13, 2022
@barkbay barkbay changed the title Create an ES client for the observer only if needed Create an Elasticsearch client for the observer only if needed May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement Enhancement of existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant