Skip to content

Conversation

jiekun
Copy link
Member

@jiekun jiekun commented Oct 6, 2025

Describe Your Changes

For cluster mode, distribute data by trace ID instead of full random.

This feature will make the spans of the same trace go to the same vtstorage instance.

goos: darwin
goarch: arm64
pkg: github.com/VictoriaMetrics/VictoriaTraces/app/vtstorage/netinsert
cpu: Apple M1 Pro
BenchmarkGetNodeIdx
BenchmarkGetNodeIdx-8      	12863986	        93.03 ns/op	       0 B/op	       0 allocs/op
BenchmarkGetNodeIdxBak
BenchmarkGetNodeIdxBak-8   	11386562	       106.3 ns/op	       0 B/op	       0 allocs/op

Checklist

The following checks are mandatory:

// dependency between the order of the ingested logs and the number of storage nodes,
// which may lead to non-uniform distribution of logs among storage nodes.
return uint64(fastrand.Uint32n(uint32(srt.nodesCount)))
return xxhash.Sum64String(traceID) % uint64(srt.nodesCount)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider nodesCount increase when scaling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant