Skip to content

Commit

Permalink
Backport: Add string interning to SyncIterator (grafana#3411)
Browse files Browse the repository at this point in the history
  • Loading branch information
stoewer committed Apr 16, 2024
1 parent c89e606 commit 9b81152
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
7 changes: 6 additions & 1 deletion tempodb/encoding/vparquet4/block_search.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,12 @@ func makeIterFunc(ctx context.Context, rgs []parquet.RowGroup, pf *parquet.File)
return pq.NewColumnIterator(ctx, rgs, index, name, 1000, predicate, selectAs)
}

return pq.NewSyncIterator(ctx, rgs, index, name, 1000, predicate, selectAs)
var opts []pq.SyncIteratorOpt
if name != columnPathSpanID && name != columnPathTraceID {
opts = append(opts, pq.SyncIteratorOptIntern())
}

return pq.NewSyncIterator(ctx, rgs, index, name, 1000, predicate, selectAs, opts...)
}
}

Expand Down
16 changes: 9 additions & 7 deletions tempodb/encoding/vparquet4/block_traceql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,12 +610,12 @@ func BenchmarkBackendBlockTraceQL(b *testing.B) {

ctx := context.TODO()
tenantID := "1"
// blockID := uuid.MustParse("00000c2f-8133-4a60-a62a-7748bd146938")
blockID := uuid.MustParse("06ebd383-8d4e-4289-b0e9-cf2197d611d5")
// blockID := uuid.MustParse("06ebd383-8d4e-4289-b0e9-cf2197d611d5")
blockID := uuid.MustParse("0008e57d-069d-4510-a001-b9433b2da08c")

r, _, _, err := local.New(&local.Config{
// Path: path.Join("/home/joe/testblock/"),
Path: path.Join("/Users/marty/src/tmp"),
// Path: path.Join("/Users/marty/src/tmp"),
Path: path.Join("/Users/mapno/workspace/testblock"),
})
require.NoError(b, err)

Expand Down Expand Up @@ -710,7 +710,8 @@ func BenchmarkBackendBlockQueryRange(b *testing.B) {
"{} | rate()",
"{} | rate() by (name)",
"{} | rate() by (resource.service.name)",
"{resource.service.name=`tempo-gateway`} | rate()",
"{} | rate() by (span.http.url)", // High cardinality attribute
"{resource.service.name=`loki-ingester`} | rate()",
"{status=error} | rate()",
}

Expand All @@ -719,8 +720,9 @@ func BenchmarkBackendBlockQueryRange(b *testing.B) {
e = traceql.NewEngine()
opts = common.DefaultSearchOptions()
tenantID = "1"
blockID = uuid.MustParse("06ebd383-8d4e-4289-b0e9-cf2197d611d5")
path = "/Users/marty/src/tmp/"
// blockID = uuid.MustParse("06ebd383-8d4e-4289-b0e9-cf2197d611d5")
blockID = uuid.MustParse("0008e57d-069d-4510-a001-b9433b2da08c")
path = "/Users/marty/src/tmp/"
)

r, _, _, err := local.New(&local.Config{
Expand Down

0 comments on commit 9b81152

Please sign in to comment.