Clear free cache by modifying drop_caches of Proc System
$ Echo 3>/proc/sys/Vm/drop_caches
Drop_caches detailed documentation is as follows:
Writing to this will cause the kernel to drop clean caches, dentries and inodes from memory, causing that memory to become free.
To free pagecache:
* Echo 1>/proc/sys/Vm/drop_caches
To free dentries and inodes:
* Echo 2>/proc/sys/Vm/drop_caches
To free pagecache, dentries and inodes:
* Echo 3>/proc/sys/Vm/drop_caches
As
This is a non-destructive operation, and dirty objects are notfreeable,
The user shoshould run "sync" first in order to make sure allcached
Objects are freed.
This tunable was added in 2.6.16.
After you add the following options to/etc/sysctl. conf, the memory will not continue to increase.
VM. dirty_ratio = 1
VM. dirty_background_ratio = 1
VM. dirty_writeback_centisecs = 2
VM. dirty_expire_centisecs = 3
VM. drop_caches = 3
VM. swappiness = 100
VM. vfs_cache_pressure = 163
VM. overcommit_memory = 2
VM. lowmem_reserve_ratio = 32 32 8
Kern. maxvnodes = 3
The above settings are rough, so that the role of the cache is basically not available. You need to make appropriate adjustments based on the machine's conditions to find the best compromise.
/Proc/sys/Vm/dirty_ratio
This parameter controls the size of the file system write buffer in the file system. The unit is the percentage, indicating the percentage of the system memory, indicating the number of writes to the disk when the write buffer is used to the system memory.
Data. By increasing the size, you can use more system memory for disk write buffering and greatly improve the system write performance. However, when you need continuous and constant write admission, you should reduce the value. Generally, the default value is
10. Set 1 Acceleration Program speed
/Proc/sys/Vm/dirty_background_ratio
This parameter controls the pdflush process of the file system and when to refresh the disk. The Unit is the percentage, indicating the percentage of the system memory, which means when the write buffer is used to the system memory
Wait, pdflush starts to write data to the disk. By increasing the size, you can use more system memory for disk write buffering and greatly improve the system write performance. However, when you need continuous and constant writing,
The value should be reduced. Generally, the default value is 5 at startup.
/Proc/sys/Vm/dirty_writeback_centisecs
This parameter controls the run interval of the kernel's dirty data refresh process pdflush. Unit: 1/100 seconds. The default value is 500, that is, 5 seconds. If your system writes data continuously, it is better to reduce this value. In this way, you can split the peak write operations into multiple write operations.
/Proc/sys/Vm/dirty_expire_centisecs
This parameter declares that the data in the write buffer in the Linux kernel is too old, and the pdflush process begins to consider writing data to the disk. Unit: 1/100 seconds. The default value is
30000, that is, 30
If the data in seconds is old, the disk will be refreshed. For write operations with special overloading, it is also good to narrow down this value, but it cannot be reduced too much, because too much will lead to Io increase too quickly. Recommended
1500, that is, 15 seconds is counted as old.
/Proc/sys/Vm/drop_caches
Release used cache
/Proc/sys/Vm/page-Cluster
This file indicates the number of pages written when writing to the swap area once. 0 indicates 1 page, 1 indicates 2 pages, and 2 indicates 4 pages.
/Proc/sys/Vm/swapiness
This file indicates the extent to which the system performs swap. The higher the value (0-100), the more likely disk swap will occur.
/Proc/sys/Vm/vfs_cache_pressure
This file indicates that the kernel recycles the preference for directory and inode cache memory.
/Etc/sysctl. conf
VM. dirty_ratio = 1
VM. dirty_background_ratio = 1
VM. dirty_writeback_centisecs = 1
VM. dirty_expire_centisecs = 3
VM. drop_caches = 3
VM. swapiness = 100
VM. vfs_cache_pressure = 133
VM. dirty_ratio = 5 # DFT 20%
VM. dirty_background_ratio = 5 # FFT 10%
VM. dirty_writeback_centisecs = 100 # DFT 500 is 5S
VM. dirty_expire_centisecs = 300 # DFT 30000 is 30 s
VM. drop_caches = 3 # DFT 0
VM. swappiness = 100 # DFT 60
VM. vfs_cache_pressure = 133 # DFT 100
VMS. min_free_kbytes = 204800
#200 MB mem
Save simpleSysctl-WNet. Route 4.route. Flush = 1