Last active
May 6, 2016 18:07
-
-
Save bag-man/95cc7cc7ad7046bbe2bc30f01c0f73bd to your computer and use it in GitHub Desktop.
Benchmark MongDB on different filesystems
This file contains hidden or 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
| formatDrives() { | |
| mkfs.ext4 /dev/sdc | |
| mkfs.xfs /dev/sdd | |
| } | |
| createZFS () { | |
| sleep 30 | |
| zpool destroy tank | |
| zpool create -f -m /zfs tank /dev/sde | |
| if [ $1 ]; then | |
| zfs set $1 tank | |
| fi | |
| } | |
| createZFSOption () { | |
| sleep 30 | |
| zpool destroy tank | |
| zpool create -f -m /zfs tank /dev/sde -o $1 | |
| } | |
| runBenchmark () { | |
| mkdir -p results/$1$2 | |
| ./run.simple.bash | |
| echo -e "\n$1$2" >> results.txt | |
| tail -n 1 mongoSysbenchLoad-16-1000000-8.txt.tsv | awk '{ print $3 }' >> results.txt | |
| tail -n 1 mongoSysbenchExecute-16-1000000-64.txt.tsv | awk '{ print $2 }' >> results.txt | |
| mv mongoSysbench* results/$1$2 | |
| } | |
| startMongo () { | |
| mongod --directoryperdb --dbpath $1 > /dev/null 2>&1 & | |
| sleep 5 | |
| mongo sbtest --eval "printjson(db.dropDatabase())" | |
| runBenchmark $1 $2 | |
| killall mongod | |
| } | |
| runTests () { | |
| # formatDrives | |
| createZFS | |
| startMongo /ext4 | |
| startMongo /xfs | |
| startMongo /zfs | |
| createZFS recordsize=8K | |
| startMongo /zfs 8 | |
| createZFS recordsize=64K | |
| startMongo /zfs 64 | |
| createZFS compression=lz4 | |
| startMongo /zfs lz4 | |
| createZFS compression=gzip | |
| startMongo /zfs gzip | |
| createZFSOption ashift=9 | |
| startMongo /zfs ashift9 | |
| createZFSOption ashift=12 | |
| startMongo /zfs ashift12 | |
| } | |
| mkdir runs | |
| for i in $(seq 1 10) | |
| do | |
| echo -e "Test $i" >> results.txt | |
| runTests | |
| mv results runs/results$i | |
| echo -e "\n\n" >> results.txt | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment