public interface PagesWriteThrottlePolicy
There are two resources that get (or might get) consumed when writing:
Write throttling solves this problem by slowing down the writers to a rate at which they do not exhaust any of the two resources.
An alternative to just slowing down is to wait in a loop till the resource we're after gets freed, and only then allow the write to happen. The problem with this approach is that we cannot wait in a loop/sleep under a write lock, so the logic would be a lot more complicated. Maybe in the future we'll follow this path, but for now, a simpler approach of just throttling is used (see below).
If we just slow writers down by throttling their writes, AND we have enough Checkpoint Buffer and pages in segments to take some load bursts, we are fine. Under such assumptions, it does not matter whether we throttle a writer thread before acquiring write lock or after it gets released; in the current implementation, this happens after write lock gets released (because it was considered simpler to implement).
The actual throttling happens when a page gets marked dirty by calling onMarkDirty(boolean).
There are two additional methods for interfacing with other parts of the system:
wakeupThrottledThreads() which wakes up the threads currently being throttled; in the current
implementation, it is called when Checkpoint Buffer utilization falls below 1/2.isCpBufferOverflowThresholdExceeded() which is called by a checkpointer to see whether the Checkpoint Buffer is
in a danger zone and, if yes, it starts to prioritize writing pages from the Checkpoint Buffer over
pages from the normal checkpoint sequence.| Modifier and Type | Field and Description |
|---|---|
static float |
CP_BUF_FILL_THRESHOLD
Checkpoint buffer fullfill upper bound.
|
static int |
DFLT_THROTTLE_LOG_THRESHOLD |
static long |
LOGGING_THRESHOLD
Max park time.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
isCpBufferOverflowThresholdExceeded()
Whether Checkpoint Buffer is currently close to exhaustion.
|
void |
onBeginCheckpoint()
Callback to notify throttling policy checkpoint was started.
|
void |
onFinishCheckpoint()
Callback to notify throttling policy checkpoint was finished.
|
void |
onMarkDirty(boolean isPageInCheckpoint)
Callback to apply throttling delay.
|
void |
wakeupThrottledThreads()
Callback to wakeup throttled threads.
|
static final int DFLT_THROTTLE_LOG_THRESHOLD
static final long LOGGING_THRESHOLD
static final float CP_BUF_FILL_THRESHOLD
void onMarkDirty(boolean isPageInCheckpoint)
isPageInCheckpoint - flag indicating if current page is in scope of current checkpoint.void wakeupThrottledThreads()
void onBeginCheckpoint()
void onFinishCheckpoint()
boolean isCpBufferOverflowThresholdExceeded()
true if measures like throttling to protect Checkpoint Buffer should be applied,
and false otherwise.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.15.0 Release Date : April 25 2023