Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
32 changes: 24 additions & 8 deletions .github/workflows/slo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,26 +45,44 @@ jobs:
name: database-sql-table
path: ./database/sql/table
label: database/sql/table
run_extra_args: ''
create_extra_args: ''
- id: database_sql_query
name: database-sql-query
path: ./database/sql/query
label: database/sql/query
run_extra_args: ''
create_extra_args: ''
- id: native_query
name: native-query
path: ./native/query
label: native/query
run_extra_args: ''
create_extra_args: ''
- id: native_table
name: native-table
path: ./native/table
label: native/table
run_extra_args: ''
create_extra_args: ''
- id: native_table_over_query_service
name: native-table-over-query-service
path: ./native/table/over/query/service
label: native/table/over/query/service
run_extra_args: ''
create_extra_args: ''
- id: native_bulk_upsert
name: native-bulk-upsert
path: ./native/bulk-upsert
label: native/bulk-upsert
run_extra_args: '-batch-size=10'
create_extra_args: ''
- id: native_node_hints
name: native-node-hints
path: ./native/node_hints
label: native/node_hints
run_extra_args: '-prometheus-endpoint http://172.28.0.2:9090 -batch-size=10'
create_extra_args: '-min-partitions-count 10'

concurrency:
group: slo-${{ github.ref }}-${{ matrix.sdk.name }}
Expand Down Expand Up @@ -180,35 +198,33 @@ jobs:
fi

- name: Initialize YDB SLO
uses: ydb-platform/ydb-slo-action/init@main
uses: ydb-platform/ydb-slo-action/init@21473ae781c9bc8f16b42dedc79489c1867c6e50
with:
github_issue: ${{ github.event.inputs.github_issue }}
github_token: ${{ secrets.GITHUB_TOKEN }}
workload_name: ${{ matrix.sdk.name }}
workload_current_ref: ${{ github.head_ref || github.ref_name }}
workload_baseline_ref: ${{ steps.baseline.outputs.ref }}
disable_compose_profiles: "${{ matrix.sdk.id == 'native_node_hints' && 'chaos' || '' }}"

- name: Prepare SLO Database
run: |
echo "Preparing SLO database..."
CREATE_EXTRA_ARGS="${{ matrix.sdk.create_extra_args }}"
docker run --rm --network ydb_ydb-net \
--add-host "ydb:172.28.0.11" \
--add-host "ydb:172.28.0.12" \
--add-host "ydb:172.28.0.13" \
--add-host "ydb:172.28.0.99" \
ydb-app-current create grpc://ydb:2136 /Root/testdb
ydb-app-current create grpc://ydb:2136 /Root/testdb $CREATE_EXTRA_ARGS

- name: Run SLO Tests (parallel)
timeout-minutes: 15
run: |
DURATION=${{ inputs.slo_workload_duration_seconds || 600 }}
READ_RPS=${{ inputs.slo_workload_read_max_rps || 1000 }}
WRITE_RPS=${{ inputs.slo_workload_write_max_rps || 1000 }}

EXTRA_ARGS=""
if [ "${{ matrix.sdk.id }}" = "native_bulk_upsert" ]; then
EXTRA_ARGS="--batch-size=10"
fi
RUN_EXTRA_ARGS="${{ matrix.sdk.run_extra_args }}"

ARGS="run grpc://ydb:2136 /Root/testdb \
-otlp-endpoint prometheus:9090 \
Expand All @@ -218,7 +234,7 @@ jobs:
-write-rps $WRITE_RPS \
-read-timeout 100 \
-write-timeout 100 \
$EXTRA_ARGS"
$RUN_EXTRA_ARGS"

echo "Starting ydb-app-current..."
docker run -d \
Expand Down
2 changes: 2 additions & 0 deletions tests/slo/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ go 1.24.3
toolchain go1.24.10

require (
github.com/prometheus/client_golang v1.3.0
github.com/prometheus/common v0.7.0
github.com/ydb-platform/gorm-driver v0.1.3
github.com/ydb-platform/ydb-go-sdk-auth-environ v0.3.0
github.com/ydb-platform/ydb-go-sdk/v3 v3.67.0
Expand Down
2 changes: 2 additions & 0 deletions tests/slo/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1905,6 +1905,7 @@ github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndr
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs=
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
github.com/prometheus/client_golang v1.3.0 h1:miYCvYqFXtl/J9FIy8eNpBfYthAEFg+Ys0XyUVEcDsc=
github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
Expand All @@ -1918,6 +1919,7 @@ github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk
github.com/prometheus/client_model v0.6.0/go.mod h1:NTQHnmxFpouOD0DpvP4XujX3CdOAGQPoaGhyTchlyt8=
github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/common v0.7.0 h1:L+1lyG48J1zAQXA3RBX/nG/B3gjlHq0zTt2tlbJLyCY=
github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
Expand Down
4 changes: 3 additions & 1 deletion tests/slo/internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ type Config struct {
Time int
ShutdownTime int

BatchSize int
BatchSize int
PrometheusEndpoint string
}

func New() (*Config, error) {
Expand Down Expand Up @@ -95,6 +96,7 @@ func New() (*Config, error) {

fs.StringVar(&cfg.OTLPEndpoint, "otlp-endpoint", "", "OTLP HTTP endpoint for metrics")
fs.IntVar(&cfg.ReportPeriod, "report-period", 250, "metrics reporting period in milliseconds")
fs.StringVar(&cfg.PrometheusEndpoint, "prometheus-endpoint", "", "Prometheus endpoint")

fs.IntVar(&cfg.ReadRPS, "read-rps", 1000, "read RPS")
fs.IntVar(&cfg.WriteRPS, "write-rps", 100, "write RPS")
Expand Down
16 changes: 10 additions & 6 deletions tests/slo/internal/generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,22 @@ const (
MaxLength = 40
)

type Generator struct {
type Generator interface {
Generate() (Row, error)
}

type Impl struct {
currentID RowID
mu sync.Mutex
}

func New(id RowID) *Generator {
return &Generator{
func New(id RowID) *Impl {
return &Impl{
currentID: id,
}
}

func (g *Generator) Generate() (Row, error) {
func (g *Impl) Generate() (Row, error) {
g.mu.Lock()
id := g.currentID
g.currentID++
Expand All @@ -37,15 +41,15 @@ func (g *Generator) Generate() (Row, error) {
}

var err error
e.PayloadStr, err = g.genPayloadString()
e.PayloadStr, err = genPayloadString()
if err != nil {
return Row{}, err
}

return e, nil
}

func (g *Generator) genPayloadString() (*string, error) {
func genPayloadString() (*string, error) {
l := MinLength + rand.Intn(MaxLength-MinLength+1) //nolint:gosec // speed more important

sl := make([]byte, l)
Expand Down
58 changes: 58 additions & 0 deletions tests/slo/internal/generator/seeded.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package generator

import (
"math/rand"
"time"
)

type Range struct {
Left uint64
Right uint64
}
type SeededGenerator struct {
rng *rand.Rand
setRange *Range
}

func NewSeeded(seed int64) *SeededGenerator {
return &SeededGenerator{
rng: rand.New(rand.NewSource(seed)),
}
}

func (g *SeededGenerator) ConstructRow() (Row, error) {
e := Row{
PayloadDouble: func(a float64) *float64 { return &a }(rand.Float64()), //nolint:gosec // speed more important
PayloadTimestamp: func(a time.Time) *time.Time { return &a }(time.Now()),
PayloadHash: func(a uint64) *uint64 { return &a }(rand.Uint64()), //nolint:gosec
}

var err error
e.PayloadStr, err = genPayloadString()
if err != nil {
return Row{}, err
}

return e, nil
}

func (g *SeededGenerator) Generate() (Row, error) {
row, err := g.ConstructRow()
if err != nil {
return Row{}, err
}
if g.setRange == nil {
row.ID = g.rng.Uint64()
} else {
row.ID = g.setRange.Left + g.rng.Uint64()%(g.setRange.Right-g.setRange.Left)
}

return row, nil
}

func (g *SeededGenerator) SetRange(l uint64, r uint64) {
g.setRange = &Range{
Left: l,
Right: r,
}
}
Loading
Loading