Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux manually releases Cache

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

1. Directly change the kernel running parameters

# release pagecache

Echo 1 > / proc/sys/vm/drop_caches

# release dentries and inodes

Echo 2 > / proc/sys/vm/drop_caches

# release pagecache, dentries and inodes

Echo 3 > / proc/sys/vm/drop_caches

two。 Use sysctl to reset kernel running parameters

Sysctl-w vm.drop_caches=3

Note: both of these methods are temporary. Permanent validity needs to be added to the sysctl.conf file, which is generally written as a script to clean up manually. It is recommended not to clean up.

Modify / etc/sysctl.conf to add the following options, 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, making it almost impossible for cache to play its role. It is necessary to make appropriate adjustments according to the condition of the machine to find the best compromise.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report