Posts

Showing posts from April, 2013

High-volume sampling: algorithms’ comparison

Goal : To determine the most efficient way to perform high-volume sampling. Set-up : The sampler's goal is to give permission to sample use a given sampling rate; (approximately) each 1000th request should result in actual sampling. There are several samplers: AtomicSampler: uses AtomicInteger to keep track of sampling attempts;  RandomSampler: uses an instance-wide Random instance to determine if a sample should be taken.  RandomSampler2: uses a local Random instance to determine if a sample should be taken, which is initialized each time.  XorShiftSampler: uses a XOR-Shift algorithm to produce psedo-random numbers ( http://www.javamex.com/tutorials/random_numbers/xorshift.shtml )  Before actual measurement each sampler is called 50K times to warm it up and give a hot-spot compiler a chance to compile the samplers' bytecode into a native high-performance code. Then 10 runs are performed, using a variety of scenarios. 10M sampling attempts are performed d...