You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
1.3 KiB
79 lines
1.3 KiB
#!/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"
|
|
|