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

Dynamically resize cache depending on the amount of RAM available #167

Closed
1 task
petethepig opened this issue Apr 27, 2021 · 0 comments
Closed
1 task
Labels
backend Mostly go code storage Low level storage matters

Comments

@petethepig
Copy link
Member

petethepig commented Apr 27, 2021

Introduction

Pyroscope keeps most frequently used objects in an LFU cache layer in RAM. This way we get good write and read performance.

See our Storage design doc for more context on the overall architecture.

image

Summary of the problem

Currently the size of this cache is hardcoded at 1,000 or 10,000 depending on the type of object, see the relevant code here.

This works for an average system with ~ 8GB of RAM, but fails if you want to use pyroscope on a smaller or larger machine. With smaller ones you end up with out-of-memory (OOM) events, and on larger systems you're just not utilizing all of RAM available, which is also bad.

Page2 2

When cache gets too big it takes time to save it to disk

Proposed solution

We need to change the way these caches work. We need to make the cache take into consideration the amount of RAM available. Currently we use this project https://github.com/dgrijalva/lfu-go for LFU implementation. We should probably fork it or write our own.

TODO:

@petethepig petethepig added this to Q2 (Apr – Jun) 2021 in Pyroscope Public Roadmap Apr 28, 2021
@petethepig petethepig added backend Mostly go code storage Low level storage matters labels Apr 30, 2021
@petethepig petethepig moved this from TODO to Discussion / Seeking Contributors in Pyroscope Public Roadmap May 17, 2021
@petethepig petethepig moved this from Discussion / Seeking Contributors to In progress in Pyroscope Public Roadmap May 21, 2021
alonlong pushed a commit that referenced this issue May 25, 2021
petethepig added a commit that referenced this issue Jun 11, 2021
…ssue #167) (#213)

Co-authored-by: alonlong <alonlong@163.com>
Co-authored-by: Dmitry Filimonov <dmitry@pyroscope.io>
@petethepig petethepig moved this from In progress to Done in Pyroscope Public Roadmap Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Mostly go code storage Low level storage matters
Development

No branches or pull requests

1 participant