Long-Term Supported Versions

    Innovation Versions

      Memory Management

      Basic Concepts

      The memory is an important component of a computer, and is used to temporarily store operation data in the CPU and data exchanged with an external memory such as hardware. In particular, a non-uniform memory access architecture (NUMA) is a memory architecture designed for a multiprocessor computer. The memory access time depends on the location of the memory relative to the processor. In NUMA mode, a processor accesses the local memory faster than the non-local memory (the memory is located in another processor or shared between processors).

      Viewing Memory

      1. free: displays the system memory status. Example:

        # Display the system memory status in MB.
        free -m
        

        The output is as follows:

        [root@openEuler ~]# free -m
                    total        used        free      shared  buff/cache   available
        Mem:            2633         436         324          23        2072        2196
        Swap:           4043           0        4043
        

        The fields in the command output are described as follows:

        FieldDescription
        totalTotal memory size.
        usedUsed memory.
        freeFree memory.
        sharedTotal memory shared by multiple processes.
        buff/cacheTotal number of buffers and caches.
        availableEstimated available memory to start a new application without swapping.
      2. vmstat: dynamically monitors the system memory and views the system memory usage.

        Example:

        # Monitor the system memory and display active and inactive memory.
        vmstat -a
        

        The output is as follows:

        [root@openEuler ~]# vmstat -a
        procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
        r  b   swpd   free  inact active   si   so    bi    bo   in   cs us sy id wa st
        2  0    520 331980 1584728 470332    0    0     0     2   15   19  0  0 100  0  0
        

        In the command output, the field related to the memory is described as follows:

        FieldDescription
        memoryMemory information.
        -swpd: usage of the virtual memory, in KB.
        -free: free memory capacity, in KB.
        -inact: inactive memory capacity, in KB.
        -active: active memory capacity, in KB.
      3. sar: monitors the memory usage of the system.

        Example:

        # Monitor the memory usage in the sampling period in the system. Collect the statistics every two seconds for three times.
        sar -r 2 3
        

        The output is as follows:

        [root@openEuler ~]# sar -r 2 3
        
        04:02:09 PM kbmemfree   kbavail kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit  kbactive   kbinact   kb
        dirty
        04:02:11 PM    332180   2249308    189420      7.02    142172   1764312    787948     11.52    470404   1584924     
        36
        04:02:13 PM    332148   2249276    189452      7.03    142172   1764312    787948     11.52    470404   1584924     
        36
        04:02:15 PM    332148   2249276    189452      7.03    142172   1764312    787948     11.52    470404   1584924     
        36
        Average:       332159   2249287    189441      7.03    142172   1764312    787948     11.52    470404   1584924     
        36
        

        The fields in the command output are described as follows:

        FieldDescription
        kbmemfreeUnused memory space.
        kbmemusedUsed memory space.
        %memusedPercentage of the used space.
        kbbuffersAmount of data stored in the buffer.
        kbcachedData access volume in all domains of the system.
      4. numactl: displays the NUMA node configuration and status.

        Example:

        # Check the current NUMA configuration.
        numactl -H
        

        The output is as follows:

        [root@openEuler ~]# numactl -H
        available: 1 nodes (0)
        node 0 cpus: 0 1 2 3
        node 0 size: 2633 MB
        node 0 free: 322 MB
        node distances:
        node   0 
        0:  10 
        

        The server contains one NUMA node. The NUMA node that contains four cores and 6 GB memory. The command also displays the distance between NUMA nodes. The further the distance, the higher the latency of cross-node memory accesses, which should be avoided as much as possible.

        numstat: displays NUMA node status.

        # Check the NUMA node status.
        numastat
        
        [root@openEuler ~]# numastat
                                node0
        numa_hit                 5386186
        numa_miss                      0
        numa_foreign                   0
        interleave_hit             17483
        local_node               5386186
        other_node                     0 
        

        The the fields in the command output and their meanings are as follows:

        FieldDescription
        numa_hitNumber of times that the CPU core accesses the local memory on a node.
        numa_missNumber of times that the core of a node accesses the memory of other nodes.
        numa_foreignNumber of pages that were allocated to the local node but moved to other nodes. Each numa_foreign corresponds to a numa_miss event.
        interleave_hitNumber of pages of the interleave policy that are allocated to this node.
        local_nodeSize of memory that was allocated to this node by processes on this node.
        other_nodeSize of memory that was allocated to other nodes by processes on this node.

      Bug Catching

      Buggy Content

      Bug Description

      Submit As Issue

      It's a little complicated....

      I'd like to ask someone.

      PR

      Just a small problem.

      I can fix it online!

      Bug Type
      Specifications and Common Mistakes

      ● Misspellings or punctuation mistakes;

      ● Incorrect links, empty cells, or wrong formats;

      ● Chinese characters in English context;

      ● Minor inconsistencies between the UI and descriptions;

      ● Low writing fluency that does not affect understanding;

      ● Incorrect version numbers, including software package names and version numbers on the UI.

      Usability

      ● Incorrect or missing key steps;

      ● Missing prerequisites or precautions;

      ● Ambiguous figures, tables, or texts;

      ● Unclear logic, such as missing classifications, items, and steps.

      Correctness

      ● Technical principles, function descriptions, or specifications inconsistent with those of the software;

      ● Incorrect schematic or architecture diagrams;

      ● Incorrect commands or command parameters;

      ● Incorrect code;

      ● Commands inconsistent with the functions;

      ● Wrong screenshots.

      Risk Warnings

      ● Lack of risk warnings for operations that may damage the system or important data.

      Content Compliance

      ● Contents that may violate applicable laws and regulations or geo-cultural context-sensitive words and expressions;

      ● Copyright infringement.

      How satisfied are you with this document

      Not satisfied at all
      Very satisfied
      Submit
      Click to create an issue. An issue template will be automatically generated based on your feedback.
      Bug Catching
      编组 3备份