Giter VIP home page Giter VIP logo

fio-in-kubernetes's Introduction

Disk IO tests with fio in Kubernetes

This repository has a set of tools to build and optionally run fio in Kubernetes pods

Get The Binary

You can skip the build and download the pre-built binary directly from

  • x86_64
# Get file and make it executable
curl -L https://eldada.jfrog.io/artifactory/tools/fio/3.36/fio-linux-x86_64 -o ./fio
chmod +x fio

# Test it works
./fio --version
  • ARM
# Get file and make it executable
curl -L https://eldada.jfrog.io/artifactory/tools/fio/3.36/fio-linux-arm64 -o ./fio
chmod +x fio

# Test it works
./fio --version

Build of Install fio in a Kubernetes pod

Build fio from sources

Building fio requires the same processor architecture of the server you'll be running the tests on.
This repository includes two pods templates that deploy to the current Kubernetes cluster and are assigned to a node with the desired architecture.
The pod comes up and

  1. Installs the needed tools
  2. Clones the official fio sources (https://github.com/axboe/fio)
  3. Compiles and builds fio (with --build-static so you have the dependencies built into the binary)

Once built, you can then copy the fio binary from the pod and take it anywhere.

Install fio

If you just want fio in the pod, you can just set the environment variable BUILD_OR_INSTALL in the yamls to install and deploy.
This will install fio with apt.

Deploy the pods with the following commands.
Make sure to set affinity and toleration rules as needed to make sure you get the right architecture binary built.

export NAMESPACE=0-fio-build

kubectl create namespace ${NAMESPACE}

kubectl apply -n ${NAMESPACE} -f fio-x86_64.yaml

kubectl apply -n ${NAMESPACE} -f fio-arm64.yaml

Follow the pods logs to see the progress and get the command to copy the binary to your computer if needed

kubectl logs -n ${NAMESPACE} pod-fio-x86-64 -f

kubectl logs -n ${NAMESPACE} pod-fio-arm64 -f

Run the IO tests in the pods

You can run fio directly in the pods and get the Kubernetes node's local disk tested using the pods that were just deployed.
You can test an externally mounted volume be setting the --filename parameter to the mounted volume in the pod.

See the official fio website for all the available options and parameters.

The examples below runs in the running x86_64 pod. It uses json output, 10 concurrent jobs, 1mb block size, and saves the output in a local file for analysis later

mkdir -p out

# Sequential reads for 30 seconds
kubectl exec -n ${NAMESPACE} pod-fio-x86-64 -- fio --name=test --output-format=json --filename=/tmp/test.fio --size=2g --runtime=30s --ioengine=libaio --rw=read --direct=1 --numjobs=10 --blocksize=1m > out/read.json

# Sequential writes for 30 seconds
kubectl exec -n ${NAMESPACE} pod-fio-x86-64 -- fio --name=test --output-format=json --filename=/tmp/test.fio --size=2g --runtime=30s --ioengine=libaio --rw=write --direct=1 --numjobs=10 --blocksize=1m > out/write.json

# Random read/write for 30 seconds
kubectl exec -n ${NAMESPACE} pod-fio-x86-64 -- fio --name=test --output-format=json --filename=/tmp/test.fio --size=2g --runtime=30s --ioengine=libaio --rw=randrw --direct=1 --numjobs=10 --blocksize=1m > out/randrw.json

Extract the MBPS (MegaBytes per seconds) from the output json (using jq)

# Reads average MBPS from the 10 jobs results
jq '[.jobs[] | .read.io_bytes] | add/1024/1024' out/read.json

# Writes average MBPS from the 10 jobs results
jq '[.jobs[] | .write.io_bytes] | add/1024/1024' out/write.json

# Reads average MBPS from the 10 jobs results out of the RW tests
jq '[.jobs[] | .read.io_bytes] | add/1024/1024' out/randrw.json

# Writes average MBPS from the 10 jobs results out of the RW tests
jq '[.jobs[] | .write.io_bytes] | add/1024/1024' out/randrw.json

fio-in-kubernetes's People

Contributors

eldada avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.