Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a configurable DLQ capacity of avoid OOM #18387

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public void onCacheMissRead() {
// previous position
// halve the prefetch size to be conservative
mPrefetchSize /= 2;
// To avoid the convergence of the prefetch size at 2 * read length - 1
mPrefetchSize++;
}

@Override
Expand Down
19 changes: 14 additions & 5 deletions dora/core/common/src/main/java/alluxio/conf/PropertyKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -2311,11 +2311,7 @@ public String toString() {
public static final PropertyKey MASTER_DORA_LOAD_JOB_TOTAL_FAILURE_COUNT_THRESHOLD =
intBuilder(Name.MASTER_DORA_LOAD_JOB_TOTAL_FAILURE_COUNT_THRESHOLD)
.setDefaultValue(-1)
.setDescription(
"The load job total load failure count threshold. -1 means never fail. "
+ "Note that we persist failed tasks in memory for retrying purpose and "
+ "on average one subtask takes up 0.5KB in memory. Properly set this property "
+ "to avoid OOM.")
.setDescription("The load job total load failure count threshold. -1 means never fail. ")
.setConsistencyCheckLevel(ConsistencyCheckLevel.WARN)
.setScope(Scope.SERVER)
.build();
Expand All @@ -2327,6 +2323,17 @@ public String toString() {
.setConsistencyCheckLevel(ConsistencyCheckLevel.WARN)
.setScope(Scope.SERVER)
.build();
public static final PropertyKey MASTER_DORA_LOAD_JOB_RETRY_DLQ_CAPACITY =
intBuilder(Name.MASTER_DORA_LOAD_JOB_RETRY_DLQ_CAPACITY)
.setDefaultValue(1_000_000)
.setDescription(
"The capacity of the dead letter queue we persist failed tasks in memory "
+ "for retrying purpose. Once the queue is full, failed subtasks will not retry"
+ "and will just fail. On average one subtask takes up 0.5KB in memory. "
+ " Properly set this property to avoid OOM.")
.setConsistencyCheckLevel(ConsistencyCheckLevel.WARN)
.setScope(Scope.SERVER)
.build();
public static final PropertyKey MASTER_DORA_LOAD_JOB_FAILED_FILE_LIST_DIR =
stringBuilder(Name.MASTER_DORA_LOAD_JOB_FAILED_FILE_LIST_DIR)
.setDefaultValue(format("${%s}/job_results/load", Name.WORK_DIR))
Expand Down Expand Up @@ -7554,6 +7561,8 @@ public static final class Name {
"alluxio.master.dora.load.job.total.failure.count.threshold";
public static final String MASTER_DORA_LOAD_JOB_TOTAL_FAILURE_RATIO_THRESHOLD =
"alluxio.master.dora.load.job.total.failure.ratio.threshold";
public static final String MASTER_DORA_LOAD_JOB_RETRY_DLQ_CAPACITY =
"alluxio.master.dora.load.job.retry.dlq.capacity";
public static final String MASTER_DORA_LOAD_JOB_FAILED_FILE_LIST_DIR =
"alluxio.master.dora.load.job.failed.file.list.dir";
public static final String MASTER_DAILY_BACKUP_ENABLED =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ public class DoraLoadJob extends AbstractJob<DoraLoadJob.DoraLoadTask> {
PropertyKey.MASTER_DORA_LOAD_JOB_TOTAL_FAILURE_RATIO_THRESHOLD);
private static final int FAILURE_COUNT_THRESHOLD = Configuration.getInt(
PropertyKey.MASTER_DORA_LOAD_JOB_TOTAL_FAILURE_COUNT_THRESHOLD);
private static final int RETRY_DLQ_CAPACITY = Configuration.getInt(
PropertyKey.MASTER_DORA_LOAD_JOB_RETRY_DLQ_CAPACITY);
private final boolean mSkipIfExists;

private final Optional<String> mFileFilterRegx;
Expand Down Expand Up @@ -404,7 +406,7 @@ public void addLoadedBytes(long bytes) {

private void addSubTaskToRetryOrFail(LoadSubTask subTask, FailureReason reason, String message) {
LOG.debug("Retry file {}", subTask);
if (subTask.isRetry() || !isHealthy()) {
if (subTask.isRetry() || !isHealthy() || mRetrySubTasksDLQ.size() >= RETRY_DLQ_CAPACITY) {
addFileFailure(subTask, reason, message);
return;
}
Expand Down Expand Up @@ -460,8 +462,7 @@ public int hashCode() {

@Override
public boolean isHealthy() {
// Tasks to retry are considered as "failed" tasks when calculating if the job is healthy.
long totalFailureCount = mTotalFinalFailureCount.get() + mRetrySubTasksDLQ.size();
long totalFailureCount = mTotalFinalFailureCount.get();
if (FAILURE_RATIO_THRESHOLD >= 1.0 || FAILURE_COUNT_THRESHOLD < 0) {
return true;
}
Expand Down
Loading