| container | script | cpu | mem | delay (s) |
|---|---|---|---|---|
| mongo | paginated | ± 49% | ± 37% | 16.481s |
| node | paginated | ± 50% | ± 16.8% | 16.481s |
| mongo | stream | ± 5% | ± 37% | 3.497s |
| node | stream | ± 50% | ± 15.5% | 3.497s |
I've added a mongo.zip file inside mongo folder in the root of the project. Just extract the content in mongo folder and run the scripts.
docker run -d \
--name mongodb \
-v $PWD/mongo:/data/db \
-e MONGO_INITDB_ROOT_USERNAME=root \
-e MONGO_INITDB_ROOT_PASSWORD=root \
-p 27017:27017 \
mongoIf failed to connect to the database, add the user to the database which we will use in the mongo shell
use example_db
db.createUser(
{
user: "root",
pwd: "root",
roles: [
{role: "readWrite", db: "example_db"}
]
}
)# Each execution adds 50.000 new users
npm run populate# Paginated query
npm run paginated
# Stream query
npm run streamdocker build -t node-example .docker compose up -d --builddocker exec -it node-example bashcd /app
# Paginated query
npm run paginated
# Stream query
npm run stream