Skip to content

Commit 2d3749a

Browse files
committed
parquet sg: artificially cut down query and materialization concurrency
1 parent b1ec49e commit 2d3749a

File tree

6 files changed

+22
-21
lines changed

6 files changed

+22
-21
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ require (
2929
github.com/opentracing-contrib/go-stdlib v1.1.0 // indirect
3030
github.com/opentracing/opentracing-go v1.2.1-0.20220228012449-10b1cf09e00b
3131
github.com/pkg/errors v0.9.1
32-
github.com/prometheus-community/parquet-common v0.0.0-20251111155302-ad37ac945d97
32+
github.com/prometheus-community/parquet-common v0.0.0-20251112212740-499d487df754
3333
github.com/prometheus/alertmanager v0.28.1
3434
github.com/prometheus/client_golang v1.23.2
3535
github.com/prometheus/client_model v0.6.2

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -914,8 +914,8 @@ github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSg
914914
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU=
915915
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
916916
github.com/pquerna/ffjson v0.0.0-20190930134022-aa0246cd15f7/go.mod h1:YARuvh7BUWHNhzDq2OM5tzR2RiCcN2D7sapiKyCel/M=
917-
github.com/prometheus-community/parquet-common v0.0.0-20251111155302-ad37ac945d97 h1:h+eNPOYyloibGIotLk+nMeSG51vlL4++w/iuuiO9bMY=
918-
github.com/prometheus-community/parquet-common v0.0.0-20251111155302-ad37ac945d97/go.mod h1:gewN7ZuOXJh0X2I57iGHyDLbLvL891P2Ynko2QM5axY=
917+
github.com/prometheus-community/parquet-common v0.0.0-20251112212740-499d487df754 h1:7jfGdBI7IQQbQ1EWr6ar0/aG+WjR8H+kO/1MPwinazw=
918+
github.com/prometheus-community/parquet-common v0.0.0-20251112212740-499d487df754/go.mod h1:gewN7ZuOXJh0X2I57iGHyDLbLvL891P2Ynko2QM5axY=
919919
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
920920
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
921921
github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=

pkg/storage/parquet/chunk_querier.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ type querierOpts struct {
3131
}
3232

3333
var DefaultQuerierOpts = querierOpts{
34-
concurrency: runtime.GOMAXPROCS(0),
34+
concurrency: (runtime.GOMAXPROCS(0) + 1) / 2,
3535
rowCountLimitFunc: search.NoopQuotaLimitFunc,
3636
chunkBytesLimitFunc: search.NoopQuotaLimitFunc,
3737
dataBytesLimitFunc: search.NoopQuotaLimitFunc,

pkg/storage/parquet/queryable_shard.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func newQueryableShard(
4040
return nil, err
4141
}
4242
materializer, err := search.NewMaterializer(
43-
shardSchema, chunksDecoder, shard, opts.concurrency, rowCountQuota, chunkBytesQuota, dataBytesQuota, opts.materializedSeriesCallback, opts.materializedLabelsFilterCallback, false)
43+
shardSchema, chunksDecoder, shard, (opts.concurrency+1)/2, rowCountQuota, chunkBytesQuota, dataBytesQuota, opts.materializedSeriesCallback, opts.materializedLabelsFilterCallback, false)
4444
if err != nil {
4545
return nil, err
4646
}
@@ -55,7 +55,7 @@ func newQueryableShard(
5555

5656
func (b queryableShard) Query(ctx context.Context, sorted bool, sp *prom_storage.SelectHints, mint, maxt int64, skipChunks bool, matchers []*labels.Matcher) (prom_storage.ChunkSeriesSet, error) {
5757
errGroup, ctx := errgroup.WithContext(ctx)
58-
errGroup.SetLimit(b.concurrency)
58+
errGroup.SetLimit((b.concurrency + 1) / 2)
5959

6060
rowGroupCount := len(b.shard.LabelsFile().RowGroups())
6161
results := make([][]prom_storage.ChunkSeries, rowGroupCount)
@@ -128,7 +128,7 @@ func (b queryableShard) QueryIter(ctx context.Context, sorted bool, sp *prom_sto
128128
err error,
129129
) {
130130
errGroup, groupCtx := errgroup.WithContext(ctx)
131-
errGroup.SetLimit(b.concurrency)
131+
errGroup.SetLimit((b.concurrency + 1) / 2)
132132

133133
rowGroupCount := len(b.shard.LabelsFile().RowGroups())
134134
labelsSets := make([]prom_storage.ChunkSeriesSet, rowGroupCount)
@@ -222,7 +222,7 @@ func (b queryableShard) LabelNames(ctx context.Context, limit int64, matchers []
222222
}
223223

224224
errGroup, ctx := errgroup.WithContext(ctx)
225-
errGroup.SetLimit(b.concurrency)
225+
errGroup.SetLimit((b.concurrency + 1) / 2)
226226

227227
results := make([][]string, len(b.shard.LabelsFile().RowGroups()))
228228

@@ -262,7 +262,7 @@ func (b queryableShard) LabelValues(ctx context.Context, name string, limit int6
262262
}
263263

264264
errGroup, ctx := errgroup.WithContext(ctx)
265-
errGroup.SetLimit(b.concurrency)
265+
errGroup.SetLimit((b.concurrency + 1) / 2)
266266

267267
results := make([][]string, len(b.shard.LabelsFile().RowGroups()))
268268

@@ -298,7 +298,7 @@ func (b queryableShard) LabelValues(ctx context.Context, name string, limit int6
298298

299299
func (b queryableShard) allLabelValues(ctx context.Context, name string, limit int64) ([]string, error) {
300300
errGroup, ctx := errgroup.WithContext(ctx)
301-
errGroup.SetLimit(b.concurrency)
301+
errGroup.SetLimit((b.concurrency + 1) / 2)
302302

303303
results := make([][]string, len(b.shard.LabelsFile().RowGroups()))
304304

vendor/github.com/prometheus-community/parquet-common/search/materialize.go

Lines changed: 11 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/modules.txt

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)