Skip to content

Instantly share code, notes, and snippets.

@kazhang
Created January 9, 2014 23:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kazhang/8344180 to your computer and use it in GitHub Desktop.
Save kazhang/8344180 to your computer and use it in GitHub Desktop.
A Ceph performance benchmark script.
#!/bin/bash
OSD=( ceph-srv4 ceph-srv5 )
VM=( 32 35 37 )
SLEEP=480
if [ "$1" = "-q" ]; then
SILENT=true
else
SILENT=false
fi
#copy fio files
echo "Copy fio script to VMs? [Y]/n"
if $SILENT; then
ans="Y"
else
read ans
fi
if [ -z $ans ] || [ "$ans" = "Y" ]; then
for i in "${VM[@]}"; do
scp bench.fio ubuntu@172.29.68.$i:~/
done
fi
#run dd
echo "Run dd? [Y]/n"
if $SILENT; then
ans="Y"
else
read ans
fi
if [ -z $ans ] || [ "$ans" = "Y" ]; then
#run dd
for i in "${VM[@]}"; do
ssh ubuntu@172.29.68.$i sudo dd if=/dev/zero of=/mnt/file bs=4M count=2500 oflag=direct &
done
#sleep
sleep 120
#gather results
for i in "${VM[@]}"; do
ssh ubuntu@172.29.68.$i sudo rm /mnt/file
done
fi
#run sequential write benchmark
echo "Run sequential write? [Y]/n"
if $SILENT; then
ans="Y"
else
read ans
fi
if [ -z $ans ] || [ "$ans" = "Y" ]; then
#drop cache
for i in "${OSD[@]}"; do
ssh $i sudo bash drop_cache.sh
done
#run sequential write
for i in "${VM[@]}"; do
ssh ubuntu@172.29.68.$i sudo fio bench.fio --section seq-write-64k --output seq_write_$i &
done
#sleep
sleep $SLEEP
#gather results
for i in "${VM[@]}"; do
scp ubuntu@172.29.68.$i:~/seq_write_$i .
done
fi
#run sequential read benchmark
echo "Run sequential read? [Y]/n"
if $SILENT; then
ans="Y"
else
read ans
fi
if [ -z $ans ] || [ "$ans" = "Y" ]; then
#drop cache
for i in "${OSD[@]}"; do
ssh $i sudo bash drop_cache.sh
done
#run sequential read
for i in "${VM[@]}"; do
ssh ubuntu@172.29.68.$i sudo fio bench.fio --section seq-read-64k --output seq_read_$i &
done
#sleep
sleep $SLEEP
#gather results
for i in "${VM[@]}"; do
scp ubuntu@172.29.68.$i:~/seq_read_$i .
done
fi
#run random write benchmark
echo "Run random write? [Y]/n"
if $SILENT; then
ans="Y"
else
read ans
fi
if [ -z $ans ] || [ "$ans" = "Y" ]; then
#drop cache
for i in "${OSD[@]}"; do
ssh $i sudo bash drop_cache.sh
done
#run random write
for i in "${VM[@]}"; do
ssh ubuntu@172.29.68.$i sudo fio bench.fio --section rand-write-4k --output rand_write_$i &
done
#sleep
sleep $SLEEP
#gather results
for i in "${VM[@]}"; do
scp ubuntu@172.29.68.$i:~/rand_write_$i .
done
fi
#run random read benchmark
echo "Run random read? [Y]/n"
if $SILENT; then
ans="Y"
else
read ans
fi
if [ -z $ans ] || [ "$ans" = "Y" ]; then
#drop cache
for i in "${OSD[@]}"; do
ssh $i sudo bash drop_cache.sh
done
#run random read
for i in "${VM[@]}"; do
ssh ubuntu@172.29.68.$i sudo fio bench.fio --section rand-read-4k --output rand_read_$i &
done
#sleep
sleep $SLEEP
#gather results
for i in "${VM[@]}"; do
scp ubuntu@172.29.68.$i:~/rand_read_$i .
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment