From 2458e0deefbc069dfaa81091f6fe4a93250d8913 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 10 Oct 2021 13:06:47 +0300 Subject: chore: drop obsolete benchmark.sh This uses benchmark binaries that no longer exist. Sponsored-by: author --- benchmark.sh | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100755 benchmark.sh diff --git a/benchmark.sh b/benchmark.sh deleted file mode 100755 index cf7491a..0000000 --- a/benchmark.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -chunkdir="$1" -bin="$2" - -cleanup() -{ - echo "emptying $chunkdir" 1>&2 - find "$chunkdir" -mindepth 1 -delete -} - -cleanup - -echo "running benchmarks for various sizes" -for n in 1 10 100 1000 10000 100000 1000000 -do - echo "size $n" 1>&2 - for prog in benchmark-null benchmark-index benchmark-store benchmark-indexedstore - do - /usr/bin/time --format "$prog $n %e" "$bin/$prog" "$chunkdir" "$n" 2>&1 - cleanup - done -done | awk '{ printf "%-30s %10s %10s\n", $1, $2, $3 }' -- cgit v1.2.1 From 6a0f418082eb5831ef40964e0798de2e0754a1a6 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 10 Oct 2021 14:09:03 +0300 Subject: chore: drop debug eprintln! calls They're not useful now. Should probably add logging, but that will have to wait until we have a good logging story. Sponsored-by: author --- src/index.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/index.rs b/src/index.rs index 8cbe01e..5d31068 100644 --- a/src/index.rs +++ b/src/index.rs @@ -214,7 +214,6 @@ mod sql { for meta in iter { let meta = meta?; if metas.is_empty() { - eprintln!("lookup: meta={:?}", meta); metas.push(meta); } else { let err = IndexError::DuplicateChunk(id.clone()); @@ -223,7 +222,6 @@ mod sql { } } if metas.is_empty() { - eprintln!("lookup: no hits"); return Err(IndexError::MissingChunk(id.clone())); } let r = metas[0].clone(); -- cgit v1.2.1 From 560b481f8edd11aaa012204e4798b9d549df685e Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 10 Oct 2021 14:09:46 +0300 Subject: perf: add script to run a simplistic benchmark Sponsored-by: author --- bench.sh | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100755 bench.sh diff --git a/bench.sh b/bench.sh new file mode 100755 index 0000000..75cd459 --- /dev/null +++ b/bench.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# +# Run a simple benchmark of an initial backup of a sparse file of a +# given size. This mainly measures how fast the client can split the +# live data into chunks and compute checksums for the chunks. +# +# Edit the if-statement towards the end to get a flamegraph to see +# where time is actually spent. +# +# This is very simplistic and could do with a lot of improvement. But it's a start. + +set -euo pipefail + +SIZE=1G + +TMP="$(mktemp -d)" +trap 'rm -rf "$TMP"' EXIT + +chunks="$TMP/chunks" +live="$TMP/live" + +mkdir "$chunks" +mkdir "$live" +truncate --size "$SIZE" "$live/data.dat" + +cat <"$TMP/server.yaml" +address: localhost:8888 +chunks: $chunks +tls_key: test.key +tls_cert: test.pem +EOF + +cat <"$TMP/client.yaml" +server_url: https://localhost:8888 +verify_tls_cert: false +roots: + - $live +log: $TMP/client.log +EOF + +cargo build -q --release --all-targets + +OBNAM_SERVER_LOG=error cargo run -q --release --bin obnam-server -- "$TMP/server.yaml" >/dev/null & +pid="$!" + +cargo run -q --release --bin obnam -- --config "$TMP/client.yaml" init --insecure-passphrase=hunter2 +if true; then + /usr/bin/time cargo run -q --release --bin obnam -- --config "$TMP/client.yaml" backup >/dev/null +else + cargo flamegraph --bin obnam -o obnam.svg -- --config "$TMP/client.yaml" backup >/dev/null +fi + +kill -9 "$pid" -- cgit v1.2.1