|
| 1 | +#!/bin/bash |
| 2 | +# vim: ts=8 sw=2 smarttab |
| 3 | +set -ex |
| 4 | + |
| 5 | +# Install FIO |
| 6 | +if [[ -f /etc/debian_version ]]; then |
| 7 | + sudo apt-get update |
| 8 | + sudo apt-get install -y git gcc make librados-dev librbd-dev zlib1g-dev libaio-dev |
| 9 | + git clone -b master https://github.com/axboe/fio.git /home/ubuntu/cephtest/fio |
| 10 | + cd /home/ubuntu/cephtest/fio |
| 11 | + ./configure |
| 12 | + make |
| 13 | + sudo make install |
| 14 | + cd - |
| 15 | +elif [[ -f /etc/redhat-release ]]; then |
| 16 | + sudo yum install -y fio |
| 17 | +else |
| 18 | + echo "Unsupported OS" |
| 19 | + exit 1 |
| 20 | +fi |
| 21 | + |
| 22 | +sleep 10 |
| 23 | + |
| 24 | +ceph config set osd osd_memory_target 939524096 |
| 25 | +ceph config set osd bluestore_onode_segment_size 0 |
| 26 | +ceph osd erasure-code-profile set myecprofile k=2 m=1 |
| 27 | +ceph osd pool create ecpool 16 16 erasure myecprofile |
| 28 | +ceph osd pool set ecpool allow_ec_overwrites true |
| 29 | + |
| 30 | +status_log() { |
| 31 | + echo "Cluster status on failure:" |
| 32 | + ceph -s |
| 33 | + ceph health detail |
| 34 | +} |
| 35 | + |
| 36 | +cleanup() { |
| 37 | + ceph osd pool rm ecpool ecpool --yes-i-really-really-mean-it || true |
| 38 | + ceph osd erasure-code-profile rm myecprofile || true |
| 39 | + rm -rf /home/ubuntu/cephtest/fio || true |
| 40 | + status_log |
| 41 | +} |
| 42 | + |
| 43 | +trap cleanup EXIT INT TERM |
| 44 | + |
| 45 | +echo "[ec-esb-fio] Starting FIO test..." |
| 46 | + |
| 47 | + |
| 48 | +fio --name=test-ec-esb \ |
| 49 | + --ioengine=rados \ |
| 50 | + --pool=ecpool \ |
| 51 | + --clientname=admin \ |
| 52 | + --conf=/etc/ceph/ceph.conf \ |
| 53 | + --time_based=1 \ |
| 54 | + --runtime=1h \ |
| 55 | + --invalidate=0 \ |
| 56 | + --direct=1 \ |
| 57 | + --touch_objects=0 \ |
| 58 | + --iodepth=32 \ |
| 59 | + --numjobs=4 \ |
| 60 | + --rw=randwrite \ |
| 61 | + --file_service_type=pareto:0.20:0 \ |
| 62 | + --bssplit=4k/16:8k/10:12k/9:16k/8:20k/7:24k/7 \ |
| 63 | + --size=15G \ |
| 64 | + --nrfiles=12500 \ |
| 65 | + --filename_format=stress_obj.\$jobnum.\$filenum \ |
| 66 | + & |
| 67 | + |
| 68 | +FIO_PID=$! |
| 69 | + |
| 70 | +ceph config dump | grep bluestore_elastic_shared_blobs || true |
| 71 | +ceph config dump | grep bluestore_onode_segment_size || true |
| 72 | +ceph osd dump | grep -A 10 ecpool || true |
| 73 | + |
| 74 | + |
| 75 | +TIMEOUT=3600 |
| 76 | +START_TIME=$(date +%s) |
| 77 | +while true; do |
| 78 | + CURRENT_TIME=$(date +%s) |
| 79 | + ELAPSED=$((CURRENT_TIME - START_TIME)) |
| 80 | + if [ $ELAPSED -ge $TIMEOUT ]; then |
| 81 | + echo "Reached 1-hour timeout, stopping FIO" |
| 82 | + break |
| 83 | + fi |
| 84 | + if ceph health detail | grep -i "osd.*down"; then |
| 85 | + echo "Detected OSD down state:" |
| 86 | + ceph health detail | grep -i "osd.*down" |
| 87 | + echo "Cleaning up..." |
| 88 | + if [[ -n "$FIO_PID" ]]; then |
| 89 | + kill -9 $FIO_PID || true |
| 90 | + fi |
| 91 | + exit 1 |
| 92 | + fi |
| 93 | + ceph -s |
| 94 | + ceph tell osd.0 perf dump bluestore | grep -A 2 onode || true |
| 95 | + sleep 60 |
| 96 | +done |
| 97 | + |
| 98 | +echo "[ec-esb-fio] FIO test completed, log checks to follow" |
| 99 | +exit 0 |
0 commit comments