After resetting swappiness to 72 and memory usage going all the way to 83 - no swapping.
This is normal & as expected. In ASUS routers with
1GB RAM, swapping will not be usually triggered until RAM utilization is roughly
~97% (~95% in routers with 512MB RAM). This is due to the value set for the "
low water mark" threshold (
6400 pages =
25MB) in the
DMA memory zone. You can see the current threshold values (the "
low" & "
high" lines) with the following command:
Now, to be abundantly clear, note that the swappiness value itself does *
not* set a specific threshold for RAM utilization so that swapping is triggered when the amount of used RAM hits that threshold. Instead, the swappiness value is used to set a relative ratio for the preference of the swapping algorithm to mark for reclamation & free up two types of memory pages:
file-backed pages or
anonymous pages (see
post #14 in this same thread for definitions).
IOW, when RAM pages need to be freed, the swappiness value is taken into account by the memory reclamation & swap algorithms to determine which memory page types (file-backed or anonymous) are preferentially considered to be freed. See
post #11 where I briefly described this, and the two threshold values used (
low water mark &
high water mark) to trigger the swapping mechanism.
1 - is there any way, simply for testing, to get swapping to start just to make sure it works and see what pops up in the logs etc.?
Off the top of my head, I don't know of a simple way to trigger swapping in ASUS routers. Many years ago (more than a decade by now) when I needed to test/verify a memory management & garbage collection algorithm in other Linux-based devices (not routers), I wrote a program in C++ that had a recursive function which dynamically allocated memory every 60 seconds in fixed chunks (1MB, 5MB, 10MB or 20MB, depending on RAM size & other factors) until RAM was very near exhaustion. In the meantime, other utility programs were gathering stats regarding RAM & swap usage. You could try setting *temporarily* the swappiness value to
100 to increase the chance of swapping, but you still need something else to gradually & dynamically consume RAM until almost close to full depletion.
2 - Is there an add-on that is so hungry it makes swapping mandatory?
The only add-on I have installed & currently use is YazFi. I've read about the
Diversion &
Transmission add-ons requiring at least a 1GB swap and actually using swap quite frequently. There are probably other add-ons that use swap as well, but I have no actual personal experience with any of those scripts to know for sure.
3 - how do you edit system-config.sh
If your goal is to simply change the swappiness value every time upon reboot, you can add the following command to the "
/jffs/scripts/services-start" script (you can use the
nano or
vi text editor to do this).
Bash:
echo 60 > /proc/sys/vm/swappiness
If you don't already have the "
/jffs/scripts/services-start" script file, you can create it on an SSH terminal window using the following commands:
Bash:
cat << "EOF" > /jffs/scripts/services-start
#!/bin/sh
echo 60 > /proc/sys/vm/swappiness
EOF
chmod a+x /jffs/scripts/services-start
NOTE:
The above assumes that you have the "
Enable JFFS custom scripts and configs" option already enabled (i.e. set to "
Yes" in the "
Administration ->
System" web GUI tab).
My 2 cents.