@@ -16,12 +16,11 @@ The :ref:`mongosync <c2c-mongosync>` program uses :ref:`change streams
1616<changeStreams>` to synchronize data between source and destination
1717clusters. ``mongosync`` does not access the :term:`oplog` directly,
1818but 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