Benchmark::MCE on CPAN
I recently refactored the multi-core benchmarking framework I've been using for my Perl CPU benchmark suite (Benchmark::DKbench) and released it as a separate module: Benchmark::MCE.
Why spin it out? Because the harness can do more: it can be used to write custom benchmark suites of any type, generate massively parallel workloads for stress testing, or run throughput benchmarks against services and APIs.
The exact scenario that prompted me was a comparison of Cloud SQL database instances. We wanted to see how a 16-CPU Enterprise Plus instance would compare to a 24-CPU Enterprise instance under heavy load. One way to do that is to write one or more functions that run randomized, typical/heavy queries (e.g. random searches for SpareRoom ads in our case), then use Benchmark::MCE to time them running on dozens of parallel MCE workers to simulate high load:
use Benchmark::MCE;
suite_run({
threads => 64, # Parallel workers
scale => 100, # Workload multiplier (x times to call code)
bench => {
Name1 => sub { ...code1... },
...
});
This is the simplified syntax, but since it was part of a benchmark suite I've been developing for a while now, there are many more features (verifying correctness, iterating stats, single/multi-core scaling etc).
Leave a comment