Commit 54f5ab37 authored by Janek Bevendorff's avatar Janek Bevendorff

Add OSD benchmark analyzer

parent 9f4168b5
......@@ -21,7 +21,9 @@ setuptools.setup(
import re
import click
import pandas as pd
import plotly.graph_objects as go
from plotly.subplots import make_subplots
def osd():
"""Ceph OSD tools."""
@osd.command() # Note: it's test, not click!
@click.argument('bench_output', type=click.File()) # Here it's click again
def analyze_bench(bench_output):
"""Analyze `ceph tell 'osd.*' bench` output."""
bench_data =
bench_data = re.sub(r'(osd.\d+):', r',"\1":', bench_data).lstrip(',')
bench_data = ''.join(('{', bench_data, '}'))
df = pd.read_json(bench_data).transpose()
df['bytes_written'] = df['bytes_written'].div(1024 ** 2)
df['bytes_per_sec'] = df['bytes_per_sec'].div(1024 ** 2)
df.rename(columns={'bytes_written': 'mb_written', 'bytes_per_sec': 'mb_per_sec'}, inplace=True)
df.sort_values('mb_per_sec', ascending=False, inplace=True)
fig = make_subplots(specs=[[{"secondary_y": True}]])
fig.update_yaxes(title_text="MB/s", secondary_y=False)
fig.update_yaxes(title_text="IOPS", secondary_y=True)
fig.add_trace(go.Box(y=df['mb_per_sec'], name='Throughput'))
fig.add_trace(go.Box(y=df['iops'], name='IOPS'), secondary_y=True)
with pd.option_context('display.max_rows', None):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment