Created
July 6, 2011 16:25
-
-
Save apinstein/1067664 to your computer and use it in GitHub Desktop.
Test ionice
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This should result in very different completion times for the 2 runs. | |
# This script is useful to be sure that ionice works on your kernel since it's possible to have the | |
# ionice command yet using it has no effect | |
# you can check your scheduler with something like | |
# cat /sys/block/sda1/queue/scheduler | |
# NOTE: I wrote this to help me figure out if ionice was working on my system. It doesn't seem to be, since the | |
# output of this script indicates that the priorities, while adjusted, don't get reflected in the real world timings. | |
# I don't know if my script is wrong or if my server is mis-configured. | |
me=$$ | |
echo "Starting 2 IO ops at different priorities...." | |
ionice -c2 -n1 bash -c "dd if=/dev/urandom of=ionice-a.log bs=1M count=50 && rm ionice-a.log && echo 'a done'" & | |
a=$! | |
ionice -c3 -n1 bash -c "dd if=/dev/urandom of=ionice-b.log bs=1M count=50 && rm ionice-b.log && echo 'b done'" & | |
b=$! | |
# let things get forked? sometimes pstree is wrong otherwise | |
sleep 1 | |
pstree -pal $me | |
echo "A [`ps --ppid $a -o pid=`]: `ps --ppid $a -o pid= | xargs ionice -p`" | |
echo "B [`ps --ppid $b -o pid=`]: `ps --ppid $b -o pid= | xargs ionice -p`" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment