-
-
Save lmcro/b3de56e3a1ee8c0f76a7bb0ddbaf9741 to your computer and use it in GitHub Desktop.
Revisions
-
graysky2 created this gist
Nov 22, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,60 @@ #!/bin/bash # define the name or IP address of the machine that will receive the files HOST=foo # define the user you are running as on both machines USER=bar # define a link to tmpfs where there is plenty of RAM free # by default /tmp is mounted with 1/2 physical memory and this test as written below # requires approx 1.2G of free space on each end of the test TMPFS=/tmp # log file with results LOGPATH=/home/$USER/cipher_results.csv # ciphers to test CIPHERS="aes128-ctr aes192-ctr aes256-ctr [email protected] [email protected] [email protected]" #### # check deps for i in dd parallel; do command -v $i >/dev/null 2>&1 || { echo " I require $i but it's not installed. Aborting!" >&2; exit 1; } done ping -c 1 $HOST > /dev/null if [ $? -ne 0 ]; then echo "$HOST is down" exit 1 fi make_receipe() { # make the 1100M file assembled from 3x10M files in in a pseudo random fashion # this should prevent any caching since all files will be unique for i in {0..109}; do RND=$(echo $[ 1 + $[ RANDOM % 3 ]]) Array[$i]=$TMPFS/file$RND done } for cipher in $CIPHERS; do echo " --> $cipher" parallel "dd if=/dev/urandom of=$TMPFS/file{} bs=1M count=10 &>/dev/null" ::: 1 2 3 for j in 1 2 3; do make_receipe cat ${Array[@]} > $TMPFS/part$j start=$(date +%s.%N) scp -c "$cipher" $TMPFS/part$j $USER@$HOST:$TMPFS end=$(date +%s.%N) diff=$(echo "scale=6; $end - $start" | bc) [[ ! -f $LOG ]] && echo "cipher,round,time(sec),host" > $LOG echo "$cipher,$j,$diff,$HOST" >> $LOG rm -f $TMPFS/part$j ssh $HOST "rm -f $TMPFS/part$j" done done rm -f $TMPFS/file[1,2,3]