Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v4
with:
go-version: 1.15
go-version: '1.20'

- name: Test
run: go test -v -race ./...
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
.idea
.vscode
*~
/bin

# High Dynamic Range (HDR) Histogram files
*.hdr
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Build stage
FROM golang:1.13.1-alpine AS builder
FROM golang:1.20.8-alpine AS builder
WORKDIR /tsbs
COPY ./ ./
RUN apk update && apk add --no-cache git
RUN go mod download && go install ./...

# Final stage
FROM alpine:3.8.5
FROM alpine:3.18
RUN apk update && apk add --no-cache bash
COPY --from=builder /go/bin /
COPY --from=builder /tsbs/scripts /
Expand Down
52 changes: 32 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
# Time Series Benchmark Suite (TSBS)

This repo contains code for benchmarking several time series databases,
including TimescaleDB, MongoDB, InfluxDB, CrateDB and Cassandra.
This code is based on a fork of work initially made public by InfluxDB
at https://github.com/influxdata/influxdb-comparisons.
including QuestDB, TimescaleDB, MongoDB, InfluxDB, CrateDB, and Cassandra.
This code is based on a fork of TSBS from TimescaleDB available at
https://github.com/timescale/tsbs. Read
[this post](https://questdb.io/blog/optimizing-optimizer-time-series-benchmark-suite/)
to understand why we (QuestDB) created it.

This fork derives from the original TSBS and includes a number of changes
such as:
* Loader optimizations for QuestDB making it capable of 4M+ rows/s
ingestion.
* A number of bugfixes in query generation.
* InfluxDB v2 support based on
[this PR](https://github.com/timescale/tsbs/pull/209). Original TSBS
supports InfluxDB v1 only.

All kinds of pull requests are welcome.

Current databases supported:

Expand Down Expand Up @@ -35,6 +49,7 @@ database in the TSBS, feel free to open a pull request to add it!
Currently, TSBS supports two use cases.

### Dev ops

A 'dev ops' use case, which comes in two forms. The full form is used to
generate, insert, and measure data from 9 'systems' that could be monitored
in a real world dev ops scenario (e.g., CPU, memory, disk, etc).
Expand All @@ -49,6 +64,7 @@ one host in the dataset and the number of different hosts generated is
defined by the `scale` flag (see below).

### Internet of Things (IoT)

The second use case is meant to simulate the data load in an IoT
environment. This use case simulates data streaming from a set of trucks
belonging to a fictional trucking company. This use case simulates
Expand Down Expand Up @@ -76,14 +92,15 @@ cases are implemented for each database:
|CrateDB|X||
|InfluxDB|X|X|
|MongoDB|X|
|QuestDB|X|X
|QuestDB|X|X²|
|SiriDB|X|
|TimescaleDB|X|X|
|Timestream|X||
|VictoriaMetrics|X²||
|VictoriaMetrics|X³||

¹ Does not support the `groupby-orderby-limit` query
² Does not support the `groupby-orderby-limit`, `lastpoint`, `high-cpu-1`, `high-cpu-all` queries
² Supports ingestion only
³ Does not support the `groupby-orderby-limit`, `lastpoint`, `high-cpu-1`, `high-cpu-all` queries

## What the TSBS tests

Expand All @@ -107,8 +124,8 @@ scripts). The easiest way to get and install the Go programs is to use
`go get` and then `make all` to install all binaries:
```bash
# Fetch TSBS and its dependencies
$ go get github.com/timescale/tsbs
$ cd $GOPATH/src/github.com/timescale/tsbs
$ go get github.com/questdb/tsbs
$ cd $GOPATH/src/github.com/questdb/tsbs
$ make
```

Expand Down Expand Up @@ -396,12 +413,12 @@ the results.
### Devops / cpu-only
|Query type|Description|
|:---|:---|
|single-groupby-1-1-1| Simple aggregrate (MAX) on one metric for 1 host, every 5 mins for 1 hour
|single-groupby-1-1-12| Simple aggregrate (MAX) on one metric for 1 host, every 5 mins for 12 hours
|single-groupby-1-8-1| Simple aggregrate (MAX) on one metric for 8 hosts, every 5 mins for 1 hour
|single-groupby-5-1-1| Simple aggregrate (MAX) on 5 metrics for 1 host, every 5 mins for 1 hour
|single-groupby-5-1-12| Simple aggregrate (MAX) on 5 metrics for 1 host, every 5 mins for 12 hours
|single-groupby-5-8-1| Simple aggregrate (MAX) on 5 metrics for 8 hosts, every 5 mins for 1 hour
|single-groupby-1-1-1| Simple aggregate (MAX) on one metric for 1 host, every 5 mins for 1 hour
|single-groupby-1-1-12| Simple aggregate (MAX) on one metric for 1 host, every 5 mins for 12 hours
|single-groupby-1-8-1| Simple aggregate (MAX) on one metric for 8 hosts, every 5 mins for 1 hour
|single-groupby-5-1-1| Simple aggregate (MAX) on 5 metrics for 1 host, every 5 mins for 1 hour
|single-groupby-5-1-12| Simple aggregate (MAX) on 5 metrics for 1 host, every 5 mins for 12 hours
|single-groupby-5-8-1| Simple aggregate (MAX) on 5 metrics for 8 hosts, every 5 mins for 1 hour
|cpu-max-all-1| Aggregate across all CPU metrics per hour over 1 hour for a single host
|cpu-max-all-8| Aggregate across all CPU metrics per hour over 1 hour for eight hosts
|double-groupby-1| Aggregate on across both time and host, giving the average of 1 CPU metric per host per hour for 24 hours
Expand Down Expand Up @@ -433,11 +450,6 @@ the results.
We welcome contributions from the community to make TSBS better!

You can help either by opening an
[issue](https://github.com/timescale/tsbs/issues) with
[issue](https://github.com/questdb/tsbs/issues) with
any suggestions or bug reports, or by forking this repository,
making your own contribution, and submitting a pull request.

Before we accept any contributions, Timescale contributors need to
sign the [Contributor License Agreement](https://cla-assistant.io/timescale/tsbs) (CLA).
By signing a CLA, we can ensure that the community is free and confident in its
ability to use your contributions.
12 changes: 7 additions & 5 deletions cmd/tsbs_generate_data/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@

// Supported use cases:
// devops: scale is the number of hosts to simulate, with log messages
// every log-interval seconds.
//
// every log-interval seconds.
//
// cpu-only: same as `devops` but only generate metrics for CPU
package main

Expand All @@ -22,11 +24,11 @@ import (
"runtime/pprof"

"github.com/blagojts/viper"
"github.com/questdb/tsbs/internal/inputs"
"github.com/questdb/tsbs/internal/utils"
"github.com/questdb/tsbs/pkg/data/usecases/common"
"github.com/questdb/tsbs/pkg/targets/initializers"
"github.com/spf13/pflag"
"github.com/timescale/tsbs/internal/inputs"
"github.com/timescale/tsbs/internal/utils"
"github.com/timescale/tsbs/pkg/data/usecases/common"
"github.com/timescale/tsbs/pkg/targets/initializers"
)

var (
Expand Down
6 changes: 3 additions & 3 deletions cmd/tsbs_generate_queries/databases/akumuli/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package akumuli
import (
"time"

"github.com/timescale/tsbs/cmd/tsbs_generate_queries/uses/devops"
"github.com/timescale/tsbs/cmd/tsbs_generate_queries/utils"
"github.com/timescale/tsbs/pkg/query"
"github.com/questdb/tsbs/cmd/tsbs_generate_queries/uses/devops"
"github.com/questdb/tsbs/cmd/tsbs_generate_queries/utils"
"github.com/questdb/tsbs/pkg/query"
)

// BaseGenerator contains settings specific for Akumuli database.
Expand Down
24 changes: 14 additions & 10 deletions cmd/tsbs_generate_queries/databases/akumuli/devops.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"fmt"
"time"

"github.com/timescale/tsbs/cmd/tsbs_generate_queries/uses/devops"
"github.com/timescale/tsbs/pkg/query"
"github.com/questdb/tsbs/cmd/tsbs_generate_queries/uses/devops"
"github.com/questdb/tsbs/pkg/query"
)

// Devops produces Influx-specific queries for all the devops query types.
Expand Down Expand Up @@ -70,9 +70,11 @@ type tsdbAggregateAllQuery struct {
// SELECT minute, max(metric1), ..., max(metricN)
// FROM cpu
// WHERE
// (hostname = '$HOSTNAME_1' OR ... OR hostname = '$HOSTNAME_N')
// AND time >= '$HOUR_START'
// AND time < '$HOUR_END'
//
// (hostname = '$HOSTNAME_1' OR ... OR hostname = '$HOSTNAME_N')
// AND time >= '$HOUR_START'
// AND time < '$HOUR_END'
//
// GROUP BY minute
// ORDER BY minute ASC
//
Expand Down Expand Up @@ -176,17 +178,19 @@ func (d *Devops) HighCPUForHosts(qi query.Query, nHosts int) {
// SELECT MAX(metric1), ..., MAX(metricN)
// FROM cpu
// WHERE
// (hostname = '$HOSTNAME_1' OR ... OR hostname = '$HOSTNAME_N')
// AND time >= '$HOUR_START'
// AND time < '$HOUR_END'
//
// (hostname = '$HOSTNAME_1' OR ... OR hostname = '$HOSTNAME_N')
// AND time >= '$HOUR_START'
// AND time < '$HOUR_END'
//
// GROUP BY hour
// ORDER BY hour
//
// Resultsets:
// cpu-max-all-1
// cpu-max-all-8
func (d *Devops) MaxAllCPU(qi query.Query, nHosts int) {
interval := d.Interval.MustRandWindow(devops.MaxAllDuration)
func (d *Devops) MaxAllCPU(qi query.Query, nHosts int, duration time.Duration) {
interval := d.Interval.MustRandWindow(duration)
hostnames, err := d.GetRandomHosts(nHosts)
panicIfErr(err)
startTimestamp := interval.StartUnixNano()
Expand Down
8 changes: 4 additions & 4 deletions cmd/tsbs_generate_queries/databases/cassandra/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"strings"
"time"

"github.com/timescale/tsbs/cmd/tsbs_generate_queries/uses/devops"
"github.com/timescale/tsbs/cmd/tsbs_generate_queries/utils"
internalutils "github.com/timescale/tsbs/internal/utils"
"github.com/timescale/tsbs/pkg/query"
"github.com/questdb/tsbs/cmd/tsbs_generate_queries/uses/devops"
"github.com/questdb/tsbs/cmd/tsbs_generate_queries/utils"
internalutils "github.com/questdb/tsbs/internal/utils"
"github.com/questdb/tsbs/pkg/query"
)

// BaseGenerator contains settings specific for Cassandra database.
Expand Down
6 changes: 3 additions & 3 deletions cmd/tsbs_generate_queries/databases/cassandra/devops.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"fmt"
"time"

"github.com/timescale/tsbs/cmd/tsbs_generate_queries/uses/devops"
"github.com/timescale/tsbs/internal/utils"
"github.com/timescale/tsbs/pkg/query"
"github.com/questdb/tsbs/cmd/tsbs_generate_queries/uses/devops"
"github.com/questdb/tsbs/internal/utils"
"github.com/questdb/tsbs/pkg/query"
)

// TODO: Remove the need for this by continuing to bubble up errors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"
"time"

"github.com/timescale/tsbs/pkg/query"
"github.com/questdb/tsbs/pkg/query"
)

func TestDevopsGetHostWhereWithHostnames(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions cmd/tsbs_generate_queries/databases/clickhouse/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package clickhouse
import (
"time"

"github.com/timescale/tsbs/cmd/tsbs_generate_queries/uses/devops"
"github.com/timescale/tsbs/cmd/tsbs_generate_queries/utils"
"github.com/timescale/tsbs/pkg/query"
"github.com/questdb/tsbs/cmd/tsbs_generate_queries/uses/devops"
"github.com/questdb/tsbs/cmd/tsbs_generate_queries/utils"
"github.com/questdb/tsbs/pkg/query"
)

// BaseGenerator contains settings specific for ClickHouse.
Expand Down
20 changes: 12 additions & 8 deletions cmd/tsbs_generate_queries/databases/clickhouse/devops.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"strings"
"time"

"github.com/timescale/tsbs/cmd/tsbs_generate_queries/uses/devops"
"github.com/timescale/tsbs/pkg/query"
"github.com/questdb/tsbs/cmd/tsbs_generate_queries/uses/devops"
"github.com/questdb/tsbs/pkg/query"
)

// TODO: Remove the need for this by continuing to bubble up errors
Expand Down Expand Up @@ -76,9 +76,11 @@ const clickhouseTimeStringFormat = "2006-01-02 15:04:05"
// SELECT MAX(metric1), ..., MAX(metricN)
// FROM cpu
// WHERE
// (hostname = '$HOSTNAME_1' OR ... OR hostname = '$HOSTNAME_N')
// AND time >= '$HOUR_START'
// AND time < '$HOUR_END'
//
// (hostname = '$HOSTNAME_1' OR ... OR hostname = '$HOSTNAME_N')
// AND time >= '$HOUR_START'
// AND time < '$HOUR_END'
//
// GROUP BY hour
// ORDER BY hour
//
Expand Down Expand Up @@ -290,9 +292,11 @@ func (d *Devops) LastPointPerHost(qi query.Query) {
// SELECT minute, max(metric1), ..., max(metricN)
// FROM cpu
// WHERE
// (hostname = '$HOSTNAME_1' OR ... OR hostname = '$HOSTNAME_N')
// AND time >= '$HOUR_START'
// AND time < '$HOUR_END'
//
// (hostname = '$HOSTNAME_1' OR ... OR hostname = '$HOSTNAME_N')
// AND time >= '$HOUR_START'
// AND time < '$HOUR_END'
//
// GROUP BY minute
// ORDER BY minute ASC
//
Expand Down
4 changes: 2 additions & 2 deletions cmd/tsbs_generate_queries/databases/clickhouse/devops_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"testing"
"time"

"github.com/timescale/tsbs/cmd/tsbs_generate_queries/uses/devops"
"github.com/timescale/tsbs/pkg/query"
"github.com/questdb/tsbs/cmd/tsbs_generate_queries/uses/devops"
"github.com/questdb/tsbs/pkg/query"
)

func TestDevopsGetHostWhereWithHostnames(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions cmd/tsbs_generate_queries/databases/cratedb/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package cratedb
import (
"time"

"github.com/timescale/tsbs/cmd/tsbs_generate_queries/uses/devops"
"github.com/timescale/tsbs/cmd/tsbs_generate_queries/utils"
"github.com/timescale/tsbs/pkg/query"
"github.com/questdb/tsbs/cmd/tsbs_generate_queries/uses/devops"
"github.com/questdb/tsbs/cmd/tsbs_generate_queries/utils"
"github.com/questdb/tsbs/pkg/query"
)

// BaseGenerator contains settings specific for CrateDB
Expand Down
11 changes: 6 additions & 5 deletions cmd/tsbs_generate_queries/databases/cratedb/devops.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"strings"
"time"

"github.com/timescale/tsbs/cmd/tsbs_generate_queries/uses/devops"
"github.com/timescale/tsbs/pkg/query"
"github.com/questdb/tsbs/cmd/tsbs_generate_queries/uses/devops"
"github.com/questdb/tsbs/pkg/query"
)

// TODO: Remove the need for this by continuing to bubble up errors
Expand All @@ -28,7 +28,8 @@ const hostnameField = "tags['hostname']"
// a set of column idents.
//
// For instance:
// max(cpu_time) AS max_cpu_time
//
// max(cpu_time) AS max_cpu_time
func (d *Devops) getSelectAggClauses(aggFunc string, idents []string) []string {
selectAggClauses := make([]string, len(idents))
for i, ident := range idents {
Expand All @@ -44,8 +45,8 @@ func (d *Devops) getSelectAggClauses(aggFunc string, idents []string) []string {
// Queries:
// cpu-max-all-1
// cpu-max-all-8
func (d *Devops) MaxAllCPU(qi query.Query, nHosts int) {
interval := d.Interval.MustRandWindow(devops.MaxAllDuration)
func (d *Devops) MaxAllCPU(qi query.Query, nHosts int, duration time.Duration) {
interval := d.Interval.MustRandWindow(duration)
selectClauses := d.getSelectAggClauses("max", devops.GetAllCPUMetrics())
hosts, err := d.GetRandomHosts(nHosts)
panicIfErr(err)
Expand Down
Loading