Skip to content

Franck's Repository for MongoDB Learning, Analyzing, and Benchmarking

License

Notifications You must be signed in to change notification settings

FranckPachot/mlab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MLAB

MongoDB Learning, Analyzing, and Benchmarking

You might expect some blog post about MongoDB data modeling and performance on my dev.to, and discussions on Linkedin and Twitter

Example to start and use this lab

Start mongodb, prometheus, mongodb_exporter (from percona) and grafana:

docker compose down
docker compose up -d

Run some workload (insert for 5 minutes) defined in functions.js

docker compose run --rm mongosh # the entrypoint loads automatically /config/functions.js

 db.demo.drop(); 
 db.runCommand( {
   create: "demo",
   clusteredIndex: { "key": { _id: 1 }, "unique": true, "name": "demo clustered key" }
 } )

 run(30,bulkInsert, db.demo, 1, 1000);
 run(30,insertOne,db.demo);
 run(30,queryValue,db.demo);
 run(30,queryRange,db.demo);
 deleteAll(db.demo);
 db.demo.createIndex({ value: 1 });
 run(30,bulkInsert, db.demo, 1, 1000);
 run(30,replaceOne,db.demo);
 run(30,updateOne,db.demo);
 run(30,deleteOne,db.demo);
 run(30,deleteMany,db.demo);
 deleteAll(db.demo);

Run a custom workload from ten connections:

mlab(){
 for i in $(seq 1 $1)
 do
  docker compose run -T mongosh --eval "load('/config/functions.js'); run($2)" < /dev/null |
   sed -e "s/^/$i\\t/" &
 done
 wait
}

mlab 10 "300,bulkInsert,db.demo,1,1000" 

output

Run mongostat ( fields listed in mongostat.fields ):

docker compose run mongostat

mongostats

Watch grafana dashboard on port 3000 (user/password admin/admin):

image

(The first run was with a clustered index, the second one with non-clustered)

About

Franck's Repository for MongoDB Learning, Analyzing, and Benchmarking

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published