Significance of MongoDB document movement metrics

Hi All,

In the db.serverStatus() there is a stats called record.move.

The mongoDb documention lacks on this metrics.
When this stats will be incremented?
what is the impact if there is a spike in this stats?
How do we avoid this documentation movement?

Hi @venkataraman_r

This is actually an old MMAPv1 storage engine metrics. It’s not relevant for WiredTiger today, and is unused.

There is actually an explanation of what this metric is in the older version of the MongoDB manual that still includes MMAPv1 as a storage engine (MongoDB 4.0 was the last version that have this): serverStatus — MongoDB Manual

To quote the older doc:

For MMAPv1 Storage Engine, metrics.record.moves reports the total number of times documents move within the on-disk representation of the MongoDB data set. Documents move as a result of operations that increase the size of the document beyond their allocated record size.

In short, the old MMAPv1 storage engine allocates a certain amount of space for each document, and when a document grows beyond its allocated size, it would need to be moved to a larger space. This metric tracks how many times such a move happened. See MMAPv1 Storage Engine — MongoDB Manual if you’re interested in the historical story of how the MMAPv1 storage engine used to work :slight_smile:

Thanks for noticing this, though. I have submitted a JIRA ticket to clean up outdated metrics: SERVER-60514

Best regards


Thanks Kevin for the reply. Sorry for some reasons i missed your reply.
Couple of follow-up question.

Did you mean WT doesnt suffer with this documentation move?
Lets say, i would like to run with StorageEngine WT but my datapath resides on the tmpfs (for faster operation) dont we experience any memory fragmentation issues ?

Hi @venkataraman_r

No it doesn’t. WiredTiger works in a very different way to MMAPv1.

WiredTiger does not store a document fragmented. May I ask what kind of fragmentation do you have in mind? Do you have a scenario example so I can better understand it?

Please note that tmpfs is not one of the recommended filesystem to use with WiredTiger and it’s not a supported setup. The recommended filesystem is either xfs (strongly recommended) or ext4 (using kernel 2.6.28 or newer).

Best regards

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.