Consul Memory Needed

Hey, can someone tell me how to read this :
RAM NEEDED = number of keys * average key size * 2-3x

Source : Server Performance | Consul by HashiCorp

Thanks

Hi @lando.windigo,

That formula is intended to produce a ranged estimate for the amount of memory needed for KV storage. The “* 2-3x” at the end is what makes it a range.

This could also be expressed as the estimate ranging:

  • Between: [Number of keys] * [Avg. key size] * 2
  • And: [Number of keys] * [Avg. key size] * 3

If we say: [Number of keys] * [Avg. key size] = KV_Raw_Size

Then the range estimate can be expressed as:

  • Between: KV_Raw_Size * 2
  • And: KV_Raw_Size * 3

Here is an example that should help.

If you have…
[Nuber of Keys] = 1,000
[Average Key Size] = 2KB

Then… KV_Raw_Size = (1,000 * 2KB) = 2,000KB

Which means the range estimate expressed as:

  • Between: KV_Raw_Size * 2
  • And: KV_Raw_Size * 3

Resolves to:

  • Between: 2,000KB * 2
  • And: 2,000KB * 3

Which Resolves to the final numbers of:

  • Between: 4,000KB
  • And: 6,000KB

The two sentences below are equivalent ways of stating the results of this example:

  • Then the estimated amount of memory is between (1,000 * 2KB * 2) and (1,000 * 2KB * 3).
  • Then the estimated amount of memory is between 4,000KB and 6,000KB.

Sorry for the long winded response. :grinning:

Regards,
Jeff

1 Like

Thank you Jeff for the detailed answer :slightly_smiling_face: