Skip to main content
Version: Next

Drivers & Configuration

Every Stroppy test uses a driver configuration. The script declares defaults with declareDriverSetup(), and the CLI can override them with -d and -D.

import { DriverX, declareDriverSetup } from "./helpers.ts";

const config = declareDriverSetup(0, {
url: "postgres://postgres:postgres@localhost:5432",
driverType: "postgres",
defaultInsertMethod: "native",
});

const driver = DriverX.create().setup(config);

The index (0 above) is the driver slot. CLI values for that slot are passed through STROPPY_DRIVER_0 and merged over the script defaults.

CLI Configuration

Use -d to select a preset and -D to override fields.

stroppy run tpcc/tx -d pg
stroppy run tpcc/tx -d pg -D url=postgres://user:pass@host:5432/bench
stroppy run tpcc/procs -d pg -d1 mysql
stroppy run tpcb/tx -D driverType=csv -D url='/tmp/tpcb-csv?merge=true&workload=tpcb'
FlagDescription
-d pgConfigure driver slot 0 from the pg preset.
-d1 mysqlConfigure driver slot 1 from the mysql preset.
-d '{...}'Configure driver slot 0 from raw JSON.
-D key=valueOverride a field on driver slot 0.
-D1 key=valueOverride a field on driver slot 1.

CLI-composed values do not overwrite an already-set STROPPY_DRIVER_N environment variable. This lets CI inject a full JSON driver config directly.

For repeatable runs with full driver objects, environment variables, steps, and k6 arguments, use a configuration file.

Presets

Presets are shorthand for driverType, url, and defaultInsertMethod.

PresetdriverTypeDefault URLDefault insert method
pgpostgrespostgres://postgres:postgres@localhost:5432native
mysqlmysqlmyuser:mypassword@tcp(localhost:3306)/mydb?charset=utf8mb4&parseTime=True&loc=Localplain_bulk
picopicodatapostgres://admin:T0psecret@localhost:1331plain_bulk
ydbydbgrpc://localhost:2136/localnative
noopnoopnoop://localhostplain_bulk

CSV is a driver type but has no short preset. Configure it with -D driverType=csv and a filesystem URL.

Common Options

These fields can be set in TypeScript defaults, raw JSON, a config file, or with -D key=value.

OptionTypeDefaultDescription
urlstringnoneDriver-specific connection URL or DSN.
driverTypestringnonepostgres, mysql, picodata, ydb, noop, or csv.
defaultInsertMethodstringscript or presetnative, plain_bulk, or plain_query. Overrides each InsertSpec method when set.
bulkSizeint2500Rows per multi-row INSERT or native batch, where the driver uses batching.
defaultTxIsolationstringdb_defaultread_uncommitted, read_committed, repeatable_read, serializable, db_default, conn, or none.
errorModestringlogsilent, log, throw, fail, or abort. STROPPY_ERROR_MODE has highest precedence.
caCertFilestringnonePath to a CA certificate PEM file for TLS connections.
authTokenstringnoneToken credentials, mainly for YDB.
authUserstringfrom URL/DSNStatic auth username when the URL/DSN does not provide one.
authPasswordstringfrom URL/DSNStatic auth password when the URL/DSN does not provide one.
tlsInsecureSkipVerifyboolfalseDisable TLS certificate verification for testing.

Error Modes

errorMode controls non-transaction query and insert error handling:

ModeBehavior
silentRecord error metrics only.
logRecord metrics and print the error. This is the default.
throwRethrow the error to TypeScript.
failMark the k6 iteration as failed with test.fail().
abortAbort the k6 run with test.abort().

STROPPY_ERROR_MODE has highest precedence over per-driver config.

Nested options use dot notation from the CLI:

stroppy run tpcc/tx -d pg -D pool.maxConns=100 -D pool.maxConnLifetime=30m
stroppy run tpcc/tx -d ydb -D caCertFile=./ca.pem -D authToken=t1.xxx

Pool Options

pool is portable sugar. Stroppy maps it to the driver-specific pool block by driverType.

pool optionPostgreSQL/Picodata mappingMySQL/YDB mapping
pool.maxConnspostgres.maxConnssql.maxOpenConns
pool.minConnspostgres.minConnssql.maxIdleConns
pool.maxConnLifetimepostgres.maxConnLifetimesql.connMaxLifetime
pool.maxConnIdleTimepostgres.maxConnIdleTimesql.connMaxIdleTime

The pool object also accepts driver-specific aliases such as minIdleConns, traceLogLevel, defaultQueryExecMode, statementCacheCapacity, descriptionCacheCapacity, maxOpenConns, maxIdleConns, connMaxLifetime, and connMaxIdleTime. Use explicit postgres.* or sql.* blocks when you want to avoid ambiguity.

Explicit postgres or sql blocks take priority over pool.

PostgreSQL/Picodata-specific options:

OptionDescription
postgres.maxConnsMaximum pgx pool connections.
postgres.minConnsMinimum pgx pool connections.
postgres.minIdleConnsMinimum idle pgx connections.
postgres.maxConnLifetimeMaximum connection lifetime, e.g. 1h.
postgres.maxConnIdleTimeMaximum idle lifetime, e.g. 10m.
postgres.traceLogLevelpgx trace log level: debug, info, warn, error.
postgres.defaultQueryExecModeexec, cache_statement, cache_describe, describe_exec, or simple_protocol. Stroppy defaults PostgreSQL query execution to exec.
postgres.statementCacheCapacityStatement cache size; only valid with cache_statement.
postgres.descriptionCacheCapacityDescription cache size; only valid with cache_describe.

MySQL/YDB-specific options:

OptionDescription
sql.maxOpenConnsMaximum open database/sql connections.
sql.maxIdleConnsMaximum idle database/sql connections.
sql.connMaxLifetimeMaximum connection lifetime, e.g. 1h.
sql.connMaxIdleTimeMaximum idle lifetime, e.g. 10m.

noop and csv ignore pool options.

DB Drivers

PostgreSQL

Use PostgreSQL for full SQL, transaction, and native bulk-load coverage.

FieldValue
driverTypepostgres
Presetpg
Default URLpostgres://postgres:postgres@localhost:5432
URL schemespostgres://, postgresql://, and pgx-supported connection strings
Default insert methodnative
Pool configpool.* or postgres.*

PostgreSQL supports native, plain_bulk, and plain_query inserts. native uses pgx CopyFrom; plain_bulk uses multi-row INSERT; plain_query uses one-row INSERT batches.

Transactions are supported, including regular transaction isolation and conn connection-only mode. Use postgres.defaultQueryExecMode=exec when you want every query to execute without pgx statement caching; this is Stroppy's default when the field is not set.

Example:

stroppy run tpcc/tx -d pg \
-D url=postgres://user:pass@host:5432/bench \
-D pool.maxConns=100 \
-D postgres.defaultQueryExecMode=exec

MySQL

Use MySQL for database/sql workloads and MySQL-specific dialect SQL.

FieldValue
driverTypemysql
Presetmysql
Default URLmyuser:mypassword@tcp(localhost:3306)/mydb?charset=utf8mb4&parseTime=True&loc=Local
URL schemesGo MySQL DSN form, e.g. user:pass@tcp(host:3306)/db?parseTime=True
Default insert methodplain_bulk
Pool configpool.* or sql.*

MySQL supports plain_bulk and plain_query. native is accepted but maps to the same multi-row INSERT path because the driver does not use LOAD DATA LOCAL INFILE.

Transactions are supported through database/sql. TLS can be configured through the DSN or with caCertFile / tlsInsecureSkipVerify when the DSN does not already define TLS.

Example:

stroppy run tpcc/procs -d mysql \
-D url='root:secret@tcp(mysql.local:3306)/bench?parseTime=True' \
-D pool.maxConns=80

Picodata

Use Picodata for SQL workloads over the PostgreSQL wire protocol.

FieldValue
driverTypepicodata
Presetpico
Default URLpostgres://admin:T0psecret@localhost:1331
URL schemesPostgreSQL-style URL, typically postgres://user:pass@host:port/db
Default insert methodplain_bulk
Pool configpool.* or postgres.*

Picodata supports SQL query execution and InsertSpec loading. native and plain_bulk both use multi-row INSERT; plain_query uses one-row INSERT batches.

Transactions are not supported by the Picodata driver. Workloads that run explicit transactions should use TX_ISOLATION=none or a variant that avoids driver.beginTx().

Example:

stroppy run tpcc/tx -d pico \
-D url=postgres://admin:T0psecret@pico.local:1331/public \
-e TX_ISOLATION=none

YDB

Use YDB for YQL workloads and native BulkUpsert loading.

FieldValue
driverTypeydb
Presetydb
Default URLgrpc://localhost:2136/local
URL schemesgrpc://host:port/database, grpcs://host:port/database
Default insert methodnative
Pool configpool.* or sql.*

YDB supports native, plain_bulk, and plain_query. native uses YDB Table API BulkUpsert; SQL inserts use the generic database/sql path.

Transactions are supported. TPC workloads typically default YDB to serializable. Use grpcs:// for TLS, and use authToken or authUser / authPassword when the target requires credentials. If primary auth fails, the driver also tries Yandex Cloud metadata credentials.

Examples:

stroppy run tpcc/tx -d ydb -D url=grpc://localhost:2136/local

stroppy run tpcc/tx -d ydb \
-D url=grpcs://ydb.example.net:2135/tenant/db \
-D caCertFile=./ca.pem \
-D authToken=t1.xxx

Noop

Use Noop to measure Stroppy framework overhead without database I/O.

FieldValue
driverTypenoop
Presetnoop
Default URLnoop://localhost
URL schemesnoop://...
Default insert methodplain_bulk
Pool configignored

Noop drains generators, builds queries, records metrics, and discards all final I/O. It is useful for estimating the cost of TypeScript, data generation, batching, and Stroppy driver plumbing.

Example:

stroppy run tpcb/tx -d noop -- --vus 4 --duration 30s

CSV

Use CSV to emit generated relational data into files instead of a database.

FieldValue
driverTypecsv
Presetnone
Default URLcurrent working directory when url is empty
URL schemesFilesystem path with optional query string, e.g. /tmp/out?merge=true
Default insert methodset defaultInsertMethod=native
Pool configignored

CSV supports only relational InsertSpec loading through native. It accepts setup SQL for convenience: DROP clears output for idempotent reruns, while CREATE, TRUNCATE, ALTER, COMMENT, SET, and empty statements are accepted as no-ops. Runtime query execution is rejected.

CSV URL options:

Query optionDefaultDescription
mergetrueMerge worker shards into one <table>.csv at teardown.
headertrueEmit CSV headers. With merge=false, headers are sidecar files.
separatorcommacomma, ,, tab, or \t.
workloadSTROPPY_CSV_WORKLOAD, then defaultOutput subdirectory under the URL path.

Example:

stroppy run tpcb/tx -D driverType=csv \
-D defaultInsertMethod=native \
-D url='/tmp/tpcb-csv?separator=comma&header=true&merge=true&workload=tpcb' \
--steps drop_schema,create_schema,load_data

Capability Matrix

CapabilityPostgreSQLMySQLPicodataYDBNoopCSV
runQuery / execYesYesYesYesStubbedNo
TransactionsYesYesNoYesStubbedNo
native InsertSpecCOPYMulti-row INSERTMulti-row INSERTBulkUpsertGenerator drainCSV files
plain_bulk InsertSpecYesYesYesYesGenerator drainNo
plain_query InsertSpecYesYesYesYesGenerator drainNo
Pool optionspostgres.*sql.*postgres.*sql.*IgnoredIgnored

Inspecting Driver Setup

Use stroppy probe to see the effective defaults declared by a script without running the workload:

stroppy probe tpcc/tx --drivers
stroppy probe tpch/tx --envs --drivers

Use stroppy help drivers in the CLI for the same option names in terminal help format.