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:
@@ -306,6 +306,7 @@ func (a *agent) hotLauncher(ctx context.Context, callObj *call) {
|
||||
logger := common.Logger(ctx)
|
||||
logger.WithField("launcher_timeout", timeout).Info("Hot function launcher starting")
|
||||
isAsync := callObj.Type == models.TypeAsync
|
||||
prevStats := callObj.slots.getStats()
|
||||
|
||||
for {
|
||||
select {
|
||||
@@ -319,14 +320,22 @@ func (a *agent) hotLauncher(ctx context.Context, callObj *call) {
|
||||
case <-callObj.slots.signaller:
|
||||
}
|
||||
|
||||
isNeeded, stats := callObj.slots.isNewContainerNeeded()
|
||||
logger.WithField("stats", stats).Debug("Hot function launcher stats")
|
||||
curStats := callObj.slots.getStats()
|
||||
isNeeded := isNewContainerNeeded(&curStats, &prevStats)
|
||||
prevStats = curStats
|
||||
logger.WithFields(logrus.Fields{
|
||||
"currentStats": curStats,
|
||||
"previousStats": curStats,
|
||||
}).Debug("Hot function launcher stats")
|
||||
if !isNeeded {
|
||||
continue
|
||||
}
|
||||
|
||||
resourceCtx, cancel := context.WithCancel(context.Background())
|
||||
logger.WithField("stats", stats).Info("Hot function launcher starting hot container")
|
||||
logger.WithFields(logrus.Fields{
|
||||
"currentStats": curStats,
|
||||
"previousStats": curStats,
|
||||
}).Info("Hot function launcher starting hot container")
|
||||
|
||||
select {
|
||||
case tok, isOpen := <-a.resources.GetResourceToken(resourceCtx, callObj.Memory, isAsync):
|
||||
|
||||
Reference in New Issue
Block a user