Adding Concurrency in Pool Manager (#1698)

Concurrency in the pool manager allows specializing pods concurrently based on a specified limit. 

Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
This commit is contained in:
Rahul Bhati
2020-09-16 18:48:08 +05:30
committed by GitHub
co-authored by Vishal
parent c1ac7fcd38
commit f3fe3123b3
25 changed files with 659 additions and 402 deletions
+2 -2
View File
@@ -35,7 +35,7 @@ func Commands() *cobra.Command {
flag.FnEnvName, flag.FnEntryPoint, flag.FnPkgName,
flag.FnExecutorType, flag.FnCfgMap, flag.FnSecret,
flag.FnSpecializationTimeout, flag.FnExecutionTimeout,
flag.FnIdleTimeout,
flag.FnIdleTimeout, flag.FnConcurrency,
// TODO retired pkg & trigger related flags from function cmd
flag.PkgCode, flag.PkgSrcArchive, flag.PkgDeployArchive,
@@ -86,7 +86,7 @@ func Commands() *cobra.Command {
flag.FnEnvName, flag.FnEntryPoint, flag.FnPkgName,
flag.FnExecutorType, flag.FnSecret, flag.FnCfgMap,
flag.FnSpecializationTimeout, flag.FnExecutionTimeout,
flag.FnIdleTimeout,
flag.FnIdleTimeout, flag.FnConcurrency,
flag.PkgCode, flag.PkgSrcArchive, flag.PkgDeployArchive,
flag.PkgSrcChecksum, flag.PkgDeployChecksum, flag.PkgInsecure,
+7
View File
@@ -41,6 +41,7 @@ import (
const (
DEFAULT_MIN_SCALE = 1
DEFAULT_TARGET_CPU_PERCENTAGE = 80
DEFAULT_CONCURRENCY = 5
)
type CreateSubCommand struct {
@@ -96,6 +97,11 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
fnIdleTimeout := input.Int(flagkey.FnIdleTimeout)
fnConcurrency := DEFAULT_CONCURRENCY
if input.IsSet(flagkey.FnConcurrency) {
fnConcurrency = input.Int(flagkey.FnConcurrency)
}
pkgName := input.String(flagkey.FnPackageName)
secretNames := input.StringSlice(flagkey.FnSecret)
@@ -294,6 +300,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
InvokeStrategy: *invokeStrategy,
FunctionTimeout: fnTimeout,
IdleTimeout: &fnIdleTimeout,
Concurrency: fnConcurrency,
},
}
+4
View File
@@ -155,6 +155,10 @@ func (opts *UpdateSubCommand) complete(input cli.Input) error {
function.Spec.IdleTimeout = &fnTimeout
}
if input.IsSet(flagkey.FnConcurrency) {
function.Spec.Concurrency = input.Int(flagkey.FnConcurrency)
}
if len(pkgName) == 0 {
pkgName = function.Spec.Package.PackageRef.Name
}
+1
View File
@@ -110,6 +110,7 @@ var (
FnTestHeader = Flag{Type: StringSlice, Name: flagkey.FnTestHeader, Short: "H", Usage: "Request headers"}
FnTestQuery = Flag{Type: StringSlice, Name: flagkey.FnTestQuery, Short: "q", Usage: "Request query parameters: -q key1=value1 -q key2=value2"}
FnIdleTimeout = Flag{Type: Int, Name: flagkey.FnIdleTimeout, Usage: "The length of time (in seconds) that a function is idle before pod(s) are eligible for recycling", DefaultValue: 120}
FnConcurrency = Flag{Type: Int, Name: flagkey.FnConcurrency, Aliases: []string{"con"}, Usage: "Maximum number of pods specialized concurrently to serve requests", DefaultValue: 5}
HtName = Flag{Type: String, Name: flagkey.HtName, Usage: "HTTP trigger name"}
HtMethod = Flag{Type: String, Name: flagkey.HtMethod, Usage: "HTTP Method: GET|POST|PUT|DELETE|HEAD", DefaultValue: http.MethodGet}
+1
View File
@@ -63,6 +63,7 @@ const (
FnTestHeader = "header"
FnTestQuery = "query"
FnIdleTimeout = "idletimeout"
FnConcurrency = "concurrency"
HtName = resourceName
HtMethod = "method"