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

Implement API for getting memory allocation statistics #77

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rjl493456442
Copy link

@rjl493456442 rjl493456442 commented Aug 8, 2023

This PR implements a API for retrieving offheap memory allocation statistics.

Fastcache allocates the offheap memory "manually" in order to mitigate the
overhead of golang garbage collection. However it also means this part of
memory won't be tracked by golang standard metrics.

In order to accurately know how much memory is used by our application,
we need this additional statistics to sum up the standard memory usage.

@rjl493456442
Copy link
Author

@valyala please take a look?

@karalabe
Copy link

karalabe commented Aug 8, 2023

For the record, our need for the metrics arose from a missed Reset operation which resulted in an eventual OOM. None of our monitoring systems detected the issue ahead of time since the memory was not reported by Go. Would be nice to be able to track it at least explicitly to have an early warning for similar issues in the future.

@erikdubbelboer
Copy link

I'm curious how you got an OOM. Did you set maxBytes higher than the available memory?

@karalabe
Copy link

karalabe commented Aug 8, 2023

No, we had ephemeral cache instances and a refactor lost the Reset when the outer temporary object got cleaned up.

@rjl493456442
Copy link
Author

@valyala any chance to take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants