You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: draft/faq/storage.txt
+30-11Lines changed: 30 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -18,20 +18,32 @@ the :doc:`complete list of FAQs </faq>` or post your question to the
18
18
What are Memory Mapped Files?
19
19
-----------------------------
20
20
21
-
Memory mapped files are segments of virtual memory which have been assigned a direct byte-for-byte correlation with some portion of a file or resource. Once present, this correlation between the file and the memory space permits applications to treat the mapped portion as if it were primary memory.
21
+
Memory mapped files are segments of virtual memory which have been
22
+
assigned a direct byte-for-byte correlation with some portion of a
23
+
file or resource. Once present, this correlation between the file and
24
+
the memory space permits applications to treat the mapped portion as
25
+
if it were primary memory.
22
26
23
27
How does memory-mapped file access work in MongoDB?
24
28
----------------------------------------
25
29
26
30
MongoDB uses memory-mapped files for memory management.
27
31
28
-
MongoDB memory maps the files when they are first accessed; you're letting the OS know you'd like the contents of the files available as if they were in some portion of memory. It should be noted that each OS caches its own components in memory, and also provides memory buffers for network connections and disk drivers in addition to applications.
32
+
MongoDB memory maps the files when they are first accessed; you're
33
+
letting the OS know you'd like the contents of the files available as
34
+
if they were in some portion of memory. It should be noted that each
35
+
OS caches its own components in memory, and also provides memory
36
+
buffers for network connections and disk drivers in addition to
37
+
applications.
29
38
30
39
This doesn't necessarily mean the files are in memory already-- when you go to
31
40
access any point, the OS checks if this 'page' is in physical ram or
32
41
not.
33
42
34
-
If the page is already in memory, it returns whatever's in memory in that location. If the page is not in memory, then it will fetch that portion of the file, make sure it's in memory, and then return it to you.
43
+
If the page is already in memory, it returns whatever's in memory in
44
+
that location. If the page is not in memory, then it will fetch that
45
+
portion of the file, make sure it's in memory, and then return it to
46
+
you.
35
47
36
48
Writing works in the same fashion-- MongoDB tries to write to a memory
37
49
page. If the page is in RAM, then it works quickly (just swapping some bits
@@ -53,25 +65,32 @@ load it into RAM...an expensive task, overall.
53
65
What is the difference between soft and hard page faults?
A page fault implies a "hard" page fault, which requires disk access. A "soft" page fault merely moves memory pages from one list to another, and is not as expensive.
68
+
A page fault implies a "hard" page fault, which requires disk access.
69
+
A "soft" page fault merely moves memory pages from one list to
70
+
another, and is not as expensive.
57
71
58
72
What tools can I use to investigate storage use in MongoDB?
There is a command whose output provides the current state of the "active" database, see :doc: 'Database Statistics Reference </reference/database-statistics>'.
75
+
There is a command whose output provides the current state of the
76
+
"active" database, see :doc: 'Database Statistics Reference
77
+
</reference/database-statistics>'.
62
78
63
79
What is the working set?
64
80
------------------------
65
81
66
-
The working set is an approximation of the set of pages that a certain process will access in the future (say, during the next 't' time units), and more specifically is suggested to be an indication of what pages ought to be kept in main memory to allow most progress to be made in the execution of that process.
82
+
The working set is an approximation of the set of pages that a certain
83
+
process will access in the future (say, during the next 't' time
84
+
units), and more specifically is suggested to be an indication of what
85
+
pages ought to be kept in main memory to allow most progress to be
86
+
made in the execution of that process.
67
87
68
88
A common misconception in using MongoDB is that the working set can be
69
89
reduced to a discrete value. It's important to understand that the
70
90
working set is simply a way of thinking about the data one is
71
91
accessing and that which MongoDB is working with frequently.
72
92
73
-
For instance, if you are running a query that has to do a full table scan, then your working set is every document scanned.
74
-
Conversely, if your query only reads the most recent 100
75
-
documents, then the working set will be those 100 documents.
0 commit comments