| 1 | # Influx Stress Tool V2 |
| 2 | |
| 3 | ``` |
| 4 | $ influx_stress -v2 -config iql/file.iql |
| 5 | ``` |
| 6 | |
| 7 | This 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 | |
| 9 | By default the test outputs a human readable report to `STDOUT` and records test statistics in an active installation of InfluxDB at `localhost:8086`. |
| 10 | |
| 11 | To 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. |
| 18 | SET Addresses [localhost:8086] |
| 19 | |
| 20 | # False (default) uses http, true uses https |
| 21 | SET SSL [false] |
| 22 | |
| 23 | # Username for targeted influx server or cluster |
| 24 | SET Username [] |
| 25 | |
| 26 | # Password for targeted influx server or cluster |
| 27 | SET Password [] |
| 28 | |
| 29 | # Database to target for queries and writes. Works like the InfluxCLI USE |
| 30 | SET Database [stress] |
| 31 | |
| 32 | # Precision for the data being written |
| 33 | # Only s and ns supported |
| 34 | SET Precision [s] |
| 35 | |
| 36 | # Date the first written point will be timestamped |
| 37 | SET StartDate [2016-01-01] |
| 38 | |
| 39 | # Size of batches to send to InfluxDB |
| 40 | SET BatchSize [5000] |
| 41 | |
| 42 | # Time to wait between sending batches |
| 43 | SET WriteInterval [0s] |
| 44 | |
| 45 | # Time to wait between sending queries |
| 46 | SET QueryInterval [0s] |
| 47 | |
| 48 | # Number of concurrent writers |
| 49 | SET WriteConcurrency [15] |
| 50 | |
| 51 | # Number of concurrent readers |
| 52 | SET QueryConcurrency [5] |
| 53 | ``` |
| 54 | |
| 55 | The values in the example are also the defaults. |
| 56 | |
| 57 | Valid line protocol will be forwarded right to the server making setting up your testing environment easy: |
| 58 | |
| 59 | ``` |
| 60 | CREATE DATABASE thing |
| 61 | |
| 62 | ALTER RETENTION POLICY default ON thing DURATION 1h REPLICATION 1 |
| 63 | |
| 64 | SET database [thing] |
| 65 | ``` |
| 66 | |
| 67 | You can write points like this: |
| 68 | ``` |
| 69 | INSERT mockCpu |
| 70 | cpu, |
| 71 | host=server-[int inc(0) 10000],location=[string rand(8) 1000] |
| 72 | value=[float rand(1000) 0] |
| 73 | 100000 10s |
| 74 | |
| 75 | Explained: |
| 76 | |
| 77 | # INSERT keyword kicks off the statement, next to it is the name of the statement for reporting and templated query generation |
| 78 | INSERT mockCpu |
| 79 | # Measurement |
| 80 | cpu, |
| 81 | # Tags - separated by commas. Tag values can be templates, mixed template and fixed values |
| 82 | host=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 |
| 84 | value=[float inc(0) 0] |
| 85 | # 'Timestamp' - Number of points to insert into this measurement and the amount of time between points |
| 86 | 100000 10s |
| 87 | ``` |
| 88 | |
| 89 | Each 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 | |
| 91 | To run multiple insert statements at once: |
| 92 | ``` |
| 93 | GO INSERT devices |
| 94 | devices, |
| 95 | city=[str rand(8) 10],country=[str rand(8) 25],device_id=[str rand(10) 1000] |
| 96 | lat=[float rand(90) 0],lng=[float rand(120) 0],temp=[float rand(40) 0] |
| 97 | 10000000 10s |
| 98 | |
| 99 | GO INSERT devices2 |
| 100 | devices2, |
| 101 | city=[str rand(8) 10],country=[str rand(8) 25],device_id=[str rand(10) 1000] |
| 102 | lat=[float rand(90) 0],lng=[float rand(120) 0],temp=[float rand(40) 0] |
| 103 | 10000000 10s |
| 104 | |
| 105 | WAIT |
| 106 | ``` |
| 107 | |
| 108 | Fastest point generation and write load requires 3-4 running `GO INSERT` statements at a time. |
| 109 | |
| 110 | You can run queries like this: |
| 111 | |
| 112 | ``` |
| 113 | QUERY cpu |
| 114 | SELECT mean(value) FROM cpu WHERE host='server-1' |
| 115 | DO 1000 |
| 116 | ``` |
| 117 | |
| 118 | ### Output: |
| 119 | Output for config file in this repo: |
| 120 | ``` |
| 121 | [√] "CREATE DATABASE thing" -> 1.806785ms |
| 122 | [√] "CREATE DATABASE thing2" -> 1.492504ms |
| 123 | SET Database = 'thing' |
| 124 | SET Precision = 's' |
| 125 | Go 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 |
| 133 | Go 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 |
| 139 | WAIT -> 406.400059ms |
| 140 | SET DATABASE = 'thing2' |
| 141 | Go 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 |
| 149 | Go 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 |
| 157 | Go 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 |
| 163 | WAIT -> 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. |