@@ -43,13 +43,11 @@ database table, and each document has
43
43
one or more fields, which corresponds to a column in a relational
44
44
database table.
45
45
46
- Collections are have some important differences from RDMS tables:
47
-
48
- - Documents in a single collection may have unique combination and set
49
- of fields. Documents need not have identical fields.
50
-
51
- - You can add a field to some documents in a collection without adding
52
- that field to all documents in the collection.
46
+ Collections have important differences from RDMS tables. Documents in a
47
+ single collection may have a unique combination and set of fields.
48
+ Documents need not have identical fields. You can add a field to some
49
+ documents in a collection without adding that field to all documents in
50
+ the collection.
53
51
54
52
.. see:: :doc:`/reference/sql-comparison`
55
53
@@ -174,7 +172,7 @@ SSD, this can be quite slow.
174
172
175
173
One area to watch specifically in managing the size of your working set
176
174
is index access patterns. If you are inserting into indexes at random
177
- locations (for example, with id's, which are effectively randomly
175
+ locations (as would happen with id's that are randomly
178
176
generated by hashes), you will continually be updating the whole index.
179
177
If instead you are able to create your id's in approximately ascending
180
178
order (for example, day concatenated with a random id), all the updates
@@ -183,35 +181,37 @@ index pages will be much smaller.
183
181
184
182
It is fine if databases and thus virtual size are much larger than RAM.
185
183
186
- .. _faq-fundamentals-working-set-size:
184
+ .. todo Commenting out for now:
185
+
186
+ .. _faq-fundamentals-working-set-size:
187
187
188
- How can I measure working set size?
189
- -----------------------------------
188
+ How can I measure working set size?
189
+ -----------------------------------
190
190
191
- Measuring working set size can be difficult; even if it is much smaller
192
- than total RAM. If the database is much larger than RAM in total, all
193
- memory will be indicated as in use for the cache. Thus you need a
194
- different way to estimate the working set size.
191
+ Measuring working set size can be difficult; even if it is much
192
+ smaller than total RAM. If the database is much larger than RAM in
193
+ total, all memory will be indicated as in use for the cache. Thus you
194
+ need a different way to estimate the working set size.
195
195
196
- One technique is to use the
197
- `eatmem.cpp <https://github.com/mongodb/mongo-snippets/blob/master/cpp/eatmem.cpp>`_.
198
- utility, which reserves a certain amount of system memory for itself.
199
- You can run the utility with a certain amount specified and see if the
200
- server continues to perform well. If not, the working set is larger than
201
- the total RAM minus the consumed RAM. The test will eject some data from
202
- the file system cache, which might take time to page back in after the
203
- utility is terminated.
196
+ One technique is to use the `eatmem.cpp
197
+ <https://github.com/mongodb/mongo-snippets/blob/master/cpp/eatmem.cpp>`_.
198
+ utility, which reserves a certain amount of system memory for itself.
199
+ You can run the utility with a certain amount specified and see if
200
+ the server continues to perform well. If not, the working set is
201
+ larger than the total RAM minus the consumed RAM. The test will eject
202
+ some data from the file system cache, which might take time to page
203
+ back in after the utility is terminated.
204
204
205
- Running eatmem.cpp continuously with a small percentage of total RAM,
206
- such as 20%, is a good technique to get an early warning if memory is
207
- too low. If disk I/O activity increases significantly, terminate
208
- eatmem.cpp to mitigate the problem for the moment until further steps
209
- can be taken.
205
+ Running eatmem.cpp continuously with a small percentage of total RAM,
206
+ such as 20%, is a good technique to get an early warning if memory is
207
+ too low. If disk I/O activity increases significantly, terminate
208
+ eatmem.cpp to mitigate the problem for the moment until further steps
209
+ can be taken.
210
210
211
- In :term:`replica sets <replica set>`, if one server is underpowered the
212
- eatmem.cpp utility could help as an early warning mechanism for server
213
- capacity. Of course, the server must be receiving representative traffic
214
- to get an indication.
211
+ In :term:`replica sets <replica set>`, if one server is underpowered
212
+ the eatmem.cpp utility could help as an early warning mechanism for
213
+ server capacity. Of course, the server must be receiving
214
+ representative traffic to get an indication.
215
215
216
216
How do I calculate how much RAM I need for my application?
217
217
----------------------------------------------------------
@@ -221,7 +221,7 @@ How do I calculate how much RAM I need for my application?
221
221
The amount of RAM you need depends on several factors, including but not
222
222
limited to:
223
223
224
- - The relationship between :ref :`database storage </faq/storage>` and working set.
224
+ - The relationship between :doc :`database storage </faq/storage>` and working set.
225
225
226
226
- The operating system's cache strategy for LRU (Least Recently Used)
227
227
@@ -241,13 +241,9 @@ your particular usage.
241
241
To calculate how much RAM you need, you must calculate your working set
242
242
size, i.e., the portion of your data that is frequently accessed. This
243
243
depends on your access patterns, what indexes you have, and the size of
244
- your documents. To calculate working set size, see:
245
-
246
- - :ref:`faq-fundamentals-working-set`
247
-
248
- - :ref:`faq-fundamentals-working-set-size`
244
+ your documents. To calculate working set size, see :ref:`faq-fundamentals-working-set`.
249
245
250
- If page faults are low (for example, below than 100 / sec) , your
246
+ If page faults are infrequent , your
251
247
working set fits in RAM. If fault rates rise higher than that, you risk
252
248
performance degradation. This is less critical with SSD drives than
253
249
with spinning disks.
@@ -305,15 +301,16 @@ directly from the indexes and/or data files.
305
301
Are writes written to disk immediately, or lazily?
306
302
--------------------------------------------------
307
303
308
- Writes are physically written to the journal within 100
304
+ Writes are physically written to the :doc:` journal </administration/journaling>` within 100
309
305
milliseconds. At that point, the write is "durable" in the sense that
310
306
after a pull-plug-from-wall event, the data will still be recoverable after
311
307
a hard restart.
312
308
313
309
While the journal commit is nearly instant, MongoDB writes to the data
314
310
files lazily. MongoDB may wait to write data to the data files for as
315
- much as one minute. This does not affect durability, as the journal
316
- has enough information to ensure crash recovery.
311
+ much as one minute by default. This does not affect durability, as the journal
312
+ has enough information to ensure crash recovery. To change the interval
313
+ for writing to the data files, see :setting:`syncdelay`.
317
314
318
315
What language is MongoDB written in?
319
316
------------------------------------
0 commit comments