public class TimerBenchmark
Microbenchmarks for default and improved (fast) Codahale timers.
build project from command line (mvn clean install).
Specify argument "TimerBenchmark" to only run this benchmark.
Tests the performance of (concurrent) timer updates.
Note that test duration must exceed TIME_WINDOW (default: 60) to trigger
FastTimer's housekeeping. Manual tests show little performance difference
for longer running tests (since housekeeping is infrequent and cheap), so
we keep the test duration low to not have tests run for too long.
Tests the performance of (concurrent) timer updates with
the creation of snapshots. We expect snapshot creation to
be infrequent (e.g. once every N seconds), while timer updates
are frequent (for many timers hundreds or thousands of times
per second). Here we're testing the creation of snapshots at
a rate much higher than we would expect in real life.
public static void main(java.lang.String args)
Test routing for manual testing of memory footprint of default Codahale Timer vs. improved FastTimer.
JMH can't do that, so we have a small stand-alone test routine here.
Run with: java -Xmx1g -cp target/benchmarks.jar org.apache.bookkeeper.stats.codahale.TimerBenchmark