Details
Description
I have been running the insert benchmark for MongoDB 3.6.5 and 4.0.0 with WiredTiger. Some of what I learned is at https://groups.google.com/forum/#!topic/wiredtiger-users/FvVMCVqLa_E
This is open to discuss making mongod shutdown faster. Here is one example where each line represents a separate configuration. The legend is:
- secs - seconds to shutdown
- cacheGB - size of WT cache in GB
- sps - syncPeriodSecs value
- ct - value of eviction_checkpoint_target, def == default
- dirty - value of eviction_dirty_trigger, def == default
- config - see gist
- wGB - GB of writes at shutdown, per iostat
- wMB/s - average rate for write MB/s at shutdown
secs  cacheGB sps   ct   dirty  config wGB   wMB/s
 63   120   60   def   def   v1    8.0  135.5
 65   120   300   def   def   v2    8.1  133.0
789 Â Â 120Â Â Â 60Â Â Â 1Â Â Â 90Â Â Â v6Â Â Â 43.5 Â Â 55.2
816 Â Â 120Â Â Â 60 Â Â 10Â Â Â 90Â Â Â v7Â Â Â 43.5 Â Â 53.4
476 Â Â 120 Â Â 300Â Â Â 1Â Â Â 90Â Â Â v10 Â Â 27.6 Â Â 58.1
471 Â Â 120 Â Â 300 Â Â 10Â Â Â 90Â Â Â v11 Â Â 27.8 Â Â 59.1
123 Â Â 120 Â Â 300Â Â Â 0Â Â Â 20Â Â Â v13 Â Â 19.3Â Â 157.1
120 Â Â 120 Â Â 300Â Â Â 1Â Â Â 20Â Â Â v14 Â Â 12.3Â Â 103.1
315 Â Â 120 Â Â 300Â Â Â 0Â Â Â 40Â Â Â v16 Â Â 22.5 Â Â 71.7
308 Â Â 120 Â Â 300Â Â Â 1Â Â Â 40Â Â Â v17 Â Â 21.1 Â Â 68.8
357 Â Â 120 Â Â 300Â Â Â 0Â Â Â 60Â Â Â v19 Â Â 17.4 Â Â 48.8
354 Â Â 120 Â Â 300Â Â Â 1Â Â Â 60Â Â Â v20 Â Â 16.5 Â Â 46.7
448 Â Â 120 Â Â 300Â Â Â 0Â Â Â 80Â Â Â v22 Â Â 23.8 Â Â 53.0
447 Â Â 120 Â Â 300Â Â Â 1Â Â Â 80Â Â Â v23 Â Â 24.0 Â Â 53.7
{{ 68   120   30   def   def   v25   18.9  281.8}}
{{ 65   120   180   def   def   v26   22.0  343.3}}
{{ 64   120   600   def   def   v27   32.5  516.5}}
The min time to shutdown is 60 seconds. I get that a b-tree needs to flush dirty pages at shutdown or do crash recovery at startup so it can't be instantaneous. But from the wMB/s numbers above, except for the last 3 configurations, the write IO rate isn't great considering the storage devices can sustain more than 1GB/s.
This was measured by doing the load for the insert benchmark with 250m docs inserted by 16 clients, each using a separate collection and then shutting down mongod when the insert ends.
See http://smalldatum.blogspot.com/2017/06/the-insert-benchmark.html for more on the insert benchmark and that includes a link to the code.