Skip to contentSkip to conversation

dynamic swap prioritizing

DISCUSSION Xuan Baldauf 4 participants 4 messages Oct 9, 2001 – Oct 10, 2001

lore
Share & tools
lore
#0 lore raw

Hello,

I have a linux box with 3 harddisks of different characteristics (size, seek time, throughput), each capable of holding a swap partition. Sometimes, one harddisk is driven heavily (e.g. database application), sometimes, the other harddisk is busy.

I imagine following optimization:
- all swap partitions have the same priority from the start on
- runtime statistics are gathered covering response time (time from page request to availability)
- the fastest drive is used first (or maybe in striping mode parallely woth the second-fastest drive)
- because the fastest drive will be more busy, its response times will rise, reaching equality with other drives
- at that point, other drives are also considered for swapout
- that system regularily adapts its decisions based on recent statistics ("recent" is a tuning parameter)

Such an algorithm also would properly prioritize network-swap and video-memory-swap, reducing time and cost of a manual priority configuration (and statistics gathering).

Does the linux kernel already implement such an optimization? Is it planned?

Xuân.

#1 lore raw
Quoted 2 lines · Xuan Baldauf

Does the linux kernel already implement such an
optimization? Is it planned?

No and no. But feel free to try to implement it.

I'm not sure if it would be a win to have the system do this dynamic swap priority readjustment, but I wouldn't be surprised if it was, either.

regards,

Rik

Signature · 3 lines
DMCA, SSSCA, W3C?  Who cares?  http://thefreeworld.net/  (volunteers needed)

http://www.surriel.com/		http://distro.conectiva.com/
#2 lore raw
In reply to Xuan Baldauf
Quoted 5 lines · Xuan Baldauf

I have a linux box with 3 harddisks of different characteristics (size, seek time, throughput), each capable of holding a swap partition. Sometimes, one harddisk is driven heavily (e.g. database application), sometimes, the other harddisk is busy.

Daniel Phillips was working on something which may be useful in this regard. Basically, he was trying to determine how "busy" a disk was, so that if there are dirty pages to be written on an "idle" disk they would be written immediately. The theory is that if you wait longer, the disk may be busy with other I/O and you have "wasted" the resource of disk bandwidth doing nothing.

Similarly, if you knew how busy each disk with a swap partition was, you could swap to the most idle disk (assuming equal speed) or at least take this into account if the speeds are different.

If this is to be generally useful, it would be good to find things like max sequential read speed, max sequential write speed, and max seek time (at least). Estimates for max sequential read speed and seek time could be found at boot time for each disk relatively easily, but write speed may have to be found only at runtime (or it could all be fed in to the kernel from user space from benchmarks run previously).

Once we had data like that, it would be relatively easy to keep track of the queue depth for each device to determine "business" and estimated time to an empty queue and make intelligent disk I/O scheduling decisions (e.g. which MD RAID 1 disk to read from, which disk to swap to, guaranteed I/O rate for XFS, etc).

Cheers, Andreas
--
Andreas Dilger \ "If a man ate a pound of pasta and a pound of antipasto,
\ would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/ -- Dogbert

#3 lore raw
In reply to Xuan Baldauf
Quoted 5 lines · Xuan Baldauf

Hello,

I have a linux box with 3 harddisks of different characteristics (size, seek time, throughput), each capable

[algorithm for changing swap priorities]

Quoted 4 lines

Does the linux kernel already implement such an
optimization? Is it planned?

It doesn't already. I am not sure this is a kernel thing either. Changing swap priorities could be done by userspace programs if there were a syscall or /proc interface for it.

You could then have a script changing priorities when you start your database for example. Or a daemon making changes based on statistics.

Helge Hafting