This commit is contained in:
Jonathan Shook 2021-06-01 17:42:17 -05:00
commit e8379cc9d6

View File

@ -0,0 +1,87 @@
# java -jar nb.jar run driver=cockroachdb workload=postgres-basic tags=phase:rampup cycles=10 \
# serverName=localhost databaseName=bank
# java -jar nb.jar run driver=cockroachdb workload=postgres-basic tags=phase:main cycles=10 serverName=localhost
description: An example of a basic postgres bank transaction workload
scenarios:
default:
- run driver===cockroachdb tags===phase:main threads==auto cycles=10000000
serverName=localhost portNumber=5432 databaseName=<<database:bank>> user=postgres
password=postgres
rampup:
- run driver===cockroachdb tags===phase:rampup threads==auto cycles=<<accounts:1000000>>
serverName=localhost portNumber=5432 databaseName=<<database:bank>> user=postgres
password=postgres connectionpool=hikari filler-binding="AlphaNumericString(10)"
rampup-large:
- run driver===cockroachdb tags===phase:rampup threads==auto cycles=<<accounts:1000000>>
serverName=localhost portNumber=5432 databaseName=<<database:bank>> user=postgres
password=postgres connectionpool=hikari
schema:
- run driver===cockroachdb tags===phase:schema threads===1 serverName=localhost portNumber=5432
databaseName=bank user=postgres password=postgres connectionpool=hikari
bindings:
seq_uuid: Mod(<<accounts:1000000>>L); ToHashedUUID()
rand_uuid: Uniform(0,<<accounts:1000000>>L); ToHashedUUID()
rand_amount: Poisson(2000000); ToInt()
timestamp: StartingEpochMillis('2018-01-01 00:00:00'); ToDateTime()
filler: <<filler-binding:HashedLineToStringList('data/lorem_ipsum_full.txt', 150, 150)>>; ToString()
blocks:
- name: schema
tags:
phase: schema
params:
statements:
- create-table: |
CREATE TABLE IF NOT EXISTS "<<table:account>>" (
uuid UUID PRIMARY KEY,
amount INTEGER,
amount_unit VARCHAR(64),
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
filler TEXT
);
tags:
name: create-table
- create-indices: |
CREATE INDEX IF NOT EXISTS amount_idx on "<<table:account>>" (amount);
CREATE INDEX IF NOT EXISTS updated_at_idx on "<<table:account>>" (updated_at);
tags:
name: create-indices
- name: rampup
tags:
phase: rampup
params:
statements:
- rampup-insert: |
INSERT INTO "<<table:account>>" (uuid, amount, amount_unit, updated_at, created_at, filler)
VALUES ('{seq_uuid}', {rand_amount}, 'us_cents', '{timestamp}', '{timestamp}', '{filler}')
ON CONFLICT DO NOTHING;
params:
tags:
name: rampup-insert
- name: main-read
tags:
phase: main
type: read
params:
ratio: <<read_ratio:2>>
statements:
- main-find: |
SELECT * FROM "<<table:account>>" WHERE uuid = '{rand_uuid}';
params:
tags:
name: main-find
- name: main-write
tags:
phase: main
type: write
params:
ratio: <<write_ratio:1>>
statements:
- main-insert: |
UPDATE "<<table:account>>" SET amount = {rand_amount}, updated_at = '{timestamp}' WHERE uuid = '{rand_uuid}';
params:
tags:
name: main-insert