| id | timescale |
|---|---|
| title | TimescaleDB |
| sidebar_position | 8 |
import TimescaleImage from './img/timescale.jpg'; import TimescaleDataImage from './img/timescale-data.jpg';
TimescaleDB is an open-source database extenion designed to make SQL scalable for time-series data. It is engineered up from PostgreSQL and packaged as a PostgreSQL extension, providing automatic partitioning across time and space (partitioning key), as well as full SQL support.
Using Reporting Sinks extension for TimescaleDB, you can store NBomber metrics into TimescaleDB and analyze your performance results with NBomber.MetricsUI (in development) or Grafana.
:::warning This package is experimental and might be subject to breaking API changes in the future. While we intend to keep experimental packages as stable as possible, we may need to introduce breaking changes. :::
:::info To start working with NBomber.Sinks.Timescale package you should install it:
dotnet add package NBomber.Sinks.Timescale
Also, the source code is available on Github. :::
:::info The simple way to run TimescaleDB is via Docker. By this link, you can find a docker-compose.yaml to run it.
:::
To configure TimescaleDB Sink we will use JSON Infrastracture Config file
{
"TimescaleDbSink": {
"ConnectionString": "Host=localhost;Port=5432;Database=metricsdb;Username=timescaledb;Password=timescaledb;Pooling=true;Maximum Pool Size=300;"
}
}Now you should load this "infra-config.json" file.
var timescaleDbSink = new TimescaleDbSink();
var scenario = Scenario.Create("scenario", async context => { ... });
NBomberRunner
.RegisterScenarios(scenario)
.WithReportingInterval(TimeSpan.FromSeconds(5))
.WithReportingSinks(timescaleDbSink)
// highlight-start
.LoadInfraConfig("infra-config.json");
// highlight-endYou can find the complete example by this link.
During the load test run, NBomber's metrics will appear in TimescaleDB, and you can query them.
You might have a situation that requires you to connect to TimescaleDB via code.
var timescaleDbSink = new TimescaleDbSink("Host=localhost;Port=5432;Database=metricsdb;Username=timescaledb;Password=timescaledb;Pooling=true;Maximum Pool Size=300;");This feature is in development...