tysonnorris commented on a change in pull request #4186: Track activation
counts in ContainerPool (not ContainerProxy)
URL:
https://github.com/apache/incubator-openwhisk/pull/4186#discussion_r252818538
##########
File path:
tests/src/test/scala/org/apache/openwhisk/core/containerpool/test/ContainerPoolTests.scala
##########
@@ -588,6 +685,73 @@ class ContainerPoolObjectTests extends FlatSpec with
Matchers with MockFactory {
}
+ it should "use a warming when active activation count < maxconcurrent" in {
+ val concurrencyEnabled =
Option(WhiskProperties.getProperty("whisk.action.concurrency")).exists(_.toBoolean)
+ val maxConcurrent = if (concurrencyEnabled) 25 else 1
+
+ val action = createAction(limits = ActionLimits(concurrency =
ConcurrencyLimit(maxConcurrent)))
+ val data = warmingData(active = maxConcurrent - 1, action = action)
+ val pool = Map('warming -> data)
+ ContainerPool.schedule(data.action, data.invocationNamespace, pool)
shouldBe Some('warming, data)
+
+ val data2 = warmedData(active = maxConcurrent - 1, action = action)
+ val pool2 = pool ++ Map('warm -> data2)
+
+ ContainerPool.schedule(data2.action, data2.invocationNamespace, pool2)
shouldBe Some('warm, data2)
+
+ }
+ it should "prefer warm to warming when active activation count <
maxconcurrent" in {
+ val concurrencyEnabled =
Option(WhiskProperties.getProperty("whisk.action.concurrency")).exists(_.toBoolean)
+ val maxConcurrent = if (concurrencyEnabled) 25 else 1
+
+ val action = createAction(limits = ActionLimits(concurrency =
ConcurrencyLimit(maxConcurrent)))
+ val data = warmingColdData(active = maxConcurrent - 1, action = action)
+ val data2 = warmedData(active = maxConcurrent - 1, action = action)
+ val pool = Map('warming -> data, 'warm -> data2)
+ ContainerPool.schedule(data.action, data.invocationNamespace, pool)
shouldBe Some('warm, data2)
+
+ }
+ it should "use a warmingCold when active activation count < maxconcurrent"
in {
+ val concurrencyEnabled =
Option(WhiskProperties.getProperty("whisk.action.concurrency")).exists(_.toBoolean)
+ val maxConcurrent = if (concurrencyEnabled) 25 else 1
+
+ val action = createAction(limits = ActionLimits(concurrency =
ConcurrencyLimit(maxConcurrent)))
+ val data = warmingColdData(active = maxConcurrent - 1, action = action)
+ val pool = Map('warmingCold -> data)
+ ContainerPool.schedule(data.action, data.invocationNamespace, pool)
shouldBe Some('warmingCold, data)
+
+ //after scheduling, the pool will update with new data to set active =
maxConcurrent
+ val data2 = warmingColdData(active = maxConcurrent, action = action)
+ val pool2 = Map('warmingCold -> data2)
+
+ ContainerPool.schedule(data2.action, data2.invocationNamespace, pool2)
shouldBe None
+
+ }
+
+ it should "prefer warm to warmingCold when active activation count <
maxconcurrent" in {
+ val concurrencyEnabled =
Option(WhiskProperties.getProperty("whisk.action.concurrency")).exists(_.toBoolean)
+ val maxConcurrent = if (concurrencyEnabled) 25 else 1
+
+ val action = createAction(limits = ActionLimits(concurrency =
ConcurrencyLimit(maxConcurrent)))
+ val data = warmingColdData(active = maxConcurrent - 1, action = action)
+ val data2 = warmedData(active = maxConcurrent - 1, action = action)
+ val pool = Map('warmingCold -> data, 'warm -> data2)
+ ContainerPool.schedule(data.action, data.invocationNamespace, pool)
shouldBe Some('warm, data2)
+
Review comment:
there's a theme here 😄
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services