LTS

    Innovation Version

      System Resources and Performance

      CPU

      Basic Concepts

      A central processing unit (CPU) is one of main devices of a computer, and a function of the CPU is to interpret computer instructions and process data in computer software.

      1. Physical core: an actual CPU core that can be seen. It has independent circuit components and L1 and L2 caches and can independently execute instructions. A CPU can have multiple physical cores.
      2. Logical core: a core that exists at the logical layer in the same physical core. Generally, a physical core corresponds to a thread. However, if hyper-threading is enabled and the number of hyper-threads is n, a physical core can be divided into n logical cores. You can run the lscpu command to check the number of CPUs on the server, the number of physical cores in each CPU, and the number of logical cores in each CPU.

      Demarcation and Locating

      Common CPU Performance Analysis Tools

      1. uptime: prints the average system load. The last three numbers indicate the average load within the last one, five, and fifteen minutes. If the average load is greater than the number of CPUs, the CPUs are insufficient to serve threads and some threads are waiting. If the average load is less than the number of CPUs, there are remaining CPUs.

        en-us_image_0000001384808269

      2. vmstat: dynamically monitors the usage of system resources and checks which phase occupies the most system resources. You can run the vmstat -h command to view command parameters. Example:

        # Monitor the status and update the status every second.
        vmstat 1
        

        The fields in the command output are described as follows:

        FieldDescription
        procsProcess information.
        memoryMemory information.
        swapSwap partition information.
        ioDrive read/write information.
        systemSystem information.
        cpuCPU information.
        -us: percentage of the CPU computing time consumed by non-kernel processes.
        -sy: percentage of the CPU computing time consumed by kernel processes.
        -id: idle.
        -wa: percentage of CPU resources consumed by waiting for I/Os.
        -st: percentage of CPUs stolen by VMs.
      3. sar: analyzes system performance, observes current activities and configurations, and archives and reports historical statistics. Example:

        # Check the overall CPU load of the system. Collect the statistics every 3 seconds for five times.
        sar -u 3 5
        

        en-us_image_0000001336448570

        The fields in the command output are described as follows:

        FieldDescription
        %userPercentage of the CPU time consumed in user mode.
        %nicePercentage of the CPU time consumed by a process whose scheduling priority is changed through nice in user mode.
        %systemPercentage of the CPU time consumed in system mode.
        %iowaitPercentage of the time consumed by the CPU to wait for drive I/Os in idle state.
        %stealPercentage of the time used for waiting for other virtual CPU computing by using virtualization technologies of the OS.
        %idlePercentage of CPU idle time.
      4. ps: displays running processes.

        # View all processes in the system, and view the PIDs and priorities of the their parent processes.
        ps -le
        

        en-us_image_0000001337039920

        # View the processes generated by the current shell.
        ps -l
        

        en-us_image_0000001385611905

      5. top: dynamically and continuously monitors the running status of processes and displays the processes that consume the most CPU resources.

        top
        

        en-us_image_0000001335457246

      Memory

      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).

      Demarcation and Locating

      Common Memory Analysis Tools and Methods

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

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

        en-us_image_0000001386699925

        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
        

        en-us_image_0000001388972645

        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
        

        en-us_image_0000001335816300

        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
        

        en-us_image_0000001337000118

        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
        

        en-us_image_0000001337172594

        The fields in the numastat command output are described 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.

      I/O

      Basic Concepts

      I/O indicates input/output. Input refers to the operation of receiving signals or data by the system, and output refers to the operation of sending signals or data from the system. For a combination of CPU and main memory, any information incoming to or outgoing from the CPU/memory combination is considered as I/Os.

      Demarcation and Locating

      Common I/O Performance Analysis Tools

      1. iostat: reports statistics about all online drives.

        Example:

        # Display the drive information in KB. Collect the statistics every 100 seconds until you press Ctrl+C.
        iostat -d -k -x 100
        # Display the drive information in KB. Collect the statistics every second and for 100 seconds.
        iostat -d -k -x 1 100
        

        en-us_image_0000001385905845

        The fields in the command output are described as follows:

        FieldDescription
        DeviceName of the monitoring device.
        r/sNumber of read requests completed by the device per second (after combination).
        rKB/sNumber of KBs read from the drive per second.
        rrqm/sNumber of read operations merged into the request queue per second.
        %rrqmPercentage of read requests merged before they are sent to the device.
        r_awaitAverage time consumed by each read request.
        rareq-szAverage size of read requests sent to the device, in KB.
        w/sNumber of write requests completed by the device per second (after combination).
        wKB/sNumber of KBs written to the drive per second.
        wrqm/sNumber of write operations merged into the request queue per second.
        %wrqmPercentage of write requests merged before they are sent to the device.
        w_awaitAverage time consumed by each write request.
        wareq-szAverage size of write requests sent to the device, in KB.
        d/sNumber of discard requests processed by the device per second.
        dKB/sNumber of sectors (KB) discarded by the device per second.
        drqm/sNumber of discard requests merged into the device queue per second.
        %drqmPercentage of discard requests merged before they are sent to the device.
        d_awaitAverage time for sending discard requests to the device to be served.
        dareq-szAverage size of discard requests sent to the device, in KB.
        f/sNumber of refresh requests completed by the device per second (after combination).
        f_awaitAverage time for sending refresh requests to the device to be served.
        aqu-szAverage queue length of requests sent to the device.
        %utilPercentage of the I/O operation time, that is, the usage.
      2. sar: displays the read and write performance of the system drive.

        Example:

        # Display the usage status of all hard drives in the system in the sampling period. Collect the statistics every 3 seconds for five times.
        sar -d 3 5
        

        en-us_image_0000001386149037

        The fields in the command output are described as follows:

        FieldDescription
        tpsTotal number of transfers sent to the physical device per second.
        rKB/sNumber of KBs read from the device per second.
        wKB/sNumber of KBs written to the device per second.
        dKB/sNumber of KBs discarded by the device per second.
        areq-szAverage size (KB) of I/O requests sent to the device.
        aqu-szAverage queue length of requests sent to the device.
        awaitAverage time for sending I/O requests to the device to be served.
        %utilPercentage of the time used to send I/O requests to the device (bandwidth usage of the device).
      3. vmstat

        # Run the vmstat command to monitor and report drive statistics.
        vmstat -d
        

        en-us_image_0000001389098425

        The fields in the command output are described as follows:

        FieldDescription
        reads-total: total number of reads that have been successfully completed.
        -merged: number of merged reads (resulting in one I/O).
        -sectors: sectors from which data is successfully read.
        -ms: number of milliseconds spent on reading data.
        writes-total: total number of writes that have been successfully completed.
        -merged: merged writes (resulting in one I/O).
        -sectors: sectors to which data is successfully written.
        -ms: number of milliseconds spent on writing data.
        IODrive read/write information.
        -bi: total amount of data read from the block device, in blocks.
        -bo: total amount of data written to the block device, in blocks.

      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备份