From ecc77e55ed7f7c76a9f2f1b6af6e5d7fd44bef99 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 18 Oct 2019 19:45:19 +0200 Subject: [PATCH] Add timing hack / test1 --- hacking/timing-tests/benchmark-files.sh | 79 +++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 hacking/timing-tests/benchmark-files.sh diff --git a/hacking/timing-tests/benchmark-files.sh b/hacking/timing-tests/benchmark-files.sh new file mode 100644 index 00000000..c71d1c7e --- /dev/null +++ b/hacking/timing-tests/benchmark-files.sh @@ -0,0 +1,79 @@ +#!/bin/sh + +num=50000 +dsthost=localhost + +tmp=$(mktemp -d) +remote_tmp=${tmp}-remote + +cd "$tmp" + +create_files() { + i=0 + while [ $i -lt $num ]; do + echo $i > file-${i} + i=$((i+1)) + done +} + +delete_remote() { + ssh "${dsthost}" "rm -rf ${remote_tmp}" +} + + +tar_remote() { + cd "${tmp}" + tar c . | ssh "${dsthost}" "mkdir ${remote_tmp}; cd ${remote_tmp}; tar x" +} + +cdist_remote() +{ + ( + while [ $i -lt $num ]; do + echo __file ${remote_tmp}/file-${i} --source "${tmp}/file-${i}" + i=$((i+1)) + done + ) | cdist config -i - -vv "${dsthost}" + +} + +cdist_remote_parallel() +{ + ( + while [ $i -lt $num ]; do + echo __file ${remote_tmp}/file-${i} --source "${tmp}/file-${i}" + i=$((i+1)) + done + ) | cdist config -j10 -i - -vv "${dsthost}" + +} + +echo "Creating ${num} files" +time create_files + +echo "scping files" +time scp -r "${tmp}" "${dsthost}:$remote_tmp" >/dev/null + +echo "delete remote" +time delete_remote + +echo "taring files" +time tar_remote + +echo "delete remote" +time delete_remote + +echo "cdisting files" +time cdist_remote + +echo "delete remote" +time delete_remote + +echo "cdisting files (parallel)!" +time cdist_remote + +echo "delete remote" +time delete_remote + +echo "delete local" +rm -rf "$tmp"