mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-11 15:32:39 +00:00
storage: rename the latency key names so they sort properly
This commit is contained in:
parent
bffe14ef3e
commit
c46f5bc634
@ -821,10 +821,11 @@ class StorageServer(service.MultiService, Referenceable):
|
|||||||
def get_latencies(self):
|
def get_latencies(self):
|
||||||
"""Return a dict, indexed by category, that contains a dict of
|
"""Return a dict, indexed by category, that contains a dict of
|
||||||
latency numbers for each category. Each dict will contain the
|
latency numbers for each category. Each dict will contain the
|
||||||
following keys: mean, median, 1_percentile, 10_percentile,
|
following keys: mean, 01_0_percentile, 10_0_percentile,
|
||||||
90_percentile, 95_percentile, 99_percentile, 999_percentile. If no
|
50_0_percentile (median), 90_0_percentile, 95_0_percentile,
|
||||||
samples have been collected for the given category, then that
|
99_0_percentile, 99_9_percentile. If no samples have been collected
|
||||||
category name will not be present in the return value."""
|
for the given category, then that category name will not be present
|
||||||
|
in the return value."""
|
||||||
# note that Amazon's Dynamo paper says they use 99.9% percentile.
|
# note that Amazon's Dynamo paper says they use 99.9% percentile.
|
||||||
output = {}
|
output = {}
|
||||||
for category in self.latencies:
|
for category in self.latencies:
|
||||||
@ -835,13 +836,13 @@ class StorageServer(service.MultiService, Referenceable):
|
|||||||
samples.sort()
|
samples.sort()
|
||||||
count = len(samples)
|
count = len(samples)
|
||||||
stats["mean"] = sum(samples) / count
|
stats["mean"] = sum(samples) / count
|
||||||
stats["1_percentile"] = samples[int(0.01 * count)]
|
stats["01_0_percentile"] = samples[int(0.01 * count)]
|
||||||
stats["10_percentile"] = samples[int(0.1 * count)]
|
stats["10_0_percentile"] = samples[int(0.1 * count)]
|
||||||
stats["median"] = samples[int(0.5 * count)]
|
stats["50_0_percentile"] = samples[int(0.5 * count)]
|
||||||
stats["90_percentile"] = samples[int(0.9 * count)]
|
stats["90_0_percentile"] = samples[int(0.9 * count)]
|
||||||
stats["95_percentile"] = samples[int(0.95 * count)]
|
stats["95_0_percentile"] = samples[int(0.95 * count)]
|
||||||
stats["99_percentile"] = samples[int(0.99 * count)]
|
stats["99_0_percentile"] = samples[int(0.99 * count)]
|
||||||
stats["999_percentile"] = samples[int(0.999 * count)]
|
stats["99_9_percentile"] = samples[int(0.999 * count)]
|
||||||
output[category] = stats
|
output[category] = stats
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
@ -1150,32 +1150,40 @@ class Stats(unittest.TestCase):
|
|||||||
sorted(["allocate", "renew", "cancel", "get"]))
|
sorted(["allocate", "renew", "cancel", "get"]))
|
||||||
self.failUnlessEqual(len(ss.latencies["allocate"]), 1000)
|
self.failUnlessEqual(len(ss.latencies["allocate"]), 1000)
|
||||||
self.failUnless(abs(output["allocate"]["mean"] - 9500) < 1)
|
self.failUnless(abs(output["allocate"]["mean"] - 9500) < 1)
|
||||||
self.failUnless(abs(output["allocate"]["median"] - 9500) < 1)
|
self.failUnless(abs(output["allocate"]["01_0_percentile"] - 9010) < 1)
|
||||||
self.failUnless(abs(output["allocate"]["90_percentile"] - 9900) < 1)
|
self.failUnless(abs(output["allocate"]["10_0_percentile"] - 9100) < 1)
|
||||||
self.failUnless(abs(output["allocate"]["95_percentile"] - 9950) < 1)
|
self.failUnless(abs(output["allocate"]["50_0_percentile"] - 9500) < 1)
|
||||||
self.failUnless(abs(output["allocate"]["99_percentile"] - 9990) < 1)
|
self.failUnless(abs(output["allocate"]["90_0_percentile"] - 9900) < 1)
|
||||||
self.failUnless(abs(output["allocate"]["999_percentile"] - 9999) < 1)
|
self.failUnless(abs(output["allocate"]["95_0_percentile"] - 9950) < 1)
|
||||||
|
self.failUnless(abs(output["allocate"]["99_0_percentile"] - 9990) < 1)
|
||||||
|
self.failUnless(abs(output["allocate"]["99_9_percentile"] - 9999) < 1)
|
||||||
|
|
||||||
self.failUnlessEqual(len(ss.latencies["renew"]), 1000)
|
self.failUnlessEqual(len(ss.latencies["renew"]), 1000)
|
||||||
self.failUnless(abs(output["renew"]["mean"] - 500) < 1)
|
self.failUnless(abs(output["renew"]["mean"] - 500) < 1)
|
||||||
self.failUnless(abs(output["renew"]["median"] - 500) < 1)
|
self.failUnless(abs(output["renew"]["01_0_percentile"] - 10) < 1)
|
||||||
self.failUnless(abs(output["renew"]["90_percentile"] - 900) < 1)
|
self.failUnless(abs(output["renew"]["10_0_percentile"] - 100) < 1)
|
||||||
self.failUnless(abs(output["renew"]["95_percentile"] - 950) < 1)
|
self.failUnless(abs(output["renew"]["50_0_percentile"] - 500) < 1)
|
||||||
self.failUnless(abs(output["renew"]["99_percentile"] - 990) < 1)
|
self.failUnless(abs(output["renew"]["90_0_percentile"] - 900) < 1)
|
||||||
self.failUnless(abs(output["renew"]["999_percentile"] - 999) < 1)
|
self.failUnless(abs(output["renew"]["95_0_percentile"] - 950) < 1)
|
||||||
|
self.failUnless(abs(output["renew"]["99_0_percentile"] - 990) < 1)
|
||||||
|
self.failUnless(abs(output["renew"]["99_9_percentile"] - 999) < 1)
|
||||||
|
|
||||||
self.failUnlessEqual(len(ss.latencies["cancel"]), 10)
|
self.failUnlessEqual(len(ss.latencies["cancel"]), 10)
|
||||||
self.failUnless(abs(output["cancel"]["mean"] - 9) < 1)
|
self.failUnless(abs(output["cancel"]["mean"] - 9) < 1)
|
||||||
self.failUnless(abs(output["cancel"]["median"] - 10) < 1)
|
self.failUnless(abs(output["cancel"]["01_0_percentile"] - 0) < 1)
|
||||||
self.failUnless(abs(output["cancel"]["90_percentile"] - 18) < 1)
|
self.failUnless(abs(output["cancel"]["10_0_percentile"] - 2) < 1)
|
||||||
self.failUnless(abs(output["cancel"]["95_percentile"] - 18) < 1)
|
self.failUnless(abs(output["cancel"]["50_0_percentile"] - 10) < 1)
|
||||||
self.failUnless(abs(output["cancel"]["99_percentile"] - 18) < 1)
|
self.failUnless(abs(output["cancel"]["90_0_percentile"] - 18) < 1)
|
||||||
self.failUnless(abs(output["cancel"]["999_percentile"] - 18) < 1)
|
self.failUnless(abs(output["cancel"]["95_0_percentile"] - 18) < 1)
|
||||||
|
self.failUnless(abs(output["cancel"]["99_0_percentile"] - 18) < 1)
|
||||||
|
self.failUnless(abs(output["cancel"]["99_9_percentile"] - 18) < 1)
|
||||||
|
|
||||||
self.failUnlessEqual(len(ss.latencies["get"]), 1)
|
self.failUnlessEqual(len(ss.latencies["get"]), 1)
|
||||||
self.failUnless(abs(output["get"]["mean"] - 5) < 1)
|
self.failUnless(abs(output["get"]["mean"] - 5) < 1)
|
||||||
self.failUnless(abs(output["get"]["median"] - 5) < 1)
|
self.failUnless(abs(output["get"]["01_0_percentile"] - 5) < 1)
|
||||||
self.failUnless(abs(output["get"]["90_percentile"] - 5) < 1)
|
self.failUnless(abs(output["get"]["10_0_percentile"] - 5) < 1)
|
||||||
self.failUnless(abs(output["get"]["95_percentile"] - 5) < 1)
|
self.failUnless(abs(output["get"]["50_0_percentile"] - 5) < 1)
|
||||||
self.failUnless(abs(output["get"]["99_percentile"] - 5) < 1)
|
self.failUnless(abs(output["get"]["90_0_percentile"] - 5) < 1)
|
||||||
self.failUnless(abs(output["get"]["999_percentile"] - 5) < 1)
|
self.failUnless(abs(output["get"]["95_0_percentile"] - 5) < 1)
|
||||||
|
self.failUnless(abs(output["get"]["99_0_percentile"] - 5) < 1)
|
||||||
|
self.failUnless(abs(output["get"]["99_9_percentile"] - 5) < 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user