Change Memory Limits
On this page
Note
If you increase the amount of memory available to SingleStore, you must also ensure that your license covers the new amount Refer to Determining capacity and usage for your license for more information.
Overview
The maximum_memsql. file of each node.
If Toolbox is used to optimize for NUMA, then these values are not automatically updated when a host's memory capacity changes.maximum_ in the memsql. file and, if memory is later added to the host, the memsqld process will not pick it up.
If Toolbox is not used to optimize for NUMA, the database engine sets the value of maximum_, which is based on the amount of memory at the time the memsqld process is started.memsqld process will pick it up when it's restarted.
In some cases, you may wish to change the memory limit for each node after deploying SingleStore.
-
Decrease the
maximum_value before decreasing thetable_ memory maximum_value.memory If
maximum_is set to a value belowmemory maximum_, the value oftable_ memory maximum_is automatically decreased as well, to the extent possible.table_ memory If Alloc_ table_ memory (viewable via SHOW STATUS EXTENDED LIKE 'Alloc_is sufficiently high, thentable_ memory';) maximum_may be set to an atypically higher value than 90% oftable_ memory maximum_, which is the default.memory -
When decreasing the
maximum_value, ensure that the value of the Alloc_table_ memory table_ memory summary variable does not exceed the new maximum_value.table_ memory If attempted, an error will occur and the value will not be set. -
By default,
maximum_is set to 90% of the physical memory on the host, or physical memory minus 10GB, whichever value is greater.memory SingleStore does not recommend exceeding either of these two limits when setting the maximum_value.memory -
When decreasing the
maximum_value, ensure that the value of the Total_memory server_ memory summary variable (also viewable via SHOW STATUS EXTENDED LIKE 'Total_) does not exceed the newserver_ memory'; maximum_value.memory If attempted, an error will occur and the value will not be set. -
Do not set the
maximum_value less than 1GB.memory
SingleStore recommends that each leaf node is allocated an equal amount of CPU and RAM.
Example
The following example illustrates how to update the values of the maximum_ and maximum_ variables after adding memory to an 8 GB (8192 MB) virtual machine, or “host,” with an instance of SingleStore non-Docker cluster-in-a-box, which consists of one Master Aggregator node and one leaf node.
Note that you must restart the affected nodes after increasing or decreasing these values.
-
Use the following command to obtain the node IDs from the
MEMSQL_column.ID sdb-admin list-nodes -
You can view the current
maximum_andtable_ memory maximum_values of each node by running the following Toolbox commands.memory Master Aggregator
sdb-admin describe-node --property Variables.maximum_table_memory --memsql-id <Master_Aggregator_MEMSQL_ID>6014sdb-admin describe-node --property Variables.maximum_memory --memsql-id <Master_Aggregator_MEMSQL_ID>7038Leaf Node
sdb-admin describe-node --property Variables.maximum_table_memory --memsql-id <leaf_node_MEMSQL_ID>6014sdb-admin describe-node --property Variables.maximum_memory --memsql-id <leaf_node_MEMSQL_ID>7038 -
If you later add an additional 2 GB (2048 MB) of RAM to this host, run the following command to update the memory limits and optimize other related settings.
sdb-admin optimizeThis command will automatically reset these memory limits based on the host's memory capacity, and new values will be reflected for both
maximum_andtable_ memory maximum_.memory Master Aggregator
sdb-admin describe-node --property Variables.maximum_table_memory --memsql-id <Master_Aggregator_MEMSQL_ID>7829sdb-admin describe-node --property Variables.maximum_memory --memsql-id <Master_Aggregator_MEMSQL_ID>8853Leaf Node
sdb-admin describe-node --property Variables.maximum_table_memory --memsql-id <leaf_node_MEMSQL_ID>7829sdb-admin describe-node --property Variables.maximum_memory --memsql-id <leaf_node_MEMSQL_ID>8853 -
To pin the Master Aggregator and leaf node's
maximum_at 8 GB (8192 MB), which will allow other applications to use the remaining memory, run the following commands.memory -
First, decrease the
maximum_value:table_ memory Master Aggregator
sdb-admin update-config --key maximum_table_memory --value 7209 --memsql-id <Master_Aggregator_MEMSQL_ID>Leaf Node
sdb-admin update-config --key maximum_table_memory --value 7209 --memsql-id <leaf_node_MEMSQL_ID> -
Next, decrease the
maximum_value:memory Master Aggregator
sdb-admin update-config --key maximum_memory --value 8192 --memsql-id <Master_Aggregator_MEMSQL_ID>Leaf Node
sdb-admin update-config --key maximum_memory --value 8192 --memsql-id <leaf_node_MEMSQL_ID>
-
-
Restart the cluster.
sdb-admin restart-node --all
View Variable Values
You can confirm that the nodes reflect these new values via a variety of methods.
Query the Information Schema
USE information_schemaSELECT * FROM mv_nodes;
+----+-----------+------+------+---------------+---------------------+
| ID | IP_ADDR | PORT | TYPE | MAX_MEMORY_MB | MAX_TABLE_MEMORY_MB |
+----+-----------+------+------+---------------+---------------------+
| 2 | 127.0.0.1 | 3307 | LEAF | 8192 | 7209 |
| 1 | 127.0.0.1 | 3306 | MA | 8192 | 7209 |
+----+-----------+------+------+---------------+---------------------+Note: Columns have been removed to highlight the max_
Query the Variables
SELECT @@global.maximum_table_memory;
+-------------------------------+
| @@global.maximum_table_memory |
+-------------------------------+
| 7209 |
+-------------------------------+SELECT @@global.maximum_memory;
+-------------------------+
| @@global.maximum_memory |
+-------------------------+
| 8192 |
+-------------------------+Use Toolbox
Master Aggregator
sdb-admin describe-node --property Variables.maximum_table_memory --memsql-id <Master_Aggregator_MEMSQL_ID>
7209sdb-admin describe-node --property Variables.maximum_memory --memsql-id <Master_Aggregator_MEMSQL_ID>
8192Leaf Node
sdb-admin describe-node --property Variables.maximum_table_memory --memsql-id <leaf_node_MEMSQL_ID>
7209sdb-admin describe-node --property Variables.maximum_memory --memsql-id <leaf_node_MEMSQL_ID>
8192View the memsql. cnf File
Note
Node configuration folders typically reside in /var/lib/memsql/.
As the node subfolder names are GUIDs, you can determine which subfolder corresponds to which node by viewing the port number in the memsql.
Refer memsql.
Master Aggregator
cat /var/lib/memsql/<Master_Aggregator_MEMSQL_ID>/memsql.cnf | grep maximum_table_memory
maximum_table_memory = 7209cat /var/lib/memsql/<Master_Aggregator_MEMSQL_ID>/memsql.cnf | grep maximum_memory
maximum_memory = 8192Leaf Node
cat /var/lib/memsql/<leaf_node_MEMSQL_ID>/memsql.cnf | grep maximum_table_memory
maximum_table_memory = 7209cat /var/lib/memsql/<leaf_node_MEMSQL_ID>/memsql.cnf | grep maximum_memory
maximum_memory = 8192Related Resources
-
Deploy a SingleStore cluster-in-a-box for testing and development
-
Learn more about the memsql.
cnf file -
Learn more about updating the
maximum_variable to address the “Maximum Table Memory” errortable_ memory
Last modified: March 8, 2024