Skip to content

Instantly share code, notes, and snippets.

@lathiat
Last active May 28, 2024 05:34
Show Gist options
  • Save lathiat/66aba5d43e2d487057d8e3322e3ecf5a to your computer and use it in GitHub Desktop.
Save lathiat/66aba5d43e2d487057d8e3322e3ecf5a to your computer and use it in GitHub Desktop.
Test download speed and collect data/statistics from rsync.archive.ubuntu.com
#!/bin/bash
set -xe
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT
testrun=$(date -Isecond)
mkdir -p ~/test-mirror/${testrun}
cd ~/test-mirror/${testrun}
# ~400M -rw-r--r-- 421,586,560 2024/01/09 17:36:50 linux-source-6.2.0_6.2.0-41.42_all.deb
# ~100M -rw-r--r-- 98,862,464 2019/01/17 13:08:52 linux-source-3.13.0_3.13.0-165.215_all.deb
test_path=ubuntu/pool/main/l/linux
test_file=linux-source-3.13.0_3.13.0-165.215_all.deb
rsync_ips=$(host rsync.archive.ubuntu.com|awk '{print $NF}')
for r in ${rsync_ips}; do
rm ${test_file} || true
tcpdump --no-promiscuous-mode -ni br0 host ${r} -s 65535 -w pcap.${r} &
time rsync -va --progress "[${r}]::${test_path}/${test_file}" . &> rsync.${r}
sleep 1
ss -ni |grep -A1 ${r} &> ss.${r}
kill %-
rm ${test_file} || true
time rsync -va --progress "[${r}]::${test_path}/${test_file}" . &> rsync2.${r}
done
for result in rsync.*; do
IP=${result#rsync.}
echo ${result}
grep xfr rsync.${IP}
grep xfr rsync2.${IP}
#cat ss.${IP}
done
@lathiat
Copy link
Author

lathiat commented May 28, 2024

A case where the first retrieval was fast then the second was super slow for some reason, but only from 185.125.190.39

root@zlab:~/test-mirror/2024-05-28T04:40:37+00:00# for result in rsync.*; do   IP=${result#rsync.};   echo ${result};   grep xfr rsync.${IP};   grep xfr rsync2.${IP}
done
rsync.185.125.190.36
     98,862,464 100%    5.28MB/s    0:00:17 (xfr#1, to-chk=0/1)
     98,862,464 100%    4.29MB/s    0:00:21 (xfr#1, to-chk=0/1)
rsync.185.125.190.39
     98,862,464 100%    3.49MB/s    0:00:26 (xfr#1, to-chk=0/1)
     98,862,464 100%  330.46kB/s    0:04:52 (xfr#1, to-chk=0/1)
rsync.2620:2d:4000:1::16
     98,862,464 100%    6.38MB/s    0:00:14 (xfr#1, to-chk=0/1)
     98,862,464 100%    5.73MB/s    0:00:16 (xfr#1, to-chk=0/1)
rsync.2620:2d:4000:1::19
     98,862,464 100%    6.30MB/s    0:00:14 (xfr#1, to-chk=0/1)
     98,862,464 100%    6.43MB/s    0:00:14 (xfr#1, to-chk=0/1)
rsync.2620:2d:4002:1::101
     98,862,464 100%    8.81MB/s    0:00:10 (xfr#1, to-chk=0/1)
     98,862,464 100%    8.52MB/s    0:00:11 (xfr#1, to-chk=0/1)
rsync.2620:2d:4002:1::102
     98,862,464 100%    6.97MB/s    0:00:13 (xfr#1, to-chk=0/1)
     98,862,464 100%    8.75MB/s    0:00:10 (xfr#1, to-chk=0/1)
rsync.2620:2d:4002:1::103
     98,862,464 100%    8.53MB/s    0:00:11 (xfr#1, to-chk=0/1)
     98,862,464 100%    8.52MB/s    0:00:11 (xfr#1, to-chk=0/1)
rsync.91.189.91.81
     98,862,464 100%    8.51MB/s    0:00:11 (xfr#1, to-chk=0/1)
     98,862,464 100%    8.76MB/s    0:00:10 (xfr#1, to-chk=0/1)
rsync.91.189.91.82
     98,862,464 100%    8.80MB/s    0:00:10 (xfr#1, to-chk=0/1)
     98,862,464 100%    8.52MB/s    0:00:11 (xfr#1, to-chk=0/1)
rsync.91.189.91.83
     98,862,464 100%    8.77MB/s    0:00:10 (xfr#1, to-chk=0/1)
     98,862,464 100%    8.75MB/s    0:00:10 (xfr#1, to-chk=0/1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment