Estimates the performance of a distributed system based on a sample set of data.
- Redis backed.
- It's meant to be simple; pretty much all you get is an increment operation.
This should only be done once, for each performance metric that will be tracked.
guesstimator = Guesstimator()
guesstimator.create_sample_set(
name='sample_set_name',
recording_frequency=0.5
)
- name the name of the sample set.
- recording_frequency how frequently should we actually write the metric to Redis? 0.5 indicates that we will record the metric 50% of the time. 5% is the default.
Once you have created a sample set, workers in the distributed begin recording performance data to it.
Writes will be performed to Redis with the probability set when creating the sample set.
guesstimator = Guesstimator()
guesstimator.record('sample_set_name')
While there are multiple workers, there should be a single reader of performance data. A good use-case might be a Ganglia plugin.
Getting the timestamp and operation count
guesstimator = Guesstimator()
timestamp, operation_count = guesstimator.read('sample_set_name')
- timestamp is the unix time since guesstimator started tracking performance information.
- operation_count the estimated number of operations that have occurred since timestamp.
Reseting timestamp and operation count
guesstimator = Guesstimator()
guesstimator.reset('sample_set_name')
This sets timestamp to the current time, and operation_count back to zero.