Skip to content

Commit

Permalink
metrics: storage: add blogbench test
Browse files Browse the repository at this point in the history
Add blogbench as a test that performs a many-file and process
read and write test.

Build the test from source in the Dockerfile, as that is much easier
to install and run that using the phoronix wrapped version.

We could no doubt form a similar test by configuring `fio`, and if
we need we can examine that later.

Fixes: clearcontainers#880

Signed-off-by: Graham whaley <[email protected]>
  • Loading branch information
Graham whaley committed Mar 7, 2018
1 parent e137aac commit 3ae63fd
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfiles/blogbench/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Set up an Ubuntu image with 'blogbench' from the Phoronix testsuite installed
# Set up an Ubuntu image with 'blogbench' installed

FROM ubuntu

Expand Down
71 changes: 71 additions & 0 deletions metrics/storage/blogbench.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/bin/bash
#
# Copyright (c) 2018 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Description of the test:
# This test runs the 'blogbench', and extracts the 'scores' for reads
# and writes
# Note - the scores are *not* normalised for the number of iterations run,
# they are total scores for all iterations (this is the blogbench default output)

set -e

# General env
SCRIPT_PATH=$(dirname "$(readlink -f "$0")")
source "${SCRIPT_PATH}/../lib/common.bash"
TEST_ARGS="$@"

TEST_NAME="blogbench"
IMAGE="local-blogbench"
DOCKERFILE="${SCRIPT_PATH}/../../Dockerfiles/blogbench"

# Number of iterations for blogbench to run - note, results are not
# scaled to iterations - more iterations results in bigger results
ITERATIONS="${ITERATIONS:-10}"

# Directory to run the test on
TESTDIR="${TESTDIR:-/tmp}"
CMD="blogbench -i ${ITERATIONS} -d ${TESTDIR}"

# Check if we have our local image installed, and if not, install it
# from the dockerfile
function local_check_images()
{
local exists=$(docker image inspect $IMAGE > /dev/null; echo $?)

if [ $exists -ne 0 ]; then
docker build --label "$IMAGE" --tag "${IMAGE}:latest" "$DOCKERFILE"
fi
}

function main()
{
cmds=("awk")

init_env
check_cmds "${cmds[@]}"
local_check_images "$IMAGE"

# Run the test...
local output=$(docker run --rm --runtime=$RUNTIME $IMAGE $CMD)

local writes=$(tail -2 <<< "$output" | head -1 | awk '{print $5}')
local reads=$(tail -1 <<< "$output" | awk '{print $6}')

save_results "$TEST_NAME-writes" "$CMD" "$writes" "items"
save_results "$TEST_NAME-reads" "$CMD" "$reads" "items"
}

main "$@"

0 comments on commit 3ae63fd

Please sign in to comment.