'When I use the MOT feature of the openGauss database,how can I manually release the numa_node node?

When I use the MOT feature of the openGauss database, the numa_node node is full and is not released for a long time. How can I manually release it? Is there any quick method?



Solution 1:[1]

The question is interesting and though there is a short answer it requires an explanation.

Short answer:

  1. Manually close/kill sessions may free up MOT Local memory, in case there were large transactions or large inserts or updates (though usually sessions have quite small memory). The majority of MOT memory, which is the MOT Global memory – will not be affected.
  2. A Vacuum command can help: VACUUM FULL [MOT_table1]; This is useful only when MOT table sizes are significantly reduced (possibly periodically) and are not expected to grow to their original size in the near future.
  3. Server restart

Explanation: openGauss MOT has a highly optimized memory management, welcome to read here about its NUMA awareness allocation and affinity and about MOT Memory Planning.

Firstly, to facilitate quick operation and make efficient use of NUMA nodes, MOT allocates a designated memory pool for rows per table and for nodes per index. Each such pool is composed of 2 MB chucks. A designated API allocates these chunks from a local NUMA node, from pages coming from all nodes or in a round-robin fashion, where each chunk is allocated on the next node. By default, pools of shared data are allocated in a round robin fashion in order to balance access, while not splitting rows between different NUMA nodes. However, thread private memory is allocated from a local node. It must also be verified that a thread always operates in the same NUMA node.

Secondly, MOT design expects data growth, thus once a memory chunk was added to the memory pool and used (insert of data) then at delete of rows will mark internally memory sections as the free and ready for re-use, and are not released back to the operating system.

A manually activated VACUUM command can optimize rows distribution within and across memory chunks, move them into densely populated, and free the remaining memory chunks to the OS.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Vladi V