add 1%,10% percentiles to the storage server latency output

This commit is contained in:
Brian Warner 2008-07-11 21:34:36 -07:00
parent f303670265
commit bffe14ef3e

View File

@ -821,10 +821,10 @@ 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, 90_percentile, 95_percentile, following keys: mean, median, 1_percentile, 10_percentile,
99_percentile). If no samples have been collected for the given 90_percentile, 95_percentile, 99_percentile, 999_percentile. If no
category, then that category name will not be present in the return samples have been collected for the given category, then that
value.""" 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,6 +835,8 @@ 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["10_percentile"] = samples[int(0.1 * count)]
stats["median"] = samples[int(0.5 * count)] stats["median"] = samples[int(0.5 * count)]
stats["90_percentile"] = samples[int(0.9 * count)] stats["90_percentile"] = samples[int(0.9 * count)]
stats["95_percentile"] = samples[int(0.95 * count)] stats["95_percentile"] = samples[int(0.95 * count)]