Skip to content

Commit

Permalink
misc: create shell for benchmark
Browse files Browse the repository at this point in the history
1. prepare_env.sh for prepare container environment.
2. benchmark_summary.sh for benchmark-result to summary result.

Signed-off-by: Desiki-high <[email protected]>
  • Loading branch information
Desiki-high authored and imeoer committed Apr 22, 2023
1 parent faa10b7 commit 6cd8781
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 1 deletion.
27 changes: 27 additions & 0 deletions misc/benchmark/benchmark_summary.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

sudo install -m 755 benchmark-oci/wordpress.csv oci.csv
sudo install -m 755 benchmark-zran-all-prefetch/wordpress.csv zran-all-prefetch.csv
sudo install -m 755 benchmark-zran-no-prefetch/wordpress.csv zran-no-prefetch.csv
sudo install -m 755 benchmark-nydus-no-prefetch/wordpress.csv nydus-no-prefetch.csv
sudo install -m 755 benchmark-nydus-all-prefetch/wordpress.csv nydus-all-prefetch.csv
sudo install -m 755 benchmark-nydus-filelist-prefetch/wordpress.csv nydus-filelist-prefetch.csv

echo "| benchmark-result | pull-elapsed(s) | create-elapsed(s) | run-elapsed(s) | total-elapsed(s) |"
echo "|:-------|:-----------------:|:-------------------:|:----------------:|:------------------:|"

files=(oci.csv nydus-all-prefetch.csv zran-all-prefetch.csv nydus-no-prefetch.csv zran-no-prefetch.csv nydus-filelist-prefetch.csv)

for file in "${files[@]}"; do
if ! [ -f "$file" ]; then
continue
fi
filename=$(basename "$file" .csv)
tail -n +2 "$file" | while read line; do
pull=$(echo "$line" | cut -d ',' -f 2)
create=$(echo "$line" | cut -d ',' -f 3)
run=$(echo "$line" | cut -d ',' -f 4)
total=$(echo "$line" | cut -d ',' -f 5)
printf "| %s | %s | %s | %s | %s |\n" "$filename" "$pull" "$create" "$run" "$total"
done
done
2 changes: 1 addition & 1 deletion misc/benchmark/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ insecure_source_registry: False
local_registry: localhost:5000
insecure_local_registry: True
bandwith: 81920
image: wordpress:latest
image: wordpress:6.1.1
44 changes: 44 additions & 0 deletions misc/benchmark/prepare_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

readonly SNAPSHOOTER_VERSION=0.7.3
readonly NERDCTL_VERSION=1.3.0
readonly CNI_PLUGINS_VERSION=1.2.0

# setup nerdctl and nydusd env
case "$1" in
"oci")
sudo install -D -m 755 contrib/nydusify/cmd/nydusify /usr/local/bin
sudo install -D -m 755 target/release/nydusd target/release/nydus-image /usr/local/bin
sudo wget https://github.com/containerd/nerdctl/releases/download/v$NERDCTL_VERSION/nerdctl-$NERDCTL_VERSION-linux-amd64.tar.gz
sudo tar -xzvf nerdctl-$NERDCTL_VERSION-linux-amd64.tar.gz -C /usr/local/bin
sudo mkdir -p /opt/cni/bin
sudo wget https://github.com/containernetworking/plugins/releases/download/v$CNI_PLUGINS_VERSION/cni-plugins-linux-amd64-v$CNI_PLUGINS_VERSION.tgz
sudo tar -xzvf cni-plugins-linux-amd64-v$CNI_PLUGINS_VERSION.tgz -C /opt/cni/bin
sudo install -D misc/benchmark/cni_bridge.conf /etc/cni/net.d/bridge.conf
;;
"nydus")
sudo install -D -m 755 contrib/nydusify/cmd/nydusify /usr/local/bin
sudo install -D -m 755 target/release/nydusd target/release/nydus-image /usr/local/bin
wget https://github.com/containerd/nydus-snapshotter/releases/download/v$SNAPSHOOTER_VERSION/nydus-snapshotter-v$SNAPSHOOTER_VERSION-x86_64.tgz
tar zxvf nydus-snapshotter-v$SNAPSHOOTER_VERSION-x86_64.tgz
sudo install -D -m 755 nydus-snapshotter/containerd-nydus-grpc /usr/local/bin/
sudo wget https://github.com/containerd/nerdctl/releases/download/v$NERDCTL_VERSION/nerdctl-$NERDCTL_VERSION-linux-amd64.tar.gz
sudo tar -xzvf nerdctl-$NERDCTL_VERSION-linux-amd64.tar.gz -C /usr/local/bin
sudo mkdir -p /opt/cni/bin
sudo wget https://github.com/containernetworking/plugins/releases/download/v$CNI_PLUGINS_VERSION/cni-plugins-linux-amd64-v$CNI_PLUGINS_VERSION.tgz
sudo tar -xzvf cni-plugins-linux-amd64-v$CNI_PLUGINS_VERSION.tgz -C /opt/cni/bin
sudo install -D misc/benchmark/cni_bridge.conf /etc/cni/net.d/bridge.conf
sudo install -D misc/benchmark/nydusd_config.json /etc/nydus/config.json
sudo install -D misc/benchmark/containerd_config.toml /etc/containerd/config.toml
sudo systemctl restart containerd
sudo install -D misc/benchmark/nydus-snapshotter.service /etc/systemd/system/nydus-snapshotter.service
sudo systemctl start nydus-snapshotter
;;
*)
echo "Unknown command: $1"
;;
esac
# setup registry env
sudo docker run -d --restart=always -p 5000:5000 --name registry registry
git clone https://github.com/magnific0/wondershaper.git
sudo install -D -m 755 wondershaper/wondershaper /usr/local/bin

0 comments on commit 6cd8781

Please sign in to comment.