mirror of
https://github.com/openfaas/faas.git
synced 2025-06-23 07:13:23 +00:00
Add Concurrency Limiter
This enables limiting concurrency. It is a naive approach which will reject requests as soon as they exceed the maximum number of in-flight requests. It is a port of the following PR from the new watchdog code: https://github.com/openfaas-incubator/of-watchdog/pull/54 Signed-off-by: Sargun Dhillon <sargun@sargun.me> Signed-off-by: Lucas Roesler <roesler.lucas@gmail.com>
This commit is contained in:
committed by
Alex Ellis
parent
45cf4db4cb
commit
b019f6ca54
@ -92,6 +92,7 @@ func (ReadConfig) Read(hasEnv HasEnv) WatchdogConfig {
|
||||
}
|
||||
|
||||
cfg.metricsPort = 8081
|
||||
cfg.maxInflight = parseIntValue(hasEnv.Getenv("max_inflight"), 0)
|
||||
|
||||
return cfg
|
||||
}
|
||||
@ -137,4 +138,10 @@ type WatchdogConfig struct {
|
||||
|
||||
// metricsPort is the HTTP port to serve metrics on
|
||||
metricsPort int
|
||||
|
||||
// maxInflight limits the number of simultaneous
|
||||
// requests that the watchdog allows concurrently.
|
||||
// Any request which exceeds this limit will
|
||||
// have an immediate response of 429.
|
||||
maxInflight int
|
||||
}
|
||||
|
Reference in New Issue
Block a user