Chihuahua is a command line tool which executes golang microbenchmarks and compares them with previous results to determine whether performance is good enough to deploy new changes in your application.
Results of previous executions can be stored with different drivers, for now elasticsearch or directly to filesystem.
go get -u -f github.com/jaimelopez/chihuahua
groupgroup name of metrics to storestoragedriver to store results (elastic/file)destinationstorage destinationfromfiletake results to analyze from file instead running benchmarksdurationtime to execute benchmarks (default 1s)thresholdthreshold percent to determine whether performance is good enough (default 15)saveresults will be saved if are higher than previous onesforceforces to save results even if they are worseresultsprints results as table directly thru standard outputdebugshows traces for debugging
There is a way in which you can specify the output (printed directly to a file) of executed benchmarks so you can take that data instead of executing them via Chihuahua.
Example:
cd application/benchmarks
go test -bench . -run NONE -benchmem > /var/tmp/current-results
chihuahua -group myapp -storage file -destination /var/tmp/benchs -fromfile /var/tmp/current-results -results -save
Destination should be a folder where results will be stored.
A file per group will be generated inside folder.
Notice that folder must exist.
Example:
chihuahua -group myapp -storage file -destination /var/tmp/benchs -results -save
Elastic structure is a bit hardcoded, having 3 different indexes one per metric with the following names:
mygroup-nswith nano-seconds per operation metricmygroup-mallocswith number of allocations per operation metricmygroup-mallocbyteswith total bytes allocated per operation
The structure of each document is:
{
"name-of-benchmark-1": "value",
"name-of-benchmark-2": "value",
"name-of-benchmark-3": "value",
"@timestamp": "2018-07-12 07:07:22.439511876 +0000 UTC"
}Example:
chihuahua -group servicebus -storage elastic -destination https://user:password@locahost:9243 -save
Chihuahua was designed to integrate it within a continous integration tool so it returns different exit codes depending whether performance is good enough (or force is specified) or not.
exit code -1 when error during executing
exit code 0 when everything is ok and performance is good
exit code 1 when performance is not good enough

