D
D
Daniel Newman2012-08-29 09:29:51
System administration
Daniel Newman, 2012-08-29 09:29:51

How to prevent swap in Linux?

c0deca6efdd7b34f4abcdff900c1aaae.png
From 02:00 to 06:00 (the area of ​​​​the chart's splitting) I dualso played around with the transfer of files. Around 04:00, due to IOwait (apparently), some of the processes decided to get into swap. This has already happened on this server, but treating such situations with a reboot is no longer handy. Where he could, he restarted services (mysql, nginx, sphinx), where the restart did not help, he killed and restarted.
Now the server looks like this:
/usr/bin/slabtop --sort=c

Active / Total Objects (% used)    : 23432931 / 23747426 (98.7%)
 Active / Total Slabs (% used)      : 2735840 / 2735866 (100.0%)
 Active / Total Caches (% used)     : 106 / 186 (57.0%)
 Active / Total Size (% used)       : 10643029.64K / 10793250.76K (98.6%)
 Minimum / Average / Maximum Object : 0.02K / 0.45K / 4096.00K

8301820	8299960	99%	1.00K	2075455	4	8301820K	ext4_inode_cache
8400040	8376094	99%	0.19K	420002	20	1680008K	dentry
4174747	4173905	99%	0.10K	112831	37	451324K		buffer_head
534422	278544	52%	0.55K	76346	7	305384K		radix_tree_node
2122702	2121946	99%	0.06K	35978	59	143912K		size-64
33174	33121	99%	0.62K	5529	6	22116K		proc_inode_cache
185	185	100%	32.12K	185	1	11840K		kmem_cache
15588	15586	99%	0.58K	2598	6	10392K		inode_cache

1. How to force ext4_inode_cacheto dentryrestart without rebooting the server?
2. How to set a rule that swap would be the last thing?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
O
okazymyrov, 2012-08-29
@danielnewman

>> but treating such situations with a reboot is no longer handy.
In such a situation, I do swapoff and swapon. When you start the first one, the memory will be transferred back from disk to RAM.
And there are no answers to questions.

V
vsespb, 2012-08-29
@vsespb

try sysctl command like sysctl vm.swappiness=30

D
Daniel Newman, 2012-08-29
@danielnewman

# sync
# cat /proc/sys/vm/drop_caches

# echo > 1 > /proc/sys/vm/drop_caches
free pagecache
# echo > 2 > /proc/sys/vm/drop_caches
free dentries and inodes
# echo > 3 > /proc/sys/vm/drop_caches
free pagecache, dentries and inodes
rackerhacker.com/2008/12/03/reducing-inode-and-dentry-caches-to-keep-oom-killer-at-bay/
www.linuxinsight.com/proc_sys_vm_drop_caches.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question