Rate This Document
Findability
Accuracy
Completeness
Readability

Modifying Cache Parameters

Purpose

Modify some cache parameter settings at the operating system layer to improve server performance.

Procedure

Modify the parameters based on the following table.

Table 1 Cache parameters

Linux Parameter

Description

Operation

swappiness

Policy of using the swap partition and memory. A larger value indicates more active use of the swap partition, and a smaller value indicates more active use of the memory.

Set vm.swappiness to a small value 1 to reduce the swap partition usage.

  1. Open the file.
    1
    vim /etc/sysctl.conf
    
  2. Press i to enter the insert mode and add the following information to the end of the file:
    1
    vm.swappiness = 1
    
  3. Press Esc, type :wq!, and press Enter to save the file and exit.
  4. Make the modification take effect.
    1
    sysctl -p
    

dirty_ratio

Percentage of dirty data allowed in the memory

Set dirty_ratio to 5.

1
echo 5 > /proc/sys/vm/dirty_ratio