Created
June 3, 2022 15:49
-
-
Save yuvalif/076793655f101737de939dbe0e9164c1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# assuming we are running a vstart cluster | |
import subprocess | |
import time | |
import sys | |
def system(cmd): | |
output = subprocess.check_output(cmd, shell=True).decode(sys.stdout.encoding).strip() | |
return output | |
prev_rgw_sum = 0 | |
prev_count = 0 | |
while True: | |
pid = system('pgrep radosgw | head -1') | |
cpu = system('top -p '+pid+' -b -n 1 | ag radosgw | awk \'{print $9}\'') | |
qlen = system('./bin/ceph --admin-daemon out/radosgw.8000.asok perf dump 2>/dev/null | jq .rgw.qlen') | |
obj_lat_sum = float(system('./bin/ceph --admin-daemon out/radosgw.8000.asok perf dump 2>/dev/null | jq .objecter.op_latency.sum')) | |
obj_inflight = int(system('./bin/ceph --admin-daemon out/radosgw.8000.asok perf dump 2>/dev/null | jq .objecter.op_inflight')) | |
lat_count = int(system('./bin/ceph --admin-daemon out/radosgw.8000.asok perf dump 2>/dev/null | jq .rgw.put_initial_lat.avgcount')) | |
lat_sum = float(system('./bin/ceph --admin-daemon out/radosgw.8000.asok perf dump 2>/dev/null | jq .rgw.put_initial_lat.sum')) | |
rgw_sum = lat_sum - obj_lat_sum | |
diff_sum = rgw_sum - prev_rgw_sum | |
diff_count = lat_count - prev_count | |
if diff_count == 0: | |
latency = 0.0 | |
else: | |
latency = diff_sum/diff_count | |
prev_rgw_sum = rgw_sum | |
prev_count = lat_count | |
print(qlen, '%.4f'%latency, cpu, obj_inflight) | |
time.sleep(5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment