|
SwapDiskVsRamz
Comparing swap I/O latencies for hard-disk and ramzswap.
IntroductionHow much faster is I/O from ramzswap compared to hard-disk? To determine this we check how long it takes for individual swap R/W operations to complete under heavy swapping conditions. DetailsTest config
Test details
We use SystemTap to determine time taken by individual swap I/O. Following is the systemtap script used: global time_read
global time_read_aggr
global time_write
global time_write_aggr
probe begin {
print("swap probe begin\n")
}
probe end {
print("swap probe end\n")
}
/* swap read */
probe kernel.function("swap_readpage") {
time_read[tid()] = gettimeofday_ns();
}
probe kernel.function("end_swap_bio_read") {
if (time_read[tid()]) {
time_read_aggr <<< (gettimeofday_ns() - time_read[tid()])
delete time_read[tid()]
}
}
/* swap write */
probe kernel.function("swap_writepage") {
time_write[tid()] = gettimeofday_ns();
}
probe kernel.function("end_swap_bio_write") {
if (time_write[tid()]) {
time_write_aggr <<< (gettimeofday_ns() - time_write[tid()])
delete time_write[tid()]
}
}OutputFor disk swaptime_read_aggr @count=0xc465 @min=0x1e1d @max=0x2778b69d5ef @sum=0x7b4718532b7 @avg=0xa0b13c9 time_write_aggr @count=0x1bb6 @min=0x1d0e @max=0x773d04af3e @sum=0x24b9c4f02a9 @avg=0x15347b3c For ramzswaptime_read_aggr @count=0x412fba @min=0x59b @max=0x195473f @sum=0xc02d2b158 @avg=0x2f2b time_write_aggr @count=0x414e35 @min=0x929 @max=0x15fcacd @sum=0x6fbdbb071 @avg=0x1b60 ResultsComparing average R/W times:
Notes
| |||||||||
► Sign in to add a comment
I found one problem for this testing script. Take one page as an example, how does this script make sure that the tid of swap_readpage() is the same as the tid of end_swap_bio_read()? For example, process P1 access one page on swap disk, enter page fault handler, and eventually call swap_readpage(), which records the time in time_readP1?. But when the disk data is ready, the hardware interrupt can come in the context of another process, e.g., P2, then the systemtap will compare the current of time_readP2?.
I have used this script and discover some weird result, e.g. @max=300 second, and should be the proof of my argument. One workaround in my mind is to use the PFN as index of time_read (maybe using Jprobe?)