@@ -28,7 +28,7 @@ What will be the default storage engine going forward?
28
28
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29
29
30
30
MMAPv1 is the default storage engine in 3.0. With multiple storage
31
- engines, you will always be able to decide which storage engine is
31
+ engines, you can decide which storage engine is
32
32
best for your application.
33
33
34
34
Can you mix storage engines in a replica set?
@@ -47,14 +47,14 @@ following:
47
47
captures data files from MongoDB: you may need to maintain backups
48
48
for each storage engine.
49
49
50
- Wired Tiger Storage Engine
51
- --------------------------
50
+ WiredTiger Storage Engine
51
+ -------------------------
52
52
53
53
Can I upgrade an existing deployment to a WiredTiger?
54
54
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
55
55
56
56
Yes. You can upgrade an existing deployment to WiredTiger while the
57
- deployment remains continuously available by adding replica set
57
+ deployment remains available by adding replica set
58
58
members with the new storage engine and then removing members with the
59
59
legacy storage engine. See the following sections of the
60
60
:doc:`/release-notes/3.0-upgrade` for the complete procedure that you
@@ -68,13 +68,72 @@ How much compression does WiredTiger provide?
68
68
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69
69
70
70
The ratio of compressed data to uncompressed data depends on your data
71
- and the compression library used. Collection data in WiredTiger use
72
- Snappy :term:`block compression` by default, although `` zlib` `
73
- compression is also optionally available. Index data use
74
- :term:`prefix compression` by default.
71
+ and the compression library used. By default, collection data in
72
+ WiredTiger use :term:`Snappy block compression <snappy>`; :term:` zlib`
73
+ compression is also available. Index data use :term:`prefix
74
+ compression` by default.
75
75
76
- MMAP Storage Engine
77
- -------------------
76
+ .. _wt-cache-and-eviction:
77
+
78
+ To what size should I set the WiredTiger cache?
79
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
80
+
81
+ The size of the cache should be sufficient to hold the entire working
82
+ set for the :program:`mongod`. If the cache does not have enough space
83
+ to load additional data, WiredTiger evicts pages from the cache to free
84
+ up space.
85
+
86
+ To see statistics on the cache and eviction, use the
87
+ :dbcommand:`serverStatus` command. The
88
+ :data:`~serverStatus.wiredTiger.cache` field holds the information on
89
+ the cache and eviction:
90
+
91
+ .. code-block:: none
92
+
93
+ ...
94
+ "wiredTiger" : {
95
+ ...
96
+ "cache" : {
97
+ "tracked dirty bytes in the cache" : <num>,
98
+ "bytes currently in the cache" : <num>,
99
+ "maximum bytes configured" : <num>,
100
+ "bytes read into cache" :<num>,
101
+ "bytes written from cache" : <num>,
102
+ "pages evicted by application threads" : <num>,
103
+ "checkpoint blocked page eviction" : <num>,
104
+ "unmodified pages evicted" : <num>,
105
+ "page split during eviction deepened the tree" : <num>,
106
+ "modified pages evicted" : <num>,
107
+ "pages selected for eviction unable to be evicted" : <num>,
108
+ "pages evicted because they exceeded the in-memory maximum" : <num>,,
109
+ "pages evicted because they had chains of deleted items" : <num>,
110
+ "failed eviction of pages that exceeded the in-memory maximum" : <num>,
111
+ "hazard pointer blocked page eviction" : <num>,
112
+ "internal pages evicted" : <num>,
113
+ "maximum page size at eviction" : <num>,
114
+ "eviction server candidate queue empty when topping up" : <num>,
115
+ "eviction server candidate queue not empty when topping up" : <num>,
116
+ "eviction server evicting pages" : <num>,
117
+ "eviction server populating queue, but not evicting pages" : <num>,
118
+ "eviction server unable to reach eviction goal" : <num>,
119
+ "pages split during eviction" : <num>,
120
+ "pages walked for eviction" : <num>,
121
+ "eviction worker thread evicting pages" : <num>,
122
+ "in-memory page splits" : <num>,
123
+ "percentage overhead" : <num>,
124
+ "tracked dirty pages in the cache" : <num>,
125
+ "pages currently held in the cache" : <num>,
126
+ "pages read into cache" : <num>,
127
+ "pages written from cache" : <num>,
128
+ },
129
+ ...
130
+
131
+ To adjust the size of the WiredTiger cache, see
132
+ :setting:`storage.wiredTiger.engineConfig.cacheSizeGB` and
133
+ :option:`--wiredTigerCacheSizeGB`.
134
+
135
+ MMAPv1 Storage Engine
136
+ ---------------------
78
137
79
138
.. _faq-storage-memory-mapped-files:
80
139
@@ -84,25 +143,23 @@ What are memory mapped files?
84
143
A memory-mapped file is a file with data that the operating system
85
144
places in memory by way of the ``mmap()`` system call. ``mmap()`` thus
86
145
*maps* the file to a region of virtual memory. Memory-mapped files are
87
- the critical piece of the storage engine in MongoDB. By using memory
88
- mapped files MongoDB can treat the contents of its data files as if
146
+ the critical piece of the MMAPv1 storage engine in MongoDB. By using memory
147
+ mapped files, MongoDB can treat the contents of its data files as if
89
148
they were in memory. This provides MongoDB with an extremely fast and
90
149
simple method for accessing and manipulating data.
91
150
92
151
How do memory mapped files work?
93
152
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
94
153
95
- Memory mapping assigns files to a block of virtual memory with a
96
- direct byte-for-byte correlation. Once mapped, the relationship
97
- between file and memory allows MongoDB to interact with the data in
98
- the file as if it were memory.
154
+ MongoDB uses memory mapped files for managing and interacting with all
155
+ data.
99
156
100
- How does MongoDB work with memory mapped files?
101
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
157
+ Memory mapping assigns files to a block of virtual memory with a direct
158
+ byte-for-byte correlation. MongoDB memory maps data files to memory as
159
+ it accesses documents. Unaccessed data is *not* mapped to memory.
102
160
103
- MongoDB uses memory mapped files for managing and interacting with all
104
- data. MongoDB memory maps data files to memory as it accesses
105
- documents. Data that isn't accessed is *not* mapped to memory.
161
+ Once mapped, the relationship between file and memory allows MongoDB to
162
+ interact with the data in the file as if it were memory.
106
163
107
164
.. _faq-disk-size:
108
165
@@ -171,38 +228,6 @@ inserted into the database. Consider the following possible causes:
171
228
running. Be aware that :dbcommand:`repairDatabase` will block
172
229
all other operations and may take a long time to complete.
173
230
174
- How do I know when the server runs out of disk space?
175
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
176
-
177
- If your server runs out of disk space for data files, you will see
178
- something like this in the log:
179
-
180
- .. code-block:: none
181
-
182
- Thu Aug 11 13:06:09 [FileAllocator] allocating new data file dbms/test.13, filling with zeroes...
183
- Thu Aug 11 13:06:09 [FileAllocator] error failed to allocate new file: dbms/test.13 size: 2146435072 errno:28 No space left on device
184
- Thu Aug 11 13:06:09 [FileAllocator] will try again in 10 seconds
185
- Thu Aug 11 13:06:19 [FileAllocator] allocating new data file dbms/test.13, filling with zeroes...
186
- Thu Aug 11 13:06:19 [FileAllocator] error failed to allocate new file: dbms/test.13 size: 2146435072 errno:28 No space left on device
187
- Thu Aug 11 13:06:19 [FileAllocator] will try again in 10 seconds
188
-
189
- The server remains in this state forever, blocking all writes
190
- including deletes. However, reads still work. With MMAPv1 you can
191
- delete some data and compact, using the :dbcommand:`compact` command;
192
- however, you must restart the server first.
193
-
194
- If your server runs out of disk space for journal files, the server
195
- process will exit. By default, :program:`mongod` creates journal files
196
- in a sub-directory of :setting:`~storage.dbPath` named ``journal``. You may
197
- elect to put the journal files on another storage device using a
198
- filesystem mount or a symlink.
199
-
200
- .. note::
201
-
202
- If you place the journal files on a separate storage device you
203
- will not be able to use a file system snapshot tool to capture a
204
- valid snapshot of your data files and journal files.
205
-
206
231
.. _faq-working-set:
207
232
208
233
What is the working set?
@@ -253,59 +278,74 @@ storage engine, needs access to data that isn't currently in active
253
278
memory. A "hard" page fault refers to situations when MongoDB must
254
279
access a disk to access the data. A "soft" page fault, by contrast,
255
280
merely moves memory pages from one list to another, such as from an
256
- operating system file cache. In production, MongoDB will rarely
257
- encounter soft page faults.
281
+ operating system file cache.
258
282
259
283
See :ref:`administration-monitoring-page-faults` for more information.
260
284
261
285
Data Storage Diagnostics
262
286
------------------------
263
287
264
- How can I check the size of indexes?
265
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
266
-
267
- To view the size of the data allocated for an index, use one of the
268
- following procedures in the :program:`mongo` shell:
269
-
270
- Check the value of :data:`~collStats.indexSizes` in the output of the
271
- :method:`db.collection.stats()` method.
272
-
273
288
How can I check the size of a collection?
274
289
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
275
290
276
- To view the size of a collection and other information , use the
277
- :method:`db.collection.stats()` method from the :program:`mongo` shell.
278
- The following example issues :method:`db.collection.stats()` for the
279
- ``orders`` collection:
291
+ To view the statistics for a collection, including the data size , use
292
+ the :method:`db.collection.stats()` method from the :program:`mongo`
293
+ shell. The following example issues :method:`db.collection.stats()` for
294
+ the ``orders`` collection:
280
295
281
296
.. code-block:: javascript
282
297
283
298
db.orders.stats();
284
299
285
- To view specific measures of size, use these methods:
300
+ MongoDB also provides the following methods to return specific sizes
301
+ for the collection:
286
302
287
- - :method:`db.collection.dataSize()`: data size in bytes for the collection.
288
- - :method:`db.collection.storageSize()`: allocation size in bytes, including unused space.
289
- - :method:`db.collection.totalSize()`: the data size plus the index size in bytes.
290
- - :method:`db.collection.totalIndexSize()`: the index size in bytes.
303
+ - :method:`db.collection.dataSize()` to return data size in bytes for
304
+ the collection.
291
305
292
- Also, the following scripts print the statistics for each database and
293
- collection:
306
+ - :method:`db.collection.storageSize()` to return allocation size in
307
+ bytes, including unused space.
308
+
309
+ - :method:`db.collection.totalSize()` to return the data size plus the
310
+ index size in bytes.
311
+
312
+ - :method:`db.collection.totalIndexSize()` to return the index size in
313
+ bytes.
314
+
315
+ The following script prints the statistics for each database:
294
316
295
317
.. code-block:: javascript
296
318
297
- db._adminCommand("listDatabases").databases.forEach(function (d) {mdb = db.getSiblingDB(d.name); printjson(mdb.stats())})
319
+ db._adminCommand("listDatabases").databases.forEach(function (d) {
320
+ mdb = db.getSiblingDB(d.name);
321
+ printjson(mdb.stats());
322
+ })
323
+
324
+ The following script prints the statistics for each collection in each
325
+ database:
298
326
299
327
.. code-block:: javascript
300
328
301
- db._adminCommand("listDatabases").databases.forEach(function (d) {mdb = db.getSiblingDB(d.name); mdb.getCollectionNames().forEach(function(c) {s = mdb[c].stats(); printjson(s)})})
329
+ db._adminCommand("listDatabases").databases.forEach(function (d) {
330
+ mdb = db.getSiblingDB(d.name);
331
+ mdb.getCollectionNames().forEach(function(c) {
332
+ s = mdb[c].stats();
333
+ printjson(s);
334
+ })
335
+ })
336
+
337
+ How can I check the size of indexes for a collection?
338
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
339
+
340
+ To view the size of the data allocated for an index, use the
341
+ :method:`db.collection.stats()` method and check the
342
+ :data:`~collStats.indexSizes` field in the returned document.
302
343
303
344
.. _faq-tools-for-measuring-storage-use:
304
345
305
- What tools can I use to investigate storage use in MongoDB ?
346
+ How can I get information on the storage use of a database ?
306
347
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
307
348
308
- The :method:`db.stats()` method in the :program:`mongo` shell
309
- returns the current state of the "active" database. The
310
- :dbcommand:`dbStats` document describes
311
- the fields in the :method:`db.stats()` output.
349
+ The :method:`db.stats()` method in the :program:`mongo` shell returns
350
+ the current state of the "active" database. For the description of the
351
+ returned fields, see :ref:`dbStats Output <dbstats-output>`.
0 commit comments