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

Stop using ReleasableLock in o.e.c.cache.Cache to save O(10M) in heap #107555

Merged

Conversation

original-brownbear
Copy link
Member

I have a couple heap dumps that show the lock wrapper alone waste O(10M) in heap for these things. Also, I suspect the indirection does cost non-trivial performance here in some cases.
=> lets spend a couple more lines of code to save that overhead

I have a couple heap dumps that show the lock wrapper alone waste O(10M)
in heap for these things. Also, I suspect the indirection does cost
non-trivial performance here in some cases.
=> lets spend a couple more lines of code to save that overhead
@original-brownbear original-brownbear added >non-issue :Core/Infra/Core Core issues without another label labels Apr 17, 2024
@elasticsearchmachine elasticsearchmachine added Team:Core/Infra Meta label for core/infra team v8.14.0 labels Apr 17, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

Copy link
Member

@thecoop thecoop left a comment

Choose a reason for hiding this comment

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

LGTM. May be worth a comment so a future refactor doesn't change it back...

@original-brownbear original-brownbear removed the request for review from DaveCTurner April 17, 2024 08:13
@original-brownbear
Copy link
Member Author

Thanks Simon! I wonder, should we maybe just do away with ReleasableLock instead? The code savings from using it are trivial and the performance impact (overhead) is hard to quantify in terms of JIT optimisations I think.

Copy link
Contributor

@DaveCTurner DaveCTurner left a comment

Choose a reason for hiding this comment

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

LGTM2

There's various other usages of ReleasableLock on hot-ish paths too (particularly in the engine and translog subsystems) that might want the same treatment.

@original-brownbear
Copy link
Member Author

that might want the same treatment.

Yea lets do that asap, I can do it on the side today :) I'm starting to get the feeling the overhead here is more than my initial intuition suggested actually ...

@original-brownbear original-brownbear added the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Apr 17, 2024
@elasticsearchmachine elasticsearchmachine merged commit 1d0c470 into elastic:main Apr 17, 2024
14 checks passed
@original-brownbear original-brownbear deleted the cheaper-cache-segment branch April 17, 2024 08:55
original-brownbear added a commit to original-brownbear/elasticsearch that referenced this pull request Apr 18, 2024
As discussed in elastic#107555 there's some overhead to the use of `ReleasableLock`
and it's probably not a good idea using it on the hot(ish) path in this class.
original-brownbear added a commit that referenced this pull request Jul 2, 2024
As discussed in #107555 there's some overhead to the use of `ReleasableLock`
and it's probably not a good idea using it on the hot(ish) path in this class.
@mkhludnev
Copy link

Hello,
Could ReleasableLock (old) cause high contention on field data cache like described https://discuss.elastic.co/t/es-8-6-high-contention-over-global-ordingals-field-data-for-terms-aggregation-under-load/368525 ?

@original-brownbear original-brownbear restored the cheaper-cache-segment branch November 30, 2024 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) :Core/Infra/Core Core issues without another label >non-issue Team:Core/Infra Meta label for core/infra team v8.14.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants