diff --git a/tests/siege/.gitignore b/tests/siege/.gitignore new file mode 100644 index 0000000000..057e4a7fee --- /dev/null +++ b/tests/siege/.gitignore @@ -0,0 +1 @@ +urls.txt diff --git a/tests/siege/README.md b/tests/siege/README.md new file mode 100644 index 0000000000..e6afbfaf82 --- /dev/null +++ b/tests/siege/README.md @@ -0,0 +1,33 @@ +Siege +===== + +Siege is an HTTP benchmarking tool and can be used against InfluxDB easily. +If you're on Mac you can install `siege` using `brew`. If you're on Linux +you can install using your package manager. + + +## Running + +To run siege, first start one or more InfluxDB nodes. At least one of those +nodes should run on the default port of `8086`. + +Next, choose a URL file to run. The URL files are named based on their series +cardinality. For example, `series.10.txt` has 10 unique series. + +Now you can execute siege. There are several arguments available but only +a few that we're concerned with: + +``` +-c NUM the number of concurrent connections. +-d NUM delay between each request, in seconds. +-b benchmark mode. runs with a delay of 0. +-t DUR duration of the benchmark. value should end in 's', 'm', or 'h'. +-f FILE the path to the URL file. +``` + +These can be combined to simulate different load. For example, this command +will execute writes against 10 unique series using 100 concurrent connections: + +```sh +$ siege -c 100 -f series.10.txt +``` diff --git a/tests/siege/urlgen b/tests/siege/urlgen new file mode 100755 index 0000000000..193f1ba219 --- /dev/null +++ b/tests/siege/urlgen @@ -0,0 +1,59 @@ +#!/bin/sh -e + +# Calculate start time as unix timestamp. +TIME=`date -j -f "%b %d %T %Z %Y" "Jan 01 00:00:00 EDT 2000" "+%s"` + +# Set defaults. +INTERVAL=10 +NUMSERIES=1 +NUMPOINTS=100 + +# Parse arguments +while getopts "s:p:i:h" opt; do + case $opt in + i) + INTERVAL=$OPTARG + ;; + s) + NUMSERIES=$OPTARG + ;; + p) + NUMPOINTS=$OPTARG + ;; + h) + echo "urlgen is a utility for generating URL files for siege." + echo "" + echo "Usage:" + echo " urlgen.sh [OPTIONS]" + echo "" + echo "The following arguments can be specified:" + echo "" + echo " -i seconds" + echo " Interval between generated points per series." + echo "" + echo " -s num" + echo " Number of unique series to generate." + echo "" + echo " -p num" + echo " Number of points per series to generate." + echo "" + exit 1 + ;; + esac +done + +# Generate a new value every interval per series. +for i in `seq 1 $NUMPOINTS`; +do + # Move forward the current time. + let TIME=TIME+INTERVAL + TIMESTAMP=`date -j -f "%s" $TIME +"%Y-%m-%dT%H:%M:%SZ"` + + # Generate a URL for each series. + for series in `seq 1 $NUMSERIES`; + do + echo 'http://localhost:8086/write POST {"database" : "db", "retentionPolicy" : "raw", "points": [{"name": "cpu", "tags": {"host": "server'$series'"}, "timestamp": "'$TIMESTAMP'","values": {"value": 100}}]}' + done +done + +