activities.baselinesv2.mongodb-keyvalue2.yaml Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of adapter-mongodb Show documentation
Show all versions of adapter-mongodb Show documentation
An nosqlbench DriverAdapter module for MongoDB
# Connection Guide: https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/connection/
# nb5 run driver=mongodb workload=/path/to/mongodb-keyvalue2.yaml tags=block:schema connection='mongodb+srv://user:[email protected]/?retryWrites=true&w=majority' database=baselines -vv --show-stacktraces
# nb5 run driver=mongodb workload=/path/to/mongodb-keyvalue2.yaml tags=block:rampup cycles=25 connection='mongodb+srv://user:[email protected]/?retryWrites=true&w=majority' database=baselines -vv --show-stacktraces
# nb5 run driver=mongodb workload=/path/to/mongodb-keyvalue2.yaml tags='block:main-.*' cycles=25 connection='mongodb+srv://user:[email protected]/?retryWrites=true&w=majority' database=baselines -vv --show-stacktraces
min_version: "4.17.31"
description: |
This workload is analogous to the cql-keyvalue2 workload, just implemented for MongoDB.
scenarios:
default:
schema: run driver=mongodb tags==block:schema threads==1 cycles==UNDEF
rampup: run driver=mongodb tags==block:rampup cycles===TEMPLATE(rampup-cycles,10000000) threads=auto
main: run driver=mongodb tags==block:"main-.*" cycles===TEMPLATE(main-cycles,10000000) threads=auto
drop: run driver=mongodb tags==block:drop-collection threads==1 cycles==UNDEF
params:
instrument: true
bindings:
seq_key: Mod(TEMPLATE(keycount,1000000000)); ToString();
seq_value: >-
Hash();
Mod(TEMPLATE(valuecount,1000000000));
CharBufImage('A-Za-z0-9 _|/',16000000,HashRange(TEMPLATE(mintext,50000)TEMPLATE(addzeroes,),TEMPLATE(maxtext,150000)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,50000)TEMPLATE(addzeros,),TEMPLATE(maxtext,150000)TEMPLATE(addzeros,))); ToString();
blocks:
schema:
params:
prepared: false
ops:
# https://www.mongodb.com/docs/manual/reference/method/db.createCollection/
# https://www.mongodb.com/docs/manual/core/schema-validation/specify-json-schema/
# `clusteredIndex` only support creation of an index on `_id` field (as shown below) so its optional
create-collection: |
{
create: "TEMPLATE(collection,keyvalue)",
clusteredIndex: {
key: { "_id": 1 },
unique: true,
name: "_id_idx"
},
writeConcern: { w: "majority" },
validator: {
$jsonSchema: {
bsonType: "object",
title: "Key/Value collection schema validation",
required: [ "key" ],
properties: {
key: {
bsonType: "string",
description: "'key' must be a string and is required"
},
value: {
bsonType: "string",
description: "'value' must be a string and is optional but, recommended"
}
}
}
},
validationLevel: "strict",
validationAction: "error",
comment: "keyvalue collection creation with strict types and a required 'key' field."
}
create-key-index: |
{
createIndexes: "TEMPLATE(collection,keyvalue)",
indexes: [
{
key: {
key: 1,
},
name: "kv_key_idx",
unique: true
}
],
writeConcern: { w: "majority" },
comment: "'key' index creation for keyvalue collection. Values should be unique.",
commitQuorum: "majority"
}
rampup:
ops:
rampup-insert: |
{
insert: "TEMPLATE(collection,keyvalue)",
documents: [
{
key: "{rw_key}",
value: "{rw_value}"
}
],
comment: "Insert documents into keyvalue collection."
}
main-read:
params:
ratio: 5
ops:
main-select: |
{
find: "TEMPLATE(collection,keyvalue)",
filter: { key: { $eq: "{rw_key}" } },
readConcern: { level: "majority" },
comment: "Find the value for the given 'key'."
}
main-write:
params:
ratio: 5
ops:
main-insert: |
{
insert: "TEMPLATE(collection,keyvalue)",
documents: [
{
key: "{rw_key}",
value: "{rw_value}"
}
],
writeConcern: { w: "majority" },
comment: "Insert documents into keyvalue collection."
}
drop-collection:
ops:
drop-collection: |
{
drop: "TEMPLATE(collection,keyvalue)",
comment: "Drop keyvalue collection to start afresh."
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy