Tag: test

SwapoutClustering patch tested

Posted by – November 2, 2009

When NetBSD and FreeBSD swap out a page from a process, they look in the process virtual address space to find nearby pages that are also candidates for being swapped out. This greatly increases the chance of swapin IO pulling in related data, reducing the number of disk seeks involved in swap IO (from kernelnewbies.org).
I’ve tested the Swapout Clustering patch here and it seems to improve the overall swapping system.
I wrote a benchmark tool to test the swapping system of Linux and collect results.
The benchmark allocates and locks a high amount of physical memory and measures timings of reads and writes to swapped memory.

Actually the parent process sucks all the memory, locks it (unswappable memory) and other 30 processes allocate their own memory to perform reads and writes on.
Three parameters (amount of memory to lock, number of benchmark processes, amount of memory allocated per process) can be tuned to perform a reasonable benchmark on different systems.

Results have been collected on a virtual machine running in KVM, with 128MB RAM.
The benchmark tool has been launched by locking 110MB of physical memory; 30 processes performed reads and writes on a 10MB memory space.
Build and run with

make swapbench
./swapbench -a 110 -p 30 -l 10

Set a reasonable amount of memory to lock and force the system to swap benchmark processes’ memory in and out.

Results

I run the benchmark many times to collect reliable results on a Kvm virtual machine with 128MB Ram, Intel Core2Duo processor and the kernel versions reported in the table below:

kernel version Avg. read (s) Avg. write (s) Overhead read Overhead write
linux-git 2.6.32-rc5
0.560072201681
0.560865798319
%
%
linux-git-swapoutclustering-patch
0.433929222689
0.43047510084
-23%
-23%

Download

The source code of the benchmark as well as the collected results is available for download.

Filename Description Download
swapbench.c Source code of the benchmark tool (not complete but fully functional) here
bench_swap_cluster.txt Results collected from linux-git here
bench_swap_cluster_patch.txt Results collected from linux-git-cluster-patch here
readstats.py Python utility to compute averages from result files here