Skip to content
Snippets Groups Projects
Commit 47bb4997 authored by Perry's avatar Perry Committed by Rodric Rabbah
Browse files

Remove throttle tightening.

parent d24c257d
No related branches found
No related tags found
No related merge requests found
...@@ -99,7 +99,6 @@ class ThrottleTests ...@@ -99,7 +99,6 @@ class ThrottleTests
* @param results the sequence of results from invocations or firings * @param results the sequence of results from invocations or firings
*/ */
def waitForActivations(results: ParSeq[RunResult]) = results.foreach { result => def waitForActivations(results: ParSeq[RunResult]) = results.foreach { result =>
println("waiting for activations to complete")
if (result.exitCode == SUCCESS_EXIT) { if (result.exitCode == SUCCESS_EXIT) {
withActivation(wsk.activation, result, totalWait = 5.minutes)(identity) withActivation(wsk.activation, result, totalWait = 5.minutes)(identity)
} }
...@@ -135,6 +134,9 @@ class ThrottleTests ...@@ -135,6 +134,9 @@ class ThrottleTests
val results = List.fill(count)(Future { val results = List.fill(count)(Future {
if (!p.isCompleted) { if (!p.isCompleted) {
val rr = run() val rr = run()
if (rr.exitCode != SUCCESS_EXIT) {
println(s"exitCode = ${rr.exitCode} stderr = ${rr.stderr.trim}")
}
if (rr.exitCode == THROTTLED) { if (rr.exitCode == THROTTLED) {
p.trySuccess(()) p.trySuccess(())
} }
...@@ -168,9 +170,10 @@ class ThrottleTests ...@@ -168,9 +170,10 @@ class ThrottleTests
(action, _) => action.create(name, defaultAction) (action, _) => action.create(name, defaultAction)
} }
// Two things to be careful of: // Three things to be careful of:
// 1) We do not know the minute boundary so we perform twice max so that it will trigger no matter where they fall // 1) We do not know the minute boundary so we perform twice max so that it will trigger no matter where they fall
// 2) We cannot issue too quickly or else the concurrency throttle will be triggered // 2) We cannot issue too quickly or else the concurrency throttle will be triggered
// 3) In the worst case, we do about almost the limit in the first min and just exceed the limit in the second min.
val totalInvokes = 2 * maximumInvokesPerMinute val totalInvokes = 2 * maximumInvokesPerMinute
val numGroups = (totalInvokes / maximumConcurrentInvokes) + 1 val numGroups = (totalInvokes / maximumConcurrentInvokes) + 1
val invokesPerGroup = (totalInvokes / numGroups) + 1 val invokesPerGroup = (totalInvokes / numGroups) + 1
...@@ -186,11 +189,11 @@ class ThrottleTests ...@@ -186,11 +189,11 @@ class ThrottleTests
try { try {
val throttledCount = throttledActivations(results, tooManyRequests) val throttledCount = throttledActivations(results, tooManyRequests)
throttledCount should be > 0 throttledCount should be > 0
throttledCount should be <= (results.length - maximumInvokesPerMinute)
} finally { } finally {
waitForActivations(results.par)
val alreadyWaited = durationBetween(afterInvokes, Instant.now) val alreadyWaited = durationBetween(afterInvokes, Instant.now)
settleThrottles(alreadyWaited) settleThrottles(alreadyWaited)
println("clearing activations")
Try { waitForActivations(results.par) }
} }
} }
...@@ -210,7 +213,6 @@ class ThrottleTests ...@@ -210,7 +213,6 @@ class ThrottleTests
try { try {
val throttledCount = throttledActivations(results, tooManyRequests) val throttledCount = throttledActivations(results, tooManyRequests)
throttledCount should be > 0 throttledCount should be > 0
throttledCount should be <= (results.length - maximumFiringsPerMinute)
} finally { } finally {
// no need to wait for activations of triggers since they consume no resources // no need to wait for activations of triggers since they consume no resources
// (because there is no rule attached in this test) // (because there is no rule attached in this test)
...@@ -261,9 +263,10 @@ class ThrottleTests ...@@ -261,9 +263,10 @@ class ThrottleTests
val throttledCount = throttledActivations(combinedResults, tooManyConcurrentRequests) val throttledCount = throttledActivations(combinedResults, tooManyConcurrentRequests)
throttledCount should be > 0 throttledCount should be > 0
} finally { } finally {
waitForActivations(combinedResults.par)
val alreadyWaited = durationBetween(afterSlowInvokes, Instant.now) val alreadyWaited = durationBetween(afterSlowInvokes, Instant.now)
settleThrottles(alreadyWaited) settleThrottles(alreadyWaited)
println("clearing activations")
Try { waitForActivations(combinedResults.par) }
} }
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment