Benchmark mongodb insert update read write delete in ms?

Hi

what benchmark tools can be run from bash to test performance of mongodb installation?

(should show recrods per second insert, update, read, delete

should show how long it took to insert + update + read delete for example 1x record, 10x recrods, 100x records)

thanks

strong text GitHub - brianfrankcooper/YCSB: Yahoo! Cloud Serving Benchmark

can not edit old posts so will have to attach and attach incremental changes X-D

running this version

mongod --version
db version v8.0.5
Build Info: {
“version”: “8.0.5”,
“gitVersion”: “cb9e2e5e552ee39dea1e39d7859336456d0c9820”,
“openSSLVersion”: “OpenSSL 3.0.15 3 Sep 2024”,
“modules”: ,
“allocator”: “tcmalloc-google”,
“environment”: {
“distmod”: “debian12”,
“distarch”: “x86_64”,
“target_arch”: “x86_64”
}
}

what actually worked (crazy terminal output)

bin/ycsb.sh load basic -P workloads/workloada -p recordcount=100000000

mongotop displays no activity?

./bin/ycsb load basic -P workloads/workloada -P large.dat -s > load.dat
File “/home/user/ycsb-0.17.0/./bin/ycsb”, line 228
except subprocess.CalledProcessError, err:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: multiple exception types must be parenthesized

this java program is complicated X-D = more complexity = more errors

according to the above python based benchmark (certainly not perfect) more threads = slower performance? how to boost mondogb performance for massive parallelism? (multi threading many instances etc)

thanks but just say’n that java based benchmark is 675MBytes in size! (#wtf X-D)

there shuld be simpler easier ways to bench mongodb :smiley: (ideally compare across machines :smiley: like geekbench (but also not perfect)

what about this? https://codeberg.org/dwaves/PYTHON_EXAMPLES_ONLINE/raw/branch/main/benchmark_mongodb_multithread_singledatabase_v1-1.py dwaves/PYTHON_EXAMPLES_ONLINE: various examples, tools, small projects... to help and test - Codeberg.org

this is the above dwaves codeberg multi threaded benchmark on AMD hardware

filesystem is ext4

neofetch 
       _,met$$$$$gg.          user@debian12DevPython 
    ,g$$$$$$$$$$$$$$$P.       ---------------------- 
  ,g$$P"     """Y$$.".        OS: Debian GNU/Linux 12 (bookworm) x86_64 
 ,$$P'              `$$$.     Host: KVM/QEMU (Standard PC (Q35 + ICH9, 2009) pc-q35-7.2) 
',$$P       ,ggs.     `$$b:   Kernel: 6.1.0-28-amd64 
 $$:      $$.   -    ,d$$'    Shell: bash 5.2.15 
          `"Y$b._             CPU: 10x Cores assigned to kvm vm: AMD Ryzen 5 5600G with Radeon Graphics (8) @ 3.928GHz 
                              Memory: 2685MiB / 7843MiB 

time /usr/bin/python3.11 /home/user/git/PYTHON_EXAMPLES_ONLINE_2/benchmark_mongodb_multithread_singledatabase_v1-1.py 100000 100; # run mongodb benchmark, with 100000x records 100x threads

##### results: #####
performance_insert:  3675.52 per second
performance_read:    249.86 per second
performance_change:  208.87 per second

ime /usr/bin/python3.11 /home/user/git/PYTHON_EXAMPLES_ONLINE_2/benchmark_mongodb_multithread_singledatabase_v1-1.py 100000 10; # run mongodb benchmark, with 100000x records 10x threads

echo "scale=5; 5161/(3675/100)"|bc
140.43537

##### results: #####
performance_insert:  5161.50 per second
performance_read:    663.80 per second
performance_change:  696.20 per second

time /usr/bin/python3.11 /home/user/git/PYTHON_EXAMPLES_ONLINE_2/benchmark_mongodb_multithread_singledatabase_v1-1.py 100000 2; # run mongodb benchmark, with 100000x records 2x threads

##### results: #####
performance_insert:  8615.00 per second
performance_read:    4278.50 per second
performance_change:  4639.50 per second

observations:

  • RAM is not even 50% used
  • all CPU cores are 30% in use
  • disk activity according to iotop is max 1.5Mbytes/sec
  • less threads = faster?

can u confirm this?

how to tune mongodb for performance? (maybe even faster parallelism?)

hardware upgrades: more RAM more CPU faster HD will not help in this scenario…

results from another version, less verbose on two different systems (both virtualized)

wget https://codeberg.org/dwaves/PYTHON_EXAMPLES_ONLINE/raw/branch/main/benchmark_mongodb_multithread_singledatabase_v1-2.py

new run:

some results

neofetch
       _,met$$$$$gg.          user@debian12DevPython 
    ,g$$$$$$$$$$$$$$$P.       ---------------------- 
  ,g$$P"     """Y$$.".        OS: Debian GNU/Linux 12 (bookworm) x86_64 
 ,$$P'              `$$$.     Host: KVM/QEMU (Standard PC (Q35 + ICH9, 2009) pc-q35-7.2) 
',$$P       ,ggs.     `$$b:   Kernel: 6.1.0-28-amd64 
 $$:      $$.   -    ,d$$'    Shell: bash 5.2.15 
          `"Y$b._             CPU: 10x Cores assigned to kvm vm: AMD Ryzen 5 5600G with Radeon Graphics (8) @ 3.928GHz 
                              Memory: 2685MiB / 7843MiB 

### basic system info ###
python version:  3.11.2
kernel version:  Linux 6.1.0-28-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.119-1 (2024-11-22)
mongodb version: db version v8.0.5

# run mongodb benchmark, with 100000x records 100x threads
time /usr/bin/python3.11 /home/user/git/PYTHON_EXAMPLES_ONLINE_2/benchmark_mongodb_multithread_singledatabase_v1-2.py 100000 100; # (this is more amount of threads cores the machine has)

##### results: #####
performance_insert:  6934.01 per second
performance_read:    63.27 per second
performance_change:  69.29 per second

time /usr/bin/python3.11 /home/user/git/PYTHON_EXAMPLES_ONLINE_2/benchmark_mongodb_multithread_singledatabase_v1-2.py 100000 10; # (this is more amount of threads cores the machine has)

##### results: #####
performance_insert:  6993.00 per second
performance_read:    634.00 per second
performance_change:  675.20 per second

time /usr/bin/python3.11 /home/user/git/PYTHON_EXAMPLES_ONLINE_2/benchmark_mongodb_multithread_singledatabase_v1-2.py 100000 2; # (this is more amount of threads cores the machine has)

##### results: #####
performance_insert:  9660.00 per second
performance_read:    4254.00 per second
performance_change:  4650.00 per second

neofetch 
            .-/+oossssoo+/-.               root@ubuntu2204
        `:+ssssssssssssssssss+:`           -------------------- 
      -+ssssssssssssssssssyyssss+-         OS: Ubuntu 22.04.4 LTS x86_64 
    .ossssssssssssssssssdMMMNysssso.       Host: VMware Virtual Platform None 
   /ssssssssssshdmmNNmmyNMMMMhssssss/      Kernel: 5.15.0-133-generic 
  +ssssssssshmydMMMMMMMNddddyssssssss+     Uptime: 7 days, 11 hours, 54 mins 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   2x cores CPU: Intel Xeon E5-2690 v2 (2) @ 2.999GHz 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Memory: 2144MiB / 7937MiB 

##### benchmark_mongodb_multithread_singledatabase_v1.py #####
### basic system info ###
python version:  3.10.12
kernel version:  Linux 5.15.0-133-generic #144-Ubuntu SMP Fri Feb 7 20:47:38 UTC 2025
mongodb version: db version v6.0.15

time /usr/bin/python3 /scripts/benchmark_mongodb_multithread_singledatabase_v1-2.py 100000 10; # run the benchmark, 100000x records 10x threads

##### results: #####
performance_insert:  2756.60 per second
performance_read:    248.70 per second
performance_change:  251.70 per second

time /usr/bin/python3 /scripts/benchmark_mongodb_multithread_singledatabase_v1-2.py 100000 100; # run the benchmark, 100000x records 100x threads

##### results: #####
performance_insert:  2353.99 per second
performance_read:    22.41 per second
performance_change:  23.54 per second

time /usr/bin/python3 /scripts/benchmark_mongodb_multithread_singledatabase_v1-2.py 100000 2; # run the benchmark, 100000x records 2x threads

##### results: #####
performance_insert:  3479.50 per second
performance_read:    1548.50 per second
performance_change:  1610.00 per second

observations: write performance is much better than read performance

write and read performance but especially read performance get’s better with less threads

how to optimize tune this setup (1x server 1x database) for performance?

or add more server nodes?

currently it seems like 2x threads (no matter how many cores) is the fastest mode of operation (single server)