1# Influx Stress Tool V2 2 3``` 4$ influx_stress -v2 -config iql/file.iql 5``` 6 7This stress tool works from list of InfluxQL-esque statements. The language has been extended to allow for some basic templating of fields, tags and measurements in both line protocol and query statements. 8 9By default the test outputs a human readable report to `STDOUT` and records test statistics in an active installation of InfluxDB at `localhost:8086`. 10 11To set state variables for the test such as the address of the Influx node use the following syntax: 12 13``` 14# The values listed below are the default values for each of the parameters 15 16# Pipe delineated list of addresses. For cluster: [192.168.0.10:8086|192.168.0.2:8086|192.168.0.3:8086] 17# Queries and writes are round-robin to the configured addresses. 18SET Addresses [localhost:8086] 19 20# False (default) uses http, true uses https 21SET SSL [false] 22 23# Username for targeted influx server or cluster 24SET Username [] 25 26# Password for targeted influx server or cluster 27SET Password [] 28 29# Database to target for queries and writes. Works like the InfluxCLI USE 30SET Database [stress] 31 32# Precision for the data being written 33# Only s and ns supported 34SET Precision [s] 35 36# Date the first written point will be timestamped 37SET StartDate [2016-01-01] 38 39# Size of batches to send to InfluxDB 40SET BatchSize [5000] 41 42# Time to wait between sending batches 43SET WriteInterval [0s] 44 45# Time to wait between sending queries 46SET QueryInterval [0s] 47 48# Number of concurrent writers 49SET WriteConcurrency [15] 50 51# Number of concurrent readers 52SET QueryConcurrency [5] 53``` 54 55The values in the example are also the defaults. 56 57Valid line protocol will be forwarded right to the server making setting up your testing environment easy: 58 59``` 60CREATE DATABASE thing 61 62ALTER RETENTION POLICY default ON thing DURATION 1h REPLICATION 1 63 64SET database [thing] 65``` 66 67You can write points like this: 68``` 69INSERT mockCpu 70cpu, 71host=server-[int inc(0) 10000],location=[string rand(8) 1000] 72value=[float rand(1000) 0] 73100000 10s 74 75Explained: 76 77# INSERT keyword kicks off the statement, next to it is the name of the statement for reporting and templated query generation 78INSERT mockCpu 79# Measurement 80cpu, 81# Tags - separated by commas. Tag values can be templates, mixed template and fixed values 82host=server-[float rand(100) 10000],location=[int inc(0) 1000],fixed=[fix|fid|dor|pom|another_tag_value] 83# Fields - separated by commas either templates, mixed template and fixed values 84value=[float inc(0) 0] 85# 'Timestamp' - Number of points to insert into this measurement and the amount of time between points 86100000 10s 87``` 88 89Each template contains 3 parts: a datatype (`str`, `float`, or `int`) a function which describes how the value changes between points: `inc(0)` is increasing and `rand(n)` is a random number between `0` and `n`. The last number is the number of unique values in the tag or field. `0` is unbounded. To make a tag 90 91To run multiple insert statements at once: 92``` 93GO INSERT devices 94devices, 95city=[str rand(8) 10],country=[str rand(8) 25],device_id=[str rand(10) 1000] 96lat=[float rand(90) 0],lng=[float rand(120) 0],temp=[float rand(40) 0] 9710000000 10s 98 99GO INSERT devices2 100devices2, 101city=[str rand(8) 10],country=[str rand(8) 25],device_id=[str rand(10) 1000] 102lat=[float rand(90) 0],lng=[float rand(120) 0],temp=[float rand(40) 0] 10310000000 10s 104 105WAIT 106``` 107 108Fastest point generation and write load requires 3-4 running `GO INSERT` statements at a time. 109 110You can run queries like this: 111 112``` 113QUERY cpu 114SELECT mean(value) FROM cpu WHERE host='server-1' 115DO 1000 116``` 117 118### Output: 119Output for config file in this repo: 120``` 121[√] "CREATE DATABASE thing" -> 1.806785ms 122[√] "CREATE DATABASE thing2" -> 1.492504ms 123SET Database = 'thing' 124SET Precision = 's' 125Go Write Statement: mockCpu 126 Points/Sec: 245997 127 Resp Time Average: 173.354445ms 128 Resp Time Standard Deviation: 123.80344ms 129 95th Percentile Write Response: 381.363503ms 130 Average Request Bytes: 276110 131 Successful Write Reqs: 20 132 Retries: 0 133Go Query Statement: mockCpu 134 Resp Time Average: 3.140803ms 135 Resp Time Standard Deviation: 2.292328ms 136 95th Percentile Read Response: 5.915437ms 137 Query Resp Bytes Average: 16 bytes 138 Successful Queries: 10 139WAIT -> 406.400059ms 140SET DATABASE = 'thing2' 141Go Write Statement: devices 142 Points/Sec: 163348 143 Resp Time Average: 132.553789ms 144 Resp Time Standard Deviation: 149.397972ms 145 95th Percentile Write Response: 567.987467ms 146 Average Request Bytes: 459999 147 Successful Write Reqs: 20 148 Retries: 0 149Go Write Statement: devices2 150 Points/Sec: 160078 151 Resp Time Average: 133.303097ms 152 Resp Time Standard Deviation: 144.352404ms 153 95th Percentile Write Response: 560.565066ms 154 Average Request Bytes: 464999 155 Successful Write Reqs: 20 156 Retries: 0 157Go Query Statement: fooName 158 Resp Time Average: 1.3307ms 159 Resp Time Standard Deviation: 640.249µs 160 95th Percentile Read Response: 2.668ms 161 Query Resp Bytes Average: 16 bytes 162 Successful Queries: 10 163WAIT -> 624.585319ms 164[√] "DROP DATABASE thing" -> 991.088464ms 165[√] "DROP DATABASE thing2" -> 421.362831ms 166``` 167 168### Next Steps: 169 170##### Documentation 171- Parser behavior and proper `.iql` syntax 172- How the templated query generation works 173- Collection of tested `.iql` files to simulate different loads 174 175##### Performance 176- `Commune`, a stuct to enable templated Query generation, is blocking writes when used, look into performance. 177- Templated query generation is currently in a quazi-working state. See the above point. 178