Skip to content

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?

Copy link
Contributor

@f41gh7 f41gh7 left a comment

Choose a reason for hiding this comment

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

LGTM

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.

4 participants