package
0.13.0
Repository: https://github.com/tencentblueking/influxdb.git
Documentation: pkg.go.dev

# README

influx_stress usage and configuration

The binary for influx_stress comes bundled with all influx installations. To run it against an influxd instance located at localhost:8086 with the default configuration options:

See more about the default configuration options

$ influx_stress

To run influx_stress with a configuration file:

$ influx_stress -config my_awesome_test.toml

To daemonize influx_stress and save the output to a results file:

$ influx_stress -config my_awesome_test.toml > my_awesome_test_out.txt 2>&1 &

To run multiple instances of influx_stress just change the measurement each test writes to, details below

$ influx_stress -config my_awesome_test1.toml > my_awesome_test_out1.txt 2>&1 &
$ influx_stress -config my_awesome_test2.toml > my_awesome_test_out2.txt 2>&1 &

Below is a sample configuration file with comments explaining the different options

# The [provision] section creates a new database on the target instance for the stress test to write points to and perform queries against
# This section can be deleted if the instance is manually configured. In that case make sure that the database referenced in [write] exists
# The provisioner will try to delete the database before trying to recreate it.

[provision]
  [provision.basic]
    # If set to false you can delete this section from the config
    enabled = true
    # address of the node to be provisioned
    address = "<node1_ip>:8086"
    # name of the database to create
    database = "stress"
    # This must be set to true
    reset_database = true

# The [write] section defines the shape of the generated data and configures the InfluxDB client
[write]
  # The [write.point_generator] defines the shape of the generated data
  [write.point_generator]
    [write.point_generator.basic]
      # This needs to be set to true
      enabled = true
      # The total number of points a stress_test will write is determined by multiplying the following two numbers:
      # point_count * series_count = total_points
      # Number of points to write to the database for each series
      point_count = 100
      # Number of series to write to the database?
      series_count = 100000
      # This simulates collection interval in the timestamps of generated points
      tick = "10s"
      # This must be set to true
      jitter = true
      # The measurement name for the generated points
      measurement = "cpu"
      # The generated timestamps follow the pattern of { start_date + (n * tick) }
      # This sequence is preserved for each series and is always increasing
      start_date = "2006-Jan-02"
      # Precision for generated points
      # This setting MUST be the same as [write.influx_client.basic]precision
      precision = "s"
      # The '[[]]' in toml format indicates that the element is an array of items. 
      # [[write.point_generator.basic.tag]] defines a tag on the generated points
      # key is the tag key
      # value is the tag value
      # The first tag defined will have '-0' through '-{series_count}' added to the end of the string
      [[write.point_generator.basic.tag]]
        key = "host"
        value = "server"
      [[write.point_generator.basic.tag]]
        key = "location"
        value = "us-west"
      # [[write.point_generator.basic.field]] defines a field on the generated points
      # key is the field key
      # value is the type of the field
      [[write.point_generator.basic.field]]
        key = "value"
        # Can be either "float64", "int", "bool"
        value = "float64"

  # The [write.influx_client] defines what influx instances the stress_test targets
  [write.influx_client]
    [write.influx_client.basic]
      # This must be set to true
      enabled = true
      # This is an array of addresses
      # addresses = ["<node1_ip>:8086","<node2_ip>:8086","<node3_ip>:8086"] to target a cluster
      addresses = ["<node1_ip>:8086"] # to target an individual node 
      # This database in the in the target influx instance to write to
      # This database MUST be created in the target instance or the test will fail
      database = "stress"
      # Write precision for points
      # This setting MUST be the same as [write.point_generator.basic]precision
      precision = "s"
      # The number of point to write to the database with each POST /write sent
      batch_size = 5000
      # An optional amount of time for a worker to wait between POST requests
      batch_interval = "0s"
      # The number of workers to use to write to the database
      # More workers == more load with diminishing returns starting at ~5 workers
      # 10 workers provides a medium-high level of load to the database
      concurrency = 10
      # This must be set to false
      ssl = false
      # This must be set to "line_http"
      format = "line_http"

# Packages

No description provided by the author

# Functions

BasicStress returns a config for a basic stress test.
DecodeConfig takes a file path for a toml config file and returns a pointer to a Config Struct.
DecodeFile takes a file path for a toml config file and returns a pointer to a Config Struct.
No description provided by the author
NewConcurrencyLimiter returns a configured limiter that will ensure that calls to Increment will block if the max is hit.
NewConfig returns a pointer to a Config.
No description provided by the author
NewQuerier returns a Querier.
NewResponseTime returns a new response time with value `v` and time `time.Now()`.
NewStressTest returns an instance of a StressTest.
NewTimer returns a pointer to a `Timer` struct where the timers `start` field has been set to `time.Now()`.
NewWriter returns a Writer.

# Structs

AbstractField is a struct that abstractly defines a field.
AbstractTag is a struct that abstractly defines a tag.
BasicClient implements the InfluxClient interface.
BasicPointGenerator implements the PointGenerator interface.
BasicProvisioner implements the Provisioner interface.
BasicQuery implements the QueryGenerator interface.
BasicQueryClient implements the QueryClient interface.
No description provided by the author
ConcurrencyLimiter is a go routine safe struct that can be used to ensure that no more than a specifid max number of goroutines are executing.
Config is a struct for the Stress test configuration.
InfluxClients is a struct that contains the configuration parameters for all implemented InfluxClient's.
KeyValue is an intermediate type that is used to express Tag and Field similarly.
Pnt is a struct that implements the Point interface.
PointGenerators is a struct that contains the configuration parameters for all implemented PointGenerator's.
Provision is a struct that contains the configuration parameters for all implemented Provisioner's.
Querier queries the database.
QueryClients is a struct that contains the configuration parameters for all implemented QueryClient's.
QueryGenerators is a struct that contains the configuration parameters for all implemented QueryGenerator's.
QueryResponse is a response for a Querier.
Read is a struct that contains the configuration parameters for the stress test Reader.
ResponseTime is a struct that contains `Value` `Time` pairing.
StdPoint represents a point in InfluxDB.
StressTest is a struct that contains all of the logic required to execute a Stress Test.
Timer is struct that can be used to track elaspsed time.
Write is a struct that contains the configuration parameters for the stress test Writer.
Writer is a PointGenerator and an InfluxClient.

# Interfaces

InfluxClient is an interface for writing data to the database.
Point is an interface that is used to represent the abstract idea of a point in InfluxDB.
PointGenerator is an interface for generating points.
Provisioner is an interface that provisions an InfluxDB instance.
QueryClient is an interface that can write a query to an InfluxDB instance.
QueryGenerator is an interface that is used to define queries that will be ran on the DB.

# Type aliases

AbstractFields is a slice of abstract fields.
AbstractTags is a slice of abstract tags.
Field is a struct for a field in influxdb.
Fields is an slice of all the fields for a point.
Query is query.
ResponseTimes is a slice of response times.
Tag is a struct for a tag in influxdb.
Tags is an slice of all the tags for a point.
WriteResponse is a response for a Writer.