Package to generate InfluxDB Line Protocol and send it over network.
UDP is a lossy protocol, meaning that any packets not processed fast enough will be dropped. This means that we can measure performance by sending lines to the receiver as fast as possible and just see how many are actually added to the tables. As long as the system does not process all lines, we can compare performance of different deployments.
This package contains a faker that sends fake data to a UDP port and also tools to measure the performance by seeing how many packets are actually processed.
To run the tests, you need to have a user available that can log
in. If you can type psql
and as a result log in, you should be able
to run this script.
If not, you have to set PGHOST
, PGPORT
, PGDATA
, PGPASSWORD
, or
others to appropriate values.
- Set up the database
- Prepare for execution
- Generate measurements
To setup the database run the script setup.sql
on the server. Make
sure to set PGDATA
to the right path for the server (or use option
-d
for psql
) and that psql
is in the path.
PATH=/usr/local/postgresql/13.5/bin:$PATH
PGDATA=/var/lib/pgsql/13/data
psql -qf setup.sql
If you are using a remote connection, you can set the traditional
psql
variables PGHOST
, PGPORT
(if it is not the default 5432),
and PGPASSWORD
(if you use password authentication).
PATH=/usr/local/postgresql/13.5/bin:$PATH
PGHOST=capulet.lan
PGPASSWORD=xyzzy
psql -qf setup.sql
You can now run the collection of data using collect.sh
, which is
taking 100 samples of the run in the following manner:
- Reset the old extension by:
- Remove the old extension
- Terminate all Influx backends
- Reinstall the Influx package (with the default version)
- Start workers listening on port 4711 and writing to schema
magic
- Fetch the version of the extension
- Truncate the tables in schema
magic
- Run the generator to write to port provided to
-p
argument and host given by$PGHOST
using UDP. - Wait for the count to be stable, indicating that the worker is done processing the lines.
- Insert version, timestamp, a total count of rows, and the number of
rows sent into the table
public.measurements
. - Repeat steps 3-6 until there are 100 measurements.
If you stop the script, it will leave existing measurements in the table and just fill up until the count is 100.
To plot the data using R, you can install these packages on Ubuntu:
sudo apt install r-base-core r-cran-ggplot2 r-cran-rpostgresql
Script for doing a violin plot is then:
library('RPostgreSQL')
library(ggplot2)
pg = dbDriver("PostgreSQL")
con = dbConnect(pg, dbname="mats", host="localhost", port=5432)
table = dbGetQuery(con, "SELECT * FROM measurements")
ggplot(table, aes(x=version, y=count, fill=version)) + geom_violin()