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

Updated ActivationThrottler to compute limit and compare against totalInflightActivations in cluster #1

Open
wants to merge 1 commit into
base: update-error-responses
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 @@ -72,7 +72,7 @@ object Messages {

/** Standard message for too many concurrent activation requests within a time window. */
def tooManyConcurrentRequests(count: Int, allowed: Int) =
s"Too many concurrent requests in flight (currently running: $count, allowed per controller: $allowed)."
s"Too many concurrent requests in flight (count: $count, allowed: $allowed)."

/** System overload message. */
val systemOverloaded = "System is overloaded, try again later."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ class ActivationThrottler(loadBalancer: LoadBalancer, concurrencyLimit: Identity
* Checks whether the operation should be allowed to proceed.
*/
def check(user: Identity)(implicit tid: TransactionId): Future[RateLimit] = {
loadBalancer.activeActivationsFor(user.namespace.uuid).map { concurrentActivations =>
val currentLimit = concurrencyLimit(user)
loadBalancer.totalActiveActivations.map { totalInflightActivations =>
val currentLimit = concurrencyLimit(user) * loadBalancer.clusterSize
logging.debug(
this,
s"namespace = ${user.namespace.uuid.asString}, concurrent activations = $concurrentActivations, below limit = $currentLimit")
ConcurrentRateLimit(concurrentActivations, currentLimit)
s"namespace = ${user.namespace.uuid.asString}, total inflight activations = $totalInflightActivations, limit = $currentLimit")
ConcurrentRateLimit(totalInflightActivations, currentLimit)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/src/test/scala/limits/ThrottleTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ class NamespaceSpecificThrottleTests
}

wsk.action.invoke(actionName, expectedExitCode = TooManyRequests.intValue).stderr should {
include(prefix(tooManyConcurrentRequests(0, 0))) and include("allowed per controller: 0")
include(prefix(tooManyConcurrentRequests(0, 0))) and include("allowed: 0")
}
}

Expand Down