Optimizing ATS
Purpose
Modify the ATS configuration file to improve the ATS service performance.
Procedure
- 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.
1numactl --cpunodebind=0,1 -m 0,1 trafficserver start
In the command, 0 and 1 indicate that numa0 and numa1 are used.
- 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
- 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.
- Modify the configuration to use all disks and allocate a balanced usage ratio to each drive.
- Modify the storage.config file.
- Open the file.
1vim storage.config - 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
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the file.
- Modify the hosting.config file.
- Open the hosting.config file.
1vim hosting.config - Press i to enter the insert mode and edit the file as follows:
hostname=* volume=1,2,3,4,5,6,7,8,9
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the hosting.config file.
- Modify the volume.config file.
- Open the volume.config file.
1vim volume.config - 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%
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the volume.config file.
- Modify the storage.config file.
Parent topic: Application Tuning