prometheus / prometheus/client_ruby

Reduce DirectFileStore memory overhead, particularly while aggregating data when getting scraped

Open
#185 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Help wanted
Dominant language
Ruby
Stars
558
Forks
154
PR merge metrics
No merged PRs in 30d

Description

As we mention in our README, using DirectFileStore has a measurable impact on the production app's memory usage.

This doesn't seem to be a memory leak, it doesn't grow unbounded over time, but it is a problem for some of our users.

We think this memory usage is particularly high when getting scraped, at which point the library has to read all the files from all the processes, and load all the data in RAM to aggregate it. There may be more efficient ways to do this. As an example, we've found this improvement in the past.

We'd like to reduce the memory overhead of using DirectFileStore as much as possible, so this is a sort of call for PRs.

Original issue text below, for the conversation thread below to make sense:


Hi Prometheus team,

We've bumped into issues like this

Screenshot 2020-04-14 17 55 37

Is there any possibility to dump the file store properly?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the DirectFileStore caveats in README and inspect the scrape-time aggregation path described in the issue. Use the prior improvement in PR 160 as a reference point and profile memory while all process files are read. Done means reducing peak memory overhead without changing the aggregated scrape result.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.