Documentation
¶
Overview ¶
heapbench is a simple GC benchmarking utility that allows specifying a garbage generation rate, a rate of leaking, a baseline amount of live memory, and a baseline level of pure CPU work via fake jobs.
The garbage rate is translated into a corresponding amount of garbage generated per job, while the leaking occurs at a constant rate in the background.
Two example invocations:
Pure CPU work without GC work -- here, an average job arrival rate of 100/sec (i.e., 10ms average between job starts), with each job averaging 20ms of CPU wok, and no material memory being allocated. Jobs arriving twice as fast as the quantity of work in each job means this example uses very close to 2 CPU cores on average (e.g., as seen via 'top -d 60' or similar):
heapbench -baseheap=0 -garbagerate=0 -leakrate=0 -jobrate=100 -worktime=20ms
CPU + GC work -- same pure CPU work as prior example, but adding in GC work as well, with a baseline of 128 MB of live memory (memory being held onto), which increases at a rate of 1MB/sec (simulating a leak), and an average of 128 MB/sec of garbage generated (memory created but not held onto). Live memory will start at 128 MB, then creep up by 1 MB every second until the process dies or is stopped.
heapbench -baseheap=128 -garbagerate=128 -leakrate=1 -jobrate=100 -worktime=20ms
The job inter-arrival times and CPU work per job are exponentially distributed (roughly an M/M/N queue with processor sharing), which gives some short timescale variability that yields consistent average rates of CPU usage and garbage generation on longer timescales (e.g., reasonably consistent averages measured over multiple minutes when input job parameters are on order of 10s of milliseconds).
heapbench is primarily meant to be run with job durations that are on the order of 1ms to 100ms. Outside of that range, shorter jobs have more per-job overhead (which can be OK), while longer jobs have more variance over a given measurement interval (which can require more patience for meaningful averages).