boundary/folsom — pull request #25 by russelldb (2012-06-01 14:07:03+00:00)
Title: Add a sliding window sample types for histograms

I got these reviewed using Basho internal process and merged to our fork. If you want me to squash the commits down, let me know.

Also, the tests for the slide and slide_uniform samples are quickcheck tests. They're ifdef'd out so just won't run without eqc installed. I added a standard eunit test for the slide sample, too, for those who won't ever run quickcheck.

Let me know if you don't have quickcheck, or if you want me to try and add a commit so Proper (http://proper.softlab.ntua.gr/) can be used instead.

----

Uses ets to store a reservoir of readings for a sliding window sample.

Uses a gen_server to trim the size of the table every window / 2 seconds.

----

The time to calculate statistics is dependant on the number of samples. On a busy server a sliding window reservoir can end up with a lot of readings (20k ops/sec is 60*20k readings). This PR provides a hybrid sample type that keeps at most N readings per second in the sliding window, using a random uniform sample of the presented readings.