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

[CELEBORN-1595] Support quota low watermark for checking quota available #2727

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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 @@ -876,6 +876,8 @@ class CelebornConf(loadDefaults: Boolean) extends Cloneable with Logging with Se
def quotaUserSpecificTenant: String = get(QUOTA_USER_SPECIFIC_TENANT)
def quotaUserSpecificUserName: String = get(QUOTA_USER_SPECIFIC_USERNAME)

def quotaLowWatermark: Double = get(QUOTA_LOW_WATERMARK)

// //////////////////////////////////////////////////////
// Client //
// //////////////////////////////////////////////////////
Expand Down Expand Up @@ -5053,6 +5055,16 @@ object CelebornConf extends Logging {
.longConf
.createWithDefault(Long.MaxValue)

val QUOTA_LOW_WATERMARK: ConfigEntry[Double] =
buildConf("celeborn.quota.lowWatermark")
.categories("quota")
.dynamic
.doc("Quota configuration for quota lowWatermark.")
.version("0.6.0")
.doubleConf
.checkValue(v => v > 0.0 && v <= 1.0, "Should be in [0.0, 1.0].")
.createWithDefault(1.0)

val COLUMNAR_SHUFFLE_ENABLED: ConfigEntry[Boolean] =
buildConf("celeborn.columnarShuffle.enabled")
.withAlternative("celeborn.columnar.shuffle.enabled")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1154,6 +1154,8 @@ private[celeborn] class Master(
context: RpcCallContext): Unit = {
val userResourceConsumption = handleResourceConsumption(userIdentifier)
if (conf.quotaEnabled) {
val quotaWatermark = conf.quotaLowWatermark

val (isAvailable, reason) =
quotaManager.checkQuotaSpaceAvailable(userIdentifier, userResourceConsumption)
context.reply(CheckQuotaResponse(isAvailable, reason))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,23 @@ class QuotaManager(celebornConf: CelebornConf, configService: ConfigService) ext
}
}

def checkQuotaSpaceAvailable(
private def getQuotaWithWatermark(
userIdentifier: UserIdentifier,
resourceResumption: ResourceConsumption): (Boolean, String) = {
quotaWatermark: Double): Quota = {
val quota = getQuota(userIdentifier)
Quota(
(quota.diskBytesWritten * quotaWatermark).toLong,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @s0nskar , I don't quite understand why can't we just config the quota to quota.diskBytesWritten * 1.0 (some user defined factor)? Is it necessary to introduce this new config?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@waitinfuture Currently Celeborn consider quota as soft limits and just stop allowing new jobs on use Celeborn if the quota is breached while the existing jobs keeps on running while breaching the quota. IMO there are two shortcoming in current quota implementation –

  • It allows new jobs to onboard even if quota is just about to be breached. Ideally it should stop onboarding jobs after a certain threshold to not go overboard with the quota limits (This PR addresses that)
  • Killing jobs if quota for an user is breached (I was planning to implement this but noticed that @leixm raised a PR to handle this today - [CELEBORN-1577][Phase1] Storage quota should support interrupt shuffle. #2801)

Copy link
Contributor Author

@s0nskar s0nskar Oct 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@waitinfuture wdyt about this? IMO this should be a must have to avoid interrupting the user/tenant jobs in bulk.

(quota.diskFileCount * quotaWatermark).toLong,
(quota.hdfsBytesWritten * quotaWatermark).toLong,
(quota.hdfsFileCount * quotaWatermark).toLong)
}

def checkQuotaSpaceAvailable(
userIdentifier: UserIdentifier,
resourceResumption: ResourceConsumption,
quotaWatermark: Double = 1.0): (Boolean, String) = {
val quota = getQuotaWithWatermark(userIdentifier, quotaWatermark)

val checkResults = Seq(
checkDiskBytesWritten(userIdentifier, resourceResumption.diskBytesWritten, quota),
checkDiskFileCount(userIdentifier, resourceResumption.diskFileCount, quota),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,27 @@ class QuotaManagerSuite extends AnyFunSuite
assert(res2 == exp2)
assert(res3 == exp3)
}

test("test check quota return result with low watermark") {
val user = UserIdentifier("tenant_01", "Jerry")
val rc1 =
ResourceConsumption(
Utils.byteStringAsBytes("99G"),
9999,
Utils.byteStringAsBytes("9999M"),
40)

val res1 = quotaManager.checkQuotaSpaceAvailable(user, rc1)
val res2 = quotaManager.checkQuotaSpaceAvailable(user, rc1, 0.9)

val exp1 = (true, "")
val exp2 = (
false,
s"User $user used diskBytesWritten (99.0 GiB) exceeds quota (90.0 GiB). " +
s"User $user used diskFileCount(9999) exceeds quota(9000). " +
s"User $user used hdfsBytesWritten(9.8 GiB) exceeds quota(9.0 GiB). ")

assert(res1 == exp1)
assert(res2 == exp2)
}
}
Loading