Skip to content

Instantly share code, notes, and snippets.

@sbtourist
Last active November 17, 2023 18:49
Show Gist options
  • Save sbtourist/455b2beb5d15b4b1bf4d4cc5d8e12ef2 to your computer and use it in GitHub Desktop.
Save sbtourist/455b2beb5d15b4b1bf4d4cc5d8e12ef2 to your computer and use it in GitHub Desktop.
description: |
A workload with text keys, text values and range queries.
bindings:
seq_key: Mod(TEMPLATE(keycount,1000000000)); ToString();
seq_value: >-
Hash();
Mod(TEMPLATE(valuecount,1000000000));
CharBufImage('A-Za-z0-9 _|/',16000000,HashRange(TEMPLATE(mintext,100000)TEMPLATE(addzeroes,),TEMPLATE(maxtext,500000)TEMPLATE(addzeroes,)));
ToString();
rw_key: TEMPLATE(keydist,Uniform(0,1000000000)); ToString() -> String
rw_value: Hash(); TEMPLATE(valdist,Uniform(0,1000000000)); CharBufImage('A-Za-z0-9 _|/',16000000,HashRange(TEMPLATE(mintext,100000)TEMPLATE(addzeros,),TEMPLATE(maxtext,500000)TEMPLATE(addzeros,))); ToString();
blocks:
- tags:
phase: create-keyspace
params:
prepared: false
statements:
- create-keyspace: |
create keyspace if not exists TEMPLATE(keyspace,baselines)
WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 'TEMPLATE(rf,3)'}
AND durable_writes = true;
- tags:
phase: create-table
params:
prepared: false
statements:
- create-table: |
create table if not exists TEMPLATE(keyspace,baselines).TEMPLATE(table,keyvalue) (
key text,
value text,
PRIMARY KEY (key)
);
- tags:
phase: truncate
params:
prepared: false
statements:
- truncate-table: |
truncate table TEMPLATE(keyspace,baselines).TEMPLATE(table,keyvalue);
- tags:
phase: rampup
params:
cl: TEMPLATE(write_cl,LOCAL_QUORUM)
statements:
- rampup-insert: |
insert into TEMPLATE(keyspace,baselines).TEMPLATE(table,keyvalue)
(key, value)
values ({seq_key},{seq_value});
- tags:
phase: verify
params:
cl: TEMPLATE(read_cl,LOCAL_QUORUM)
statements:
- verify-select: |
select * from TEMPLATE(keyspace,baselines).TEMPLATE(table,keyvalue) where key={seq_key};
verify-fields: key->seq_key, value->seq_value
- tags:
phase: main
type: read-single
params:
ratio: 0
cl: TEMPLATE(read_cl,LOCAL_QUORUM)
statements:
- main-select: |
select * from TEMPLATE(keyspace,baselines).TEMPLATE(table,keyvalue) where key={rw_key};
- tags:
phase: main
type: read-range
params:
ratio: 5
cl: TEMPLATE(read_cl,LOCAL_QUORUM)
statements:
- main-select: |
select * from TEMPLATE(keyspace,baselines).TEMPLATE(table,keyvalue) LIMIT TEMPLATE(range_limit,1000);
- tags:
phase: main
type: write
params:
ratio: 5
cl: TEMPLATE(read_cl,LOCAL_QUORUM)
statements:
- main-insert: |
insert into TEMPLATE(keyspace,baselines).TEMPLATE(table,keyvalue)
(key, value) values ({rw_key}, {rw_value});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment