mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
fn: new container lauch adjustments (#677)
*) revert executor wait queue size comparison. This is too aggresive and with stall check below, now unnecessary. *) new container logic now checks if stats are constant, if this is the case, then we assume the system is stalled (eg running functions that take long time), this means we need to make progress and spin up a new container.
This commit is contained in:
@@ -152,18 +152,6 @@ func TestSlotQueueBasic1(t *testing.T) {
|
||||
}
|
||||
case <-time.After(time.Duration(500) * time.Millisecond):
|
||||
}
|
||||
|
||||
stats1 := obj.getStats()
|
||||
isNeeded, stats2 := obj.isNewContainerNeeded()
|
||||
|
||||
if stats1 != stats2 {
|
||||
t.Fatalf("Faulty stats %#v != %#v", stats1, stats2)
|
||||
}
|
||||
|
||||
// there are no waiters.
|
||||
if isNeeded {
|
||||
t.Fatalf("Shouldn't need a container")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSlotQueueBasic2(t *testing.T) {
|
||||
@@ -173,9 +161,6 @@ func TestSlotQueueBasic2(t *testing.T) {
|
||||
if !obj.isIdle() {
|
||||
t.Fatalf("Should be idle")
|
||||
}
|
||||
if ok, _ := obj.isNewContainerNeeded(); ok {
|
||||
t.Fatalf("Should not need a new container")
|
||||
}
|
||||
|
||||
outChan, cancel := obj.startDequeuer(context.Background())
|
||||
select {
|
||||
@@ -187,6 +172,27 @@ func TestSlotQueueBasic2(t *testing.T) {
|
||||
cancel()
|
||||
}
|
||||
|
||||
func TestSlotNewContainerLogic1(t *testing.T) {
|
||||
|
||||
cur := slotQueueStats{}
|
||||
cur.states[SlotQueueRunner] = 10
|
||||
cur.states[SlotQueueWaiter] = 1
|
||||
|
||||
prev := cur
|
||||
|
||||
if !isNewContainerNeeded(&cur, &prev) {
|
||||
t.Fatalf("Should need a new container cur: %#v prev: %#v", cur, prev)
|
||||
}
|
||||
|
||||
prev.latencies[SlotQueueRunner] = 1
|
||||
prev.latencies[SlotQueueWaiter] = 1
|
||||
prev.latencies[SlotQueueStarter] = 1
|
||||
|
||||
if isNewContainerNeeded(&cur, &prev) {
|
||||
t.Fatalf("Should not need a new container cur: %#v prev: %#v", cur, prev)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSlotQueueBasic3(t *testing.T) {
|
||||
|
||||
slotName := "test3"
|
||||
|
||||
Reference in New Issue
Block a user