分类: LINUX
2011-07-24 00:42:08
1、Swappiness
Swappiness is a property for the that changes the balance between swapping out runtime memory, as opposed to dropping pages from the system . Swappiness can be set to values between 0 and 100 inclusive. A low value means the kernel will try to avoid swapping as much as possible where a higher value instead will make the kernel aggressively try to use swap space. The default value is 60, and for most desktop systems, setting it to 100 may help to improve overall performance, whereas setting it lower (even 0) may improve interactivity (decreasing response latency.)
To temporarily set the swappiness in Linux, as root you set the value to 100 with the following command:
This file contains valid hold time of swap out protection token. The Linux VM has token based thrashing control mechanism and uses the token to prevent unnecessary page faults in thrashing situation. The unit of the value is second. The value would be useful to tune thrashing behavior.
This tunable was removed in 2.6.20 when the algorithm got improved.
I tested the patch on an IA-32 4 way machine which has 4GB memory. Based kernel was 2.6.9-rc1. I tested five swap_token_time_out values. I created 256 workload generation processes on the machine. Each process generated same workload: repeating random file writing and memory access (Memory region is 18MB). I ran the processes for one hour and calculated write throughput of workload processes. The result was following. swap_token_time_out Write throughput [MB/s] ------------------- ---------------------- 30,000,000 6.71 3,000,000 8.26 300,000 (DEFAULT) 7.90 30,000 8.16 3,000 7.43 As you can see, it may be possible to improve application performance according to tune swap_token_time_out. Additionally, I think it is better to decrease default value. One reason is that the other values gained good performance. The other is that behavior of kernel may be unstable if swap_token_time_out is too long. More majordomo info at Please read the FAQ at