Created
August 18, 2016 04:31
-
-
Save mark-rushakoff/dfd1141d0a61dbc302c69af72d4997de to your computer and use it in GitHub Desktop.
Simple micro-load generator for InfluxDB using docker-compose
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
url=http://influxdb:8086 | |
db=loadtest_$RANDOM | |
set -e | |
curl -s -XPOST "$url/query?" --data-urlencode "q=CREATE DATABASE $db WITH DURATION 1h SHARD DURATION 10s" > /dev/null | |
write_and_test() { | |
local series=$1 | |
local n=$2 | |
local point="ctr,s=$series n=$n" | |
curl -s -XPOST "$url/write?db=$db" --data-binary "$point" > /dev/null | |
local query="SELECT last(n) FROM ctr WHERE s='$series'" | |
curl -s "$url/query?db=$db" --data-urlencode "q=$query" > /dev/null | |
} | |
n=0 | |
while true; do | |
n=$((n+1)) | |
for series in $(seq 10); do | |
write_and_test $series $n | |
done | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2' | |
services: | |
influxdb: | |
environment: | |
INFLUXDB_HTTP_LOG_ENABLED: "false" | |
INFLUXDB_DATA_QUERY_LOG_ENABLED: "false" | |
image: influxdb:1.0.0-beta3-alpine | |
ports: | |
- 8086 | |
client: | |
build: | |
context: . | |
dockerfile: Dockerfile_client | |
links: | |
- influxdb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine:latest | |
RUN apk add --no-cache \ | |
bash \ | |
curl | |
COPY ./client.sh /client.sh | |
CMD ["/client.sh"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment