Skip to content

Commit 60ba781

Browse files
authored
Revert "DOCSP-29500 Clarify oplog Sizing (#131)" (#134)
This reverts commit d1fb748.
1 parent d5d906a commit 60ba781

File tree

3 files changed

+60
-35
lines changed

3 files changed

+60
-35
lines changed

source/faq.txt

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

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.
36-
3734
.. include:: /includes/fact-oplog-background
3835

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
44+
45+
To estimate the size of ``oplog`` needed for initial synchronization,
46+
see: :ref:`c2c-oplog-sizing`.
47+
3948
To learn more about how to increase the size of the ``oplog``, see:
4049
:ref:`tutorial-change-oplog-size`.
4150

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
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``.
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.
104

115
If you anticipate syncing a large data set, or if you plan to pause
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-
6+
synchronization for an extended period of time, increase the size of the
7+
replica set ``oplog`` in the source cluster.

source/reference/oplog-sizing.txt

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@ 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 ``oplog`` time range.
19+
be within the :term:`oplog` time range.
2020

21+
.. include:: /includes/fact-oplog-background.txt
2122

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

2726
.. procedure::
@@ -41,30 +40,55 @@ Monitor ``oplog`` Size Needed for Initial Sync
4140
cluster. If there are multiple shards, the smallest number is the
4241
minimum ``oplog`` window.
4342

44-
.. step:: Determine mongosync replication lag
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.
4552

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.
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
5173

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

5476
.. step:: Validate ``oplog`` Size
5577

56-
If the lag time approaches the minimum ``oplog`` window, you
57-
should make one of the following changes:
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:
5881

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

6588
.. note::
6689

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.
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.
7094

0 commit comments

Comments
 (0)