activities.mongodb-basic.yaml Maven / Gradle / Ivy
# nb -v run driver=mongodb yaml=mongodb-basic connection=mongodb://127.0.0.1 database=testdb tags=phase:rampup cycles=1M
description: An example of a basic mongo insert and find.
scenarios:
default:
- run driver=mongodb tags==phase:rampup cycles===TEMPLATE(rampup-cycles,1000000) threads=auto
- run driver=mongodb tags==phase:main cycles===TEMPLATE(main-cycles,1000000) threads=auto
bindings:
seq_key: Mod(<>L); ToInt()
seq_value: Mod(<>L); <>; ToString() -> String
rw_key: <long>>; ToInt()
rw_value: <int>>; <>; ToString() -> String
blocks:
- name: rampup
tags:
phase: rampup
statements:
- rampup-insert: |
{
insert: "<>",
documents: [ { _id: {seq_key},
value: {seq_value} } ]
}
params:
readPreference: primary
tags:
name: rampup-insert
- name: main-read
tags:
phase: main
type: read
params:
ratio: <>
statements:
- main-find: |
{
find: "<>",
filter: { _id: {rw_key} }
}
params:
readPreference: primary
- name: main-write
tags:
phase: main
type: write
params:
ratio: <>
statements:
- main-insert: |
{
insert: "<>",
documents: [ { _id: {rw_key},
value: {rw_value} } ]
}
params:
readPreference: primary