Why does Mongodb production notes have no recommendations about the disk block size? AFAIU, disk block size would have a considerable impact on a throughput intensive application. Does disk block size have any impact on mongodb performance in practice?
2 Answers
Why does Mongodb production notes have no recommendations about the disk block size?
As per MongoDB documentation Configure Block Size in a Blockstore When you back up your deployment to a Blockstores, the Backup Daemon first takes a snapshot of the head database. It then breaks this snapshot into blocks and writes these blocks to the blockstore.
The different blockstores have different default sizes and ranges of sizes for blocks.
Blockstore Type Block Size Range Default Size
MongoDB 64 KB to 15 MB 64 KB
S3 64 KB to 16 MB 16 MB
In general, increasing block size results in faster snapshots and restores, but requires more disk space. These competing factors should be considered when determining if you wish to tune the block size.
There are two exceptions where performance improves as the block size increases without requiring additional disk space:
Workload Impact
Update- and Delete-Intensive No matter how small you make the block size, the entire block file is rewritten. Since the entire file is always rewritten, there is no difference in storage space if you change the block size.
Insert-only The existing blocks never change. As you increase block size, block management is simplified. This enables the best possible performance on snapshot and restore.
The range of minimum block sizes include:
64 KB
128 KB
256 KB
512 KB
1 MB
2 MB
4 MB
8 MB
15 MB (MongoDB) or 16 MB (S3)
Does disk block size have any impact on mongodb performance in practice?
As per Blog from @Colt McAnlis, here “The default block size on volumes is 4K. For throughput-oriented workloads, values of 256KB or above are recommended.”
It’s important to observe the following formula wrt disk performance:
Throughput (M/sB) = IOPS * Blocksize.
How this evens out is that IOPS and block Size tend to have an inverse relationship to each other. As block size increases, it takes longer latency to read a single block, and thus the # of IOPS decreases. Inversely, smaller block sizes yield higher IOPS.
For further your ref here
-
1Blockstores is irrelevant here, it is a separate database to store snapshots. I had read McAnlist's blog ; I had doubts about MongoDB specific implications.ankshah– ankshah2018-11-16 13:29:51 +00:00Commented Nov 16, 2018 at 13:29
MongoDB doesn't but WiredTiger does. See: https://source.wiredtiger.com/3.1.0/tune_page_size_and_comp.html
-
1While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Reviewarmitage– armitage2022-11-20 19:14:25 +00:00Commented Nov 20, 2022 at 19:14