diff options
Diffstat (limited to 'src/mongo/db/snapshot_window_options.h')
-rw-r--r-- | src/mongo/db/snapshot_window_options.h | 60 |
1 files changed, 27 insertions, 33 deletions
diff --git a/src/mongo/db/snapshot_window_options.h b/src/mongo/db/snapshot_window_options.h index 683c48c9253..93b3de975c9 100644 --- a/src/mongo/db/snapshot_window_options.h +++ b/src/mongo/db/snapshot_window_options.h @@ -36,9 +36,9 @@ namespace mongo { /** - * This is a collection of parameters that affect how much snapshot history the storage engine will - * maintain to support point-in-time transactions (read or write). This is referred to as the - * snapshot window. + * These are parameters that affect how much snapshot history the storage engine will keep to + * support point-in-time transactions (read or write). This is referred to as the snapshot window. + * The window is between the stable timestamp and the oldest timestamp. */ struct SnapshotWindowParams { @@ -59,53 +59,47 @@ struct SnapshotWindowParams { // Note that this is the history window we attempt to maintain, but our current system state may // not always reflect it: the window can only change as more writes come in, so it can take time // for the actual window size to catch up with a change. This value guides actions whenever the - // system goes to update the oldest_timestamp value. + // system goes to update the oldest_timestamp value (usually when the stable_timestamp is + // updated). AtomicWord<int> targetSnapshotHistoryWindowInSeconds{ maxTargetSnapshotHistoryWindowInSeconds.load()}; - // cachePressureThreshold (startup & runtime server paramter, range [0, 100]). - // - // Dictates what percentage of cache in use is considered too high. This setting helps preempt - // storage cache pressure immobilizing the system. Attempts to increase - // targetSnapshotHistoryWindowInSeconds will be ignored when the cache pressure reaches this - // threshold. Additionally, a periodic task will decrease targetSnapshotHistoryWindowInSeconds - // when cache pressure exceeds the threshold. - AtomicWord<int> cachePressureThreshold{50}; - // snapshotWindowMultiplicativeDecrease (startup & runtime server paramter, range (0,1)). // - // Controls by what multiplier the target snapshot history window setting is decreased when - // cache pressure becomes too high, per the cachePressureThreshold setting. + // Controls by what multiplier the target snapshot history window size setting is decreased + // when there is cache pressure. AtomicDouble snapshotWindowMultiplicativeDecrease{0.75}; // snapshotWindowAdditiveIncreaseSeconds (startup & runtime server paramter, range 1+). // - // Controls by how much the target snapshot history window setting is increased when cache - // pressure is OK, per cachePressureThreshold, and we need to service older snapshots for global - // point-in-time reads. - AtomicWord<int> snapshotWindowAdditiveIncreaseSeconds{2}; + // Controls by how much the target snapshot history window size setting is increased when we + // need to service older snapshots for global point-in-time reads. + AtomicWord<int> snapshotWindowAdditiveIncreaseSeconds{1}; // minMillisBetweenSnapshotWindowInc (startup & runtime server paramter, range 0+). - // minMillisBetweenSnapshotWindowDec (startup & runtime server paramter, range 0+). // - // Controls how often attempting to increase/decrease the target snapshot window will have an - // effect. Multiple callers within minMillisBetweenSnapshotWindowInc will have the same effect - // as one. This protects the system because it takes time for the target snapshot window to - // affect the actual storage engine snapshot window. The stable timestamp must move forward for - // the window between it and oldest timestamp to grow or shrink. + // Controls how often attempting to increase the target snapshot window will have an effect. + // Multiple callers within minMillisBetweenSnapshotWindowInc will have the same effect as one. + // This protects the system because it takes time for the target snapshot window to affect the + // actual storage engine snapshot window. The stable timestamp must move forward for the window + // between it and oldest timestamp to grow or shrink. AtomicWord<int> minMillisBetweenSnapshotWindowInc{500}; - AtomicWord<int> minMillisBetweenSnapshotWindowDec{500}; - // checkCachePressurePeriodSeconds (startup & runtime server paramter, range 1+) + // decreaseHistoryIfNotNeededPeriodSeconds (startup & runtime server paramter, range 1+) // // Controls the period of the task that checks for cache pressure and decreases - // targetSnapshotHistoryWindowInSeconds if the pressure is above cachePressureThreshold. The - // target window size setting must not be decreased too fast because time must be allowed for - // the storage engine to attempt to act on the new setting. - AtomicWord<int> checkCachePressurePeriodSeconds{5}; + // targetSnapshotHistoryWindowInSeconds if there has been pressure and no new SnapshotTooOld + // errors. + // + // This should not run very frequently. It is preferable to increase the window size, and cache + // pressure, rather than failing PIT reads. + AtomicWord<int> decreaseHistoryIfNotNeededPeriodSeconds{15}; + + static inline MutableObserverRegistry<decltype( + decreaseHistoryIfNotNeededPeriodSeconds)::WordType> + observeDecreaseHistoryIfNotNeededPeriodSeconds; - static inline MutableObeserverRegistry<decltype(checkCachePressurePeriodSeconds)::WordType> - observeCheckCachePressurePeriodSeconds; + AtomicWord<long long> snapshotTooOldErrorCount{0}; }; extern SnapshotWindowParams snapshotWindowParams; |