Rippled thread cpu usage
The cpu usage of xrp.ninja validator spikes every 2 hours. I always wonder what it is doing during the spikes. So I wrote a script to report the thead cpu usage to a statsd server. I started statsd/graphite/grafana using https://github.com/ripple/rippledmon Then I wrote this script: #!/usr/bin/python3 import collections import itertools import os import re import statsd import subprocess import time HEADER = b'%CPU COMMAND' STATSD = 'XXX' PORT = 'YYY' PREFIX = 'rippled.threads' TOP = 'env HOME={0} top -b -n 1 -p $(pgrep rippled) -H'.format(os.getcwd()) def report(c, jobs): p = subprocess.run(TOP, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) if p.returncode != 0: print(p.stderr) return m = collections.defaultdict(float) for line in itertools.dropwhile(lambda x: x != HEADER, p.stdout.splitlines()): if line == HEADER: continue usage, comm = line.decode().str...