Wednesday 4 May 2016

MMAPv1: Documents and Data Files in mongoDB



Lecture Notes
At approximately 7:40, I say that document moves might leave 'holes in your document...' I meant holes in your data files.

Quiz: MMAPv1: Documents and Data Files

Relative to no padding, Power of Two Sized Allocations in MMAPv1 provides which of the following benefits? Check all that apply.
1.Document movement need no longer result in updates to your indexes.
2.Record spaces are likely to get re-used.
3.Documents will not have to move as soon as they grow in size.
4.Documents that grow at a constant rate will move less often as time goes on.

Ans.


2.Record spaces are likely to get re-used.
3.Documents will not have to move as soon as they grow in size.
4.Documents that grow at a constant rate will move less often as time goes on.

Answer
The following answers are correct:
Documents will not have to move as soon as they grow in size. - This is because you have some space to grow before you reach your record size.
Record spaces are likely to get re-used. - Without standardized sizes, the likelihood that your new document will want the same size of record space as an old document might be slim, especially if your documents have different sizes (which they will if they're all growing). With standard sizes, all documents are likely to find record spaces that fit them.
Documents that grow at a constant rate will move less often as time goes on. - This makes sense, if you think about it. If your documents start out at an average size of 20 bytes, and grow at a rate of 1 byte per day, your first move will happen in 12 days (since the smallest record size is 32 bytes). Your second move will take 32 days, and your third will take 64. Each successive move will take longer and longer.
The incorrect answer is:
Document movement need no longer result in updates to your indexes. - this is not true for MMAPv1.

No comments:

Post a Comment