我要评分
获取效率
正确性
完整性
易理解

Optimizing ATS

Purpose

Modify the ATS configuration file to improve the ATS service performance.

Procedure

  1. When the ATS is started, use the numactl command to control the CPU and memory used by the ATS to prevent the ATS process from cross-chip and improve the performance.
    1
    numactl --cpunodebind=0,1  -m 0,1 trafficserver start
    

    In the command, 0 and 1 indicate that numa0 and numa1 are used.

  2. Use Cgroup to restrict the resources used by ATS threads. Otherwise, thread cross-chip may occur.
    The numactl command is used to restrict the location and resource usage of the manager process, and Cgroup is used to restrict the location and resource usage of the server process.
    #!/bin/bash
    PID=$(pidof traffic_server)
    ATS_CGROUP_CPU_DIR=/sys/fs/cgroup/cpuset/trafficserver
    if [ ! -d $ATS_CGROUP_CPU_DIR ]; then
    mkdir $ATS_CGROUP_CPU_DIR
    fi
    cd $ATS_CGROUP_CPU_DIR
    echo "0-15" > cpuset.cpus
    echo "0" > cpuset.mems
    echo $PID > cgroup.procs
  3. Optimize the thread options by modifying the records.config file.
    Table 1 describes the thread optimization options in the records.config file.
    Table 1 Description of thread optimization options in records.config

    Option

    Description

    CONFIG proxy.config.exec_thread.autoconfig INT 0

    Fixes the number of threads and disables the function of automatically adding threads. It can be used with Cgroup to prevent threads from cross-chip.

    CONFIG proxy.config.exec_thread.limit INT 16

    Each core starts 16 threads. It is verified that the performance can be optimal.

    CONFIG proxy.config.accept_threads INT 16

    Uses a dedicated thread to receive data.

    CONFIG proxy.config.task_threads INT 32

    Number of threads for processing HTTP requests.

    CONFIG proxy.config.cache.threads_per_disk INT 16

    Number of threads for processing drive I/Os.

  4. Modify the configuration to use all disks and allocate a balanced usage ratio to each drive.
    1. Modify the storage.config file.
      1. Open the file.
        1
        vim storage.config
        
      2. Press i to enter the insert mode and edit the file as follows:
        /dev/sda volume=1
        /dev/sdb volume=2
        /dev/sdd volume=3
        /dev/sde volume=4
        /dev/sdf volume=5
        /dev/sdg volume=6
        /dev/sdh volume=7
        /dev/sdi volume=8
        /dev/sdj volume=9
      3. Press Esc, type :wq!, and press Enter to save the file and exit.
    2. Modify the hosting.config file.
      1. Open the hosting.config file.
        1
        vim hosting.config
        
      2. Press i to enter the insert mode and edit the file as follows:
        hostname=* volume=1,2,3,4,5,6,7,8,9
      3. Press Esc, type :wq!, and press Enter to save the file and exit.
    3. Modify the volume.config file.
      1. Open the volume.config file.
        1
        vim volume.config
        
      2. Press i to enter the insert mode and edit the file as follows:
        volume=1 scheme=http size=11%
        volume=2 scheme=http size=11%
        volume=3 scheme=http size=11%
        volume=4 scheme=http size=11%
        volume=5 scheme=http size=11%
        volume=6 scheme=http size=11%
        volume=7 scheme=http size=11%
        volume=8 scheme=http size=11%
        volume=9 scheme=http size=12%
      3. Press Esc, type :wq!, and press Enter to save the file and exit.