You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2017/11/09 12:13:20 UTC
[GitHub] markusthoemmes commented on a change in pull request #2888: Adapt trigger throttle for multiple controllers
markusthoemmes commented on a change in pull request #2888: Adapt trigger throttle for multiple controllers
URL: https://github.com/apache/incubator-openwhisk/pull/2888#discussion_r149945095
##########
File path: core/controller/src/main/scala/whisk/core/entitlement/RateThrottler.scala
##########
@@ -43,14 +44,17 @@ class RateThrottler(description: String, defaultMaxPerMinute: Int, overrideMaxPe
/**
* Checks whether the operation should be allowed to proceed.
* Every `check` operation charges the subject namespace for one operation.
+ * Allows 20% of additional requests on top of the limit to mitigate possible unfair round-robin loadbalancing between
+ * controllers
*
* @param user the identity to check
* @return true iff subject namespace is below allowed limit
*/
def check(user: Identity)(implicit transid: TransactionId): RateLimit = {
val uuid = user.uuid // this is namespace identifier
val throttle = rateMap.getOrElseUpdate(uuid, new RateInfo)
- val limit = overrideMaxPerMinute(user).getOrElse(defaultMaxPerMinute)
+ val limit =
+ Math.ceil((overrideMaxPerMinute(user).getOrElse(defaultMaxPerMinute).toDouble / diviser.toDouble) * 1.2).toInt
Review comment:
This computation needs to be done only iff controllerHA is active. I propose to adjust the values passed into the RateThrottlers based on the controllerHA value one level above instead of passing everything through here. Should leave the RateThrottler untouched.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services