Skip to content

func (i *Ingester) Push has some performance issues #4915

Closed
@t00350320

Description

@t00350320

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:
image

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:

  1. Start Cortex (SHA or version)
  2. Perform Operations(Write/Others)

16C128G*3, tartget=all,
write ops : 15M series / 30s

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions