Outdated Version

You are viewing an older version of this section. View current production version.


Optimize settings.


Optimize settings

  memsqlctl optimize [flags]

  -h, --help                    Help for optimize
      --memory-percentage INT   The percentage of memory on each host to use for MemSQL
      --no-numa                 Do not change NUMA settings on any MemSQL nodes

Global Flags:
  -c, --config FILE_PATH                     Path to the memsqctl config file
      --default-install-dir DIRECTORY_PATH   Path to the default install directory
  -j, --json                                 Print output in JSON format
      --node-metadata-file FILE_PATH         Path to the node metadata file
      --parallelism POSITIVE_INTEGER         Maximum amount of operations to be run in parallel
      --ssl-ca FILE_PATH                     Path to the CA certificate file in PEM format to authenticate the MemSQL server certificate
      --timeout duration                     Maximum time for operation to complete (e.g., 30s, 10m, 1.5h)
  -v, --verbosity count                      Increase logging verbosity
  -y, --yes                                  Enable non-interactive mode and assume the user would like to move forward with the proposed actions by default


The optimize command will make or recommend the following best practices:

  • Sets the maximum_memory value to either 90% of the total RAM available to a leaf or the total RAM available to the leaf minus 10 GB, whichever is greater
  • If there are multiple leaf nodes on the current machine, memory allocation will be split evenly between the leaf nodes:
    • If --memory-percentage is not specified, then memory allocation is 90% of the host machines physical memory which is evenly split between all leaves on the current host
    • If you specify --memory-percentage that is the memory allocation, and the value is split between all local leaves
  • Queries for the NUMA node count on the host machine. If numactl is installed on the host machine, optimize will set up NUMA binding based on the number of NUMA nodes on the machine and the number of leaf nodes created.
  • Recommends that you install new leaves if the number of leaves is less than what is recommended by the NUMA configuration.
  • Sets the default number of partitions on each leaf to be the number of vCPUs on the host machine divided by the number of leaf nodes on that host machine. For example, a leaf node on a host machine that has four vCPUs would get its default partition number set to 4, while two leaf nodes on a host machine with four vCPUs would have the default partition number set to 2 on each leaf node.

This command is interactive unless you use either the --yes or --json flags to override interactive behavior.

The memsqlctl optimize command is equivalent to the memsql-admin optimize command.


The following example shows how to use optimize to increase memory size on a leaf node to align with deployment best practices.

$ sudo memsqlctl optimize
Warning: The maximum memory per node, 7184 MB, is less than MemSQL's minimum recommendation of 7372 MB per node.
memsqlctl will perform the following actions:
  · On leaf node with MemSQL ID 7DE9330A9F374C580C9857C851CE3A8380DA2FFC on port 3307
    - Set maximum_memory to 7184 MB

Would you like to continue? [y/N]: y
✓ Updated MemSQL config file with setting 'maximum_memory = 7184' for node with MemSQL ID 7DE9330A9F374C580C9857C851CE3A8380DA2FFC
✓ Executed 'SET GLOBAL maximum_memory=7184' command on node with MemSQL ID 7DE9330A9F374C580C9857C851CE3A8380DA2FFC