Skip to content

Update shard memory usage after increase of default values#1810

Merged
csmarchbanks merged 1 commit intoprometheus:masterfrom
simonswine:increase-mem-per-shar-after-increase-of-defaults
Dec 9, 2020
Merged

Update shard memory usage after increase of default values#1810
csmarchbanks merged 1 commit intoprometheus:masterfrom
simonswine:increase-mem-per-shar-after-increase-of-defaults

Conversation

@simonswine
Copy link
Copy Markdown
Contributor

prometheus/prometheus#5267 increased the defaults by 5 times for both max_samples_per_send and capacity.

I think this value needs to be increased, too. Not too sure how realistic is 5 times and how to get to the < 100kb in the first place.

@csmarchbanks @bboreham

prometheus/prometheus#5267 increase the defaults
by 5 times

Signed-off-by: Christian Simon <[email protected]>
Copy link
Copy Markdown
Member

@csmarchbanks csmarchbanks left a comment

Choose a reason for hiding this comment

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

Thanks!

In case you are curious about the math: it takes 40 bytes to store a sample, 8 bytes for each of the timestamp and the value, and 24 bytes for the slice header (the underlying data is reused across many samples). So 40 bytes per sample * 2500 samples per shard =~ 100KB per shard. I think we then put some room for growth in case other things (say another 8 bytes for a ref) show up.

If you think that math is not including something I am happy to correct it.

@csmarchbanks csmarchbanks merged commit be5550b into prometheus:master Dec 9, 2020
@simonswine
Copy link
Copy Markdown
Contributor Author

Thanks @csmarchbanks for sharing the math. Makes a lot of sense. I thought it would use a hash instead of the slice header (My mistake: I did not look in the code before this PR).

I think on the basis of your math, you shouldn't have merged my PR or where is the factor of five coming from if 500kB is correct?.

I purely updated the value from 100kB to 500kb on the basis of the old config values have changed in the prometheus PR after that document was written

@csmarchbanks
Copy link
Copy Markdown
Member

I figured <500kB is still correct even if the real number is lower :). I forgot to include in my own math above the additional overhead per shard for things like the compression buffers, pending sample slice (which is in protobuf form and copies all the label values), etc that would bring it above 100kB right now. I should probably pull up an actual heap profile sometime but in the meantime 500kB seems reasonable.

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.

2 participants