Skip to content

Commit d1fb748

Browse files
kennethdyertfogo
andauthored
DOCSP-29500 Clarify oplog Sizing (#131)
* DOCSP-29500 clarify oplog sizing * fixes build issue * Refactors text * Refactors text * Refactors text * Fixes per Dave * Fixes per Evgeni * fixes per Alex * fixes per Alex --------- Co-authored-by: Tim Fogarty <[email protected]>
1 parent 3e20a12 commit d1fb748

File tree

3 files changed

+35
-60
lines changed

3 files changed

+35
-60
lines changed

source/faq.txt

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,10 @@ clusters.
3131
Should I increase the size of the ``oplog`` in the source cluster?
3232
------------------------------------------------------------------
3333

34-
.. include:: /includes/fact-oplog-background
35-
36-
The proper ``oplog`` size depends on system hardware, network speed,
37-
and other factors including system workload. However, assuming network
38-
transfer speeds of 30-50GB per hour, a rough formula to estimate the
39-
required ``oplog`` size is:
40-
41-
.. code-block:: shell
42-
43-
minimumRetentionHours = dataSizeInGB / 30
34+
The :term:`oplog` is a special capped collection that keeps a rolling
35+
record of all operations that modify the data stored in your databases.
4436

45-
To estimate the size of ``oplog`` needed for initial synchronization,
46-
see: :ref:`c2c-oplog-sizing`.
37+
.. include:: /includes/fact-oplog-background
4738

4839
To learn more about how to increase the size of the ``oplog``, see:
4940
:ref:`tutorial-change-oplog-size`.
Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1-
The :term:`oplog` in the source cluster must be large enough to track
2-
events that happen during the time it takes to complete the initial
3-
sync to the destination cluster.
1+
2+
``mongosync`` applies operations in the ``oplog`` on the source cluster
3+
to the data on the destination cluster. When older operations
4+
that ``mongosync`` has not applied roll off the ``oplog``
5+
on the source cluster, the sync fails and ``mongosync`` exits.
6+
7+
During initial sync, ``mongosync`` may apply operations at a slower
8+
rate. After ``mongosync`` completes the initial sync, it applies changes
9+
faster and stays more current in the source cluster ``oplog``.
410

511
If you anticipate syncing a large data set, or if you plan to pause
6-
synchronization for an extended period of time, increase the size of the
7-
replica set ``oplog`` in the source cluster.
12+
synchronization for an extended period of time, you might exceed the
13+
:term:`oplog window`. Use the :setting:`~replication.oplogSizeMB` setting
14+
to increase the size of the ``oplog`` on the source cluster.
15+

source/reference/oplog-sizing.txt

Lines changed: 19 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ The :ref:`mongosync <c2c-mongosync>` program uses :ref:`change streams
1616
<changeStreams>` to synchronize data between source and destination
1717
clusters. ``mongosync`` does not access the :term:`oplog` directly,
1818
but when a change stream returns events from the past, the events must
19-
be within the :term:`oplog` time range.
19+
be within the ``oplog`` time range.
2020

21-
.. include:: /includes/fact-oplog-background.txt
2221

23-
Estimate ``oplog`` Size Needed for Initial Sync
22+
.. include:: /includes/fact-oplog-background
23+
24+
Monitor ``oplog`` Size Needed for Initial Sync
2425
-----------------------------------------------
2526

2627
.. procedure::
@@ -40,55 +41,30 @@ Estimate ``oplog`` Size Needed for Initial Sync
4041
cluster. If there are multiple shards, the smallest number is the
4142
minimum ``oplog`` window.
4243

43-
.. step:: Estimate Copy Rate During Synching
44-
45-
.. _c2c-step-est-size:
46-
47-
To gather performance data while synching, start the sync process
48-
and monitor how fast data is transferred between clusters.
49-
50-
To start syncing, run the :ref:`/start <c2c-api-start>`
51-
command.
44+
.. step:: Determine mongosync replication lag
5245

53-
To get the ``copy_rate``:
54-
55-
- run the :ref:`/progress <c2c-api-progress>` command to get
56-
``estimatedCopiedBytes_time01``
57-
- wait a second or two
58-
- run the :ref:`/progress <c2c-api-progress>` command to get
59-
``estimatedCopiedBytes_time02``
60-
61-
The ``copy_rate`` is:
62-
63-
.. code-block:: shell
64-
65-
copy_rate = ( estimatedCopiedBytes_time02 - estimatedCopiedBytes_01) / time_between_requests
66-
67-
.. step:: Estimate Copy Time
68-
69-
Estimate the time needed to copy the entire collection. The
70-
estimated copy time is:
71-
72-
.. code-block:: shell
46+
To get the ``lagTimeSeconds`` value, run the
47+
:ref:`/progress <c2c-api-progress>` command.
48+
The lag time is the time in seconds between the
49+
last event applied by ``mongosync`` and time of the current
50+
latest event on the source cluster.
7351

74-
estimatedCopyTime = estimatedTotalBytes / copy_rate
52+
It is a measure of how far behind the source cluster mongosync is.
7553

7654
.. step:: Validate ``oplog`` Size
7755

78-
If the estimated time is larger than the minimum oplog window you
79-
must cancel synchronization. Before restarting, make one of the
80-
following changes:
56+
If the lag time approaches the minimum ``oplog`` window, you
57+
should make one of the following changes:
8158

82-
- Increase the oplog window. Use :dbcommand:`replSetResizeOplog`
83-
to set ``minRetentionHours`` greater than the estimated copy
84-
time.
59+
- Increase the ``oplog`` window. Use :dbcommand:`replSetResizeOplog`
60+
to set ``minRetentionHours`` greater than the current ``oplog``
61+
window.
8562
- Scale up the ``mongosync`` instance. Add cpu or memory to scale
8663
up the ``mongosync`` node so that it has a higher copy rate.
8764

8865
.. note::
8966

90-
The copy rate may vary during synchronization. To monitor progress,
91-
repeat the :ref:`steps to estimate the copy rate
92-
<c2c-step-est-size>` and verify that the copy rate stays about the
93-
same.
67+
The ``oplog`` window and rate of change of replication lag may vary during
68+
synchronization. Repeat these steps during a migration to monitor the
69+
progress.
9470

0 commit comments

Comments
 (0)