Class PagesWriteSpeedBasedThrottle
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.persistence.pagemem.PagesWriteSpeedBasedThrottle
-
- All Implemented Interfaces:
PagesWriteThrottlePolicy
public class PagesWriteSpeedBasedThrottle extends Object implements PagesWriteThrottlePolicy
Throttles threads that generate dirty pages during ongoing checkpoint. Designed to avoid zero dropdowns that can happen if checkpoint buffer is overflowed. When the page in question is not included in the current checkpoint and Checkpoint Buffer is filled over 2/3, uses exponentially growing sleep time to throttle. Otherwise, uses average checkpoint write speed and instant speed of marking pages as dirty.- See Also:
- Speed-based throttling description
-
-
Field Summary
-
Fields inherited from interface org.apache.ignite.internal.processors.cache.persistence.pagemem.PagesWriteThrottlePolicy
CP_BUF_FILL_THRESHOLD, DFLT_THROTTLE_LOG_THRESHOLD, LOGGING_THRESHOLD
-
-
Constructor Summary
Constructors Constructor Description PagesWriteSpeedBasedThrottle(PageMemoryImpl pageMemory, IgniteOutClosure<CheckpointProgress> cpProgress, CheckpointLockStateChecker stateChecker, IgniteLogger log)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoPark(long throttleParkTimeNs)Disables the current thread for thread scheduling purposes.longgetCpWriteSpeed()doublegetCurrDirtyRatio()longgetLastEstimatedSpeedForMarkAll()longgetMarkDirtySpeed()doublegetTargetDirtyRatio()booleanisCpBufferOverflowThresholdExceeded()Whether Checkpoint Buffer is currently close to exhaustion.voidonBeginCheckpoint()Callback to notify throttling policy checkpoint was started.voidonFinishCheckpoint()Callback to notify throttling policy checkpoint was finished.voidonMarkDirty(boolean isPageInCheckpoint)Callback to apply throttling delay.longthrottleParkTime()doublethrottleWeight()Measurement shows how much throttling time is involved into average marking time.voidwakeupThrottledThreads()Callback to wakeup throttled threads.
-
-
-
Constructor Detail
-
PagesWriteSpeedBasedThrottle
public PagesWriteSpeedBasedThrottle(PageMemoryImpl pageMemory, IgniteOutClosure<CheckpointProgress> cpProgress, CheckpointLockStateChecker stateChecker, IgniteLogger log)
- Parameters:
pageMemory- Page memory.cpProgress- Database manager.stateChecker- Checkpoint lock state provider.log- Logger.
-
-
Method Detail
-
onMarkDirty
public void onMarkDirty(boolean isPageInCheckpoint)
Callback to apply throttling delay.- Specified by:
onMarkDirtyin interfacePagesWriteThrottlePolicy- Parameters:
isPageInCheckpoint- flag indicating if current page is in scope of current checkpoint.
-
doPark
protected void doPark(long throttleParkTimeNs)
Disables the current thread for thread scheduling purposes. May be overriden by subclasses for tests- Parameters:
throttleParkTimeNs- the maximum number of nanoseconds to wait
-
onBeginCheckpoint
public void onBeginCheckpoint()
Callback to notify throttling policy checkpoint was started.- Specified by:
onBeginCheckpointin interfacePagesWriteThrottlePolicy
-
onFinishCheckpoint
public void onFinishCheckpoint()
Callback to notify throttling policy checkpoint was finished.- Specified by:
onFinishCheckpointin interfacePagesWriteThrottlePolicy
-
throttleParkTime
public long throttleParkTime()
- Returns:
- Exponential backoff counter.
-
getTargetDirtyRatio
public double getTargetDirtyRatio()
- Returns:
- Target (maximum) dirty pages ratio, after which throttling will start.
-
getCurrDirtyRatio
public double getCurrDirtyRatio()
- Returns:
- Current dirty pages ratio.
-
getMarkDirtySpeed
public long getMarkDirtySpeed()
- Returns:
- Speed of marking pages dirty. Value from past 750-1000 millis only. Pages/second.
-
getCpWriteSpeed
public long getCpWriteSpeed()
- Returns:
- Speed average checkpoint write speed. Current and 3 past checkpoints used. Pages/second.
-
getLastEstimatedSpeedForMarkAll
public long getLastEstimatedSpeedForMarkAll()
- Returns:
- last estimated speed for marking all clear pages as dirty till the end of checkpoint.
-
throttleWeight
public double throttleWeight()
Measurement shows how much throttling time is involved into average marking time.- Returns:
- metric started from 0.0 and showing how much throttling is involved into current marking process.
-
wakeupThrottledThreads
public void wakeupThrottledThreads()
Callback to wakeup throttled threads. Invoked when the Checkpoint Buffer use drops below a certain threshold.- Specified by:
wakeupThrottledThreadsin interfacePagesWriteThrottlePolicy
-
isCpBufferOverflowThresholdExceeded
public boolean isCpBufferOverflowThresholdExceeded()
Whether Checkpoint Buffer is currently close to exhaustion.- Specified by:
isCpBufferOverflowThresholdExceededin interfacePagesWriteThrottlePolicy- Returns:
trueif measures like throttling to protect Checkpoint Buffer should be applied, andfalseotherwise.
-
-