Benchmark mongodb insert update read write delete in ms?

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?