Description
Describe the bug
1、db.activeSeries.UpdateSeries take a second hash operation for one series label in fingerprint(series).
fingerprint(series)
while the first hash is in
ref, copiedLabels := app.GetRef(cortexpb.FromLabelAdaptersToLabels(ts.Labels))
func (a *headAppender) GetRef(lset labels.Labels) (storage.SeriesRef, labels.Labels) {
s := a.head.series.getByHash(lset.Hash(), lset)
In 15M series scenario, two times hash take lots time in Flame Graph like this:
2、sync.Pool is used in
fingerprint(series)
while it's on the contrary in
s := a.head.series.getByHash(lset.Hash(), lset)
3、db.activeSeries.UpdateSeries takes a hard code "stripe size"
const ( numActiveSeriesStripes = 512 )
so, a dynamic configuration like
StripeSize: i.cfg.BlocksStorageConfig.TSDB.StripeSize,
may speed up the active series labels.Equal in
findEntryForSeries
To Reproduce
Steps to reproduce the behavior:
- Start Cortex (SHA or version)
- Perform Operations(Write/Others)
16C128G*3, tartget=all,
write ops : 15M series / 30s