grafana / metrictank

metrics2.0 based, multi-tenant timeseries store for Graphite and friends.
GNU Affero General Public License v3.0
622 stars 105 forks source link

Chunk objects too memory inefficient #140

Closed Dieterbe closed 4 years ago

Dieterbe commented 8 years ago

we wrap go-tsz Series objects with Chunk objects which provide some metadata, see https://github.com/raintank/raintank-metric/blob/master/metric_tank/chunk.go#L11

these account for 7% of memory usage only, so not super urgent, but still worth looking into.

here's what the fields are for:

*tsz.Series // pointer to Series object.
T0        uint32 // unix ts divisble without remainder by chunkSpan (which is usually 600 or a multiple of that)
LastTs    uint32 // TS of last point seen.
NumPoints uint32 // points contained in Series. 
Saved     bool
Saving    bool 
LastWrite uint32 // unix ts of when last point was received

some thoughts:

I wonder what @dgryski thinks of these ideas and maybe he can come up with something better! we also don't want to do too much packing&math, because a bunch of these values are checked very frequently (i.e. at every incoming point for the series), but currently our cpu usage is much lower than our memory usage.

Dieterbe commented 8 years ago

also, since we're only ever writing to the latest chunk, some of the variables could be tracked in the AggMetric object instead of for each single chunk. I'm thinking of LastWrite and and LastTs

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.