2015-01-29 05:46:49 +00:00
|
|
|
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.
|
|
|
|
|
|
|
|
|
2015-01-29 06:10:10 +00:00
|
|
|
## Initializing the database
|
|
|
|
|
|
|
|
Before you run your siege, you need to do 2 things:
|
|
|
|
|
|
|
|
- Create a database named `db`.
|
|
|
|
- Create a retention policy named `raw`.
|
|
|
|
|
|
|
|
You can do this with the following commands:
|
|
|
|
|
|
|
|
```sh
|
|
|
|
$ curl -G http://localhost:8086/query --data-urlencode "q=CREATE DATABASE db"
|
2015-03-12 21:04:36 +00:00
|
|
|
$ curl -G http://localhost:8086/query --data-urlencode "q=CREATE RETENTION POLICY raw ON db DURATION 30d REPLICATION 3 DEFAULT"
|
2015-01-29 06:10:10 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
|
2015-01-29 05:46:49 +00:00
|
|
|
## 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`.
|
|
|
|
|
2015-01-29 06:10:10 +00:00
|
|
|
Next, generate a URL file to run. You can use the `urlgen` utility in this
|
2015-01-29 07:13:57 +00:00
|
|
|
folder to make the file. Simply set the number of unique clients and number of
|
|
|
|
series to generate:
|
2015-01-29 06:10:10 +00:00
|
|
|
|
|
|
|
```sh
|
2015-01-29 07:13:57 +00:00
|
|
|
$ ./urlgen -c 10 -s 100 > urls.txt
|
2015-01-29 06:10:10 +00:00
|
|
|
```
|
2015-01-29 05:46:49 +00:00
|
|
|
|
|
|
|
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
|
2015-01-29 06:10:10 +00:00
|
|
|
will execute writes against using 100 concurrent connections with a 1 second
|
|
|
|
delay in between each call:
|
2015-01-29 05:46:49 +00:00
|
|
|
|
|
|
|
```sh
|
2015-01-29 06:10:10 +00:00
|
|
|
$ siege -c 100 -f urls.txt
|
2015-01-29 05:46:49 +00:00
|
|
|
```
|
2015-01-29 06:10:10 +00:00
|
|
|
|
|
|
|
Again, you can also specify the `-b` option to remove the delay.
|
|
|
|
|
|
|
|
|
|
|
|
## Verification
|
|
|
|
|
|
|
|
You can verify that your data made it in by executing a query against it:
|
|
|
|
|
|
|
|
```sh
|
|
|
|
$ curl -G http://localhost:8086/query --data-urlencode "db=db" --data-urlencode "q=SELECT sum(value) FROM cpu GROUP BY time(1h)"
|
|
|
|
```
|
|
|
|
|