How to properly calculate maximum_table_memory maximum_memory?

Hi,

I have a question to properly setup memory using.

For example. If I have 100G RAM on server and set:
maximum_memory = 90G
maximum_table_memory = 80G

Does this mean that total memory usage could be 170G or 90G?

Hey,

When configuring maximum_memory and maximum_table_memory in SingleStore, it’s important to understand that these settings control how memory is allocated and used within the SingleStore system. The maximum_memory setting specifies the maximum amount of memory that SingleStore can use, while maximum_table_memory specifies the maximum amount of memory that can be used for storing tables. These settings do not add up to allocate more memory than the limit set by maximum_memory.

Given your example, if you have a server with 100G RAM and you set maximum_memory to 90G and maximum_table_memory to 80G, the total memory usage by SingleStore will not exceed 90G. The maximum_table_memory is a subset of maximum_memory and determines how much of that total memory can be used for table storage. It does not allow for memory usage beyond the maximum_memory limit. In essence, your setup ensures that out of the 90G allocated to SingleStore, up to 80G can be used for table storage.

Therefore, the correct understanding is that the total memory usage would be up to 90G, not 170G. The values for maximum_memory and maximum_table_memory are designed to manage and optimize the memory usage within the limits of the server’s total memory, ensuring that SingleStore operates efficiently without exceeding the resources available on the server . Some further reading. List of Engine Variables · SingleStore Documentation.

Hi!

@mmcelhinney, thank you for the detailed answer.

Could you answer an additional question, please?

If I have four servers with 100Gb RAM and set maximum_memory = 360G (90% of total RAM of cluster) or should I set 90G because one server has 100G RAM.
I.e. should I calculate using all clusters’ RAM or only server RAM?

Regards,
Rostyslav

Hello,

should I calculate using all clusters’ RAM or only server RAM?

maximum_memory and maximum_table_memory variables are being set on the per-node basis (the config file of each individual database node sets this value). This means that you need to calculate these values using the amount of the physical memory available on the server.
If the server where your leaf node is running on has 100GB of ram, the value of maximum_memory should not exceed 90GB and the value of maximum_table_memory should be around 81GB (90% of the value of the maximum_memory).

1 Like

@rmalenko Marek has already jumped in here , but remember, the maximum_memory setting dictates the upper limit of memory usage for each node, encompassing the memory used for storing tables, query execution, and other purposes within that specific node, just remember this when setting this - for further reading Identifying and Reducing Memory Usage · SingleStore Documentation

@marek @mmcelhinney thank you a lot to clarifying me