-
Notifications
You must be signed in to change notification settings - Fork 10.2k
Description
Currently a shard allocates a buffer of prompb.TimeSeries, which is extended to be slightly longer than maxSamplesPerSend if sending of exemplars is enabled. We also allocate buffers of prompb.Sample and prompb.Exemplar, which are used to actually store the data of a sample or exemplar. The prompb.TimeSeries buffer then just references elements in the other two buffers before generating the actual WriteRequest. This saves us some allocations.
However, even though the the prompb.TimeSeries buffer can hold maxSamplesPerSend*1.1 promob.TimeSeries, we only check if we have maxSamplesPerSend OR maxExemplars before building a write request. The maxSamplesPerSend defaults to 100 and maxExemplars is set to int(math.Max(1, float64(maxSamplesPerSend/10))), or 10 in the case of default config. This means the worst case scenario is that we could end up sending write requests that only have 10 samples and 10 exemplars, potentially impacting throughput.
We should investigate a way to buffer a reasonable amount of data points, regardless of type, and not having a max of one kind lead to reduced throughput.