Skip to content

Commit 49eb9f4

Browse files
thorfourmetalmatze
andauthored
Add new flag to use an on-disk index (#4323)
Co-authored-by: Matthias Loibl <[email protected]>
1 parent 3a219ca commit 49eb9f4

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ Flags:
120120
Number of rows in each row group during
121121
compaction and persistence. Setting to <= 0
122122
results in a single row group per file.
123+
--storage-index-on-disk Whether to store the index on disk instead
124+
of in memory. Useful to reduce the memory
125+
footprint of the store.
123126
--symbolizer-demangle-mode="simple"
124127
Mode to demangle C++ symbols. Default mode
125128
is simplified: no parameters, no templates,

pkg/parca/parca.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import (
3737
"github.com/oklog/run"
3838
"github.com/polarsignals/frostdb"
3939
"github.com/polarsignals/frostdb/dynparquet"
40+
"github.com/polarsignals/frostdb/index"
4041
"github.com/polarsignals/frostdb/query"
4142
"github.com/prometheus/client_golang/prometheus"
4243
promconfig "github.com/prometheus/common/config"
@@ -142,6 +143,7 @@ type FlagsStorage struct {
142143
EnableWAL bool `default:"false" help:"Enables write ahead log for profile storage."`
143144
SnapshotTriggerSize int64 `default:"134217728" help:"Number of bytes to trigger a snapshot. Defaults to 1/4 of active memory. This is only used if enable-wal is set."`
144145
RowGroupSize int `default:"8192" help:"Number of rows in each row group during compaction and persistence. Setting to <= 0 results in a single row group per file."`
146+
IndexOnDisk bool `default:"false" help:"Whether to store the index on disk instead of in memory. Useful to reduce the memory footprint of the store."`
145147
}
146148

147149
type FlagsSymbolizer struct {
@@ -309,6 +311,15 @@ func Run(ctx context.Context, logger log.Logger, reg *prometheus.Registry, flags
309311
frostdb.WithStoragePath(flags.Storage.Path),
310312
frostdb.WithSnapshotTriggerSize(flags.Storage.SnapshotTriggerSize),
311313
)
314+
315+
if flags.Storage.IndexOnDisk {
316+
frostdbOptions = append(frostdbOptions, frostdb.WithIndexConfig(
317+
[]*index.LevelConfig{
318+
{Level: index.L0, MaxSize: 1024 * 1024 * 15, Type: index.CompactionTypeParquetDisk},
319+
{Level: index.L1, MaxSize: 1024 * 1024 * 128, Type: index.CompactionTypeParquetDisk},
320+
{Level: index.L2, MaxSize: 1024 * 1024 * 512},
321+
}))
322+
}
312323
}
313324

314325
col, err := frostdb.New(frostdbOptions...)

0 commit comments

Comments
 (0)