ideawu / ssdb

SSDB - A fast NoSQL database, an alternative to Redis
http://ssdb.io/
BSD 3-Clause "New" or "Revised" License
8.19k stars 1.4k forks source link

Memory Usage documentation formula doubt #1423

Open adriangibanelbtactic opened 1 year ago

adriangibanelbtactic commented 1 year ago

At SSDB Configuration documentation it says:

Memory Usage A ssdb-server may temporarily(only last for short time) consume up to this many memory(in MB):

cache_size + write_buffer_size * 66 + 32 This is for compression is set to no, if compression is set to yes, it would be:

cache_size + 10 write_buffer_size 66 + 32 You can tune the configuration to limit the memory usage of a ssdb-server instance.

It also says:

Users reported that with default configuration, the memory usage is about 1GB, you can refer to this.

If you use standard maths, default settings (cache_size=500, write_buffer_size=64) and suggested units (MB) you get some huge results.

cache_size + 10 * write_buffer_size * 66 + 32 = 
cache_size + (10 * write_buffer_size * 66) + 32 = 
500 + (10 * 64 * 66) + 32 = 
500 + 42240 + 32 =
42772 MB =
42 GB

So... the formula says that you need 42 GB RAM as a maximum but the documentation says that default settings at tailored to a 1 GB RAM machine.

Could you please clarify on the formula?

I also recommend you to add parenthesis to the formula so that it's easier to understand.

Thank you for your feedback.

Annex: Calculations using the formula aimed at compression being turned off are also a bit off.

cache_size + write_buffer_size * 66 + 32 = 
cache_size + (write_buffer_size * 66) + 32 = 
500 + (4224) + 32 = 
500 + 4224 + 32 =
4756 MB =
4.7 GB