prometheus/prometheus

ST: Optimize CPU/memory use for OM1.0 Text CT/ST parsing (`st-storage` and `created-timestamp-zero-ingestion` features)

Open

#14,823 opened on Sep 4, 2024

View on GitHub
 (3 comments) (1 reaction) (0 assignees)Go (10,408 forks)batch import
component/scrapinghelp wanted

Repository metrics

Stars
 (64,042 stars)
PR merge metrics
 (Avg merge 11d 5h) (118 merged PRs in 30d)

Description

Proposal

As observed accidently on main and without any feature flag we use a lot of memory for CreatedTimestamp call for OM text. This is .due to deep coping of parser on every CreatedTimestamp, so technically per every series (!). This was a known naive implementation we decided to accept when iterating on this feature in https://github.com/prometheus/prometheus/pull/14356

This issue is to minimize that memory use. We already discussed this, but to put it here:

  • We should see if we can reuse existing parser (not copy it).
  • If we have to copy, copy once and reuse a second parser (e.g. reset it's positions).

IMPORTANT: This is only relevant to OpenMetrics 1.0. We designed OM 2 to not have that problem.

Acceptance Criteria

  • The additional memory use per OM Text scrape with CT feature is minimal (~within +5% max)

Related to https://github.com/prometheus/prometheus/issues/14217

Contributor guide