20602: Add MaxQueuedRequests config.
authorTom Clegg <tom@curii.com>
Wed, 7 Jun 2023 16:37:40 +0000 (12:37 -0400)
committerTom Clegg <tom@curii.com>
Thu, 8 Jun 2023 18:31:39 +0000 (14:31 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

lib/config/config.default.yml
lib/config/export.go
lib/service/cmd.go
sdk/go/arvados/config.go

index 837ce896ea8fc78695fe21f23d543f15aa3722de..33c1e497de3fc8bbdb50b4d8cc7386eda1fa3937 100644 (file)
@@ -227,6 +227,15 @@ Clusters:
       # in a single service process, or 0 for no limit.
       MaxConcurrentRequests: 64
 
+      # Maximum number of incoming requests to hold in a priority
+      # queue waiting for one of the MaxConcurrentRequests slots to be
+      # free. When the queue is longer than this, respond 503 to the
+      # lowest priority request.
+      #
+      # If MaxQueuedRequests is 0, respond 503 immediately to
+      # additional requests while at the MaxConcurrentRequests limit.
+      MaxQueuedRequests: 64
+
       # Fraction of MaxConcurrentRequests that can be "log create"
       # messages at any given time.  This is to prevent logging
       # updates from crowding out more important requests.
index 44fd559418ea177f365921c00b89c76a1a4088b8..565be2fb7614f9bfcd8f4b12cb8d16206fca809e 100644 (file)
@@ -65,13 +65,14 @@ var whitelist = map[string]bool{
        "API.FreezeProjectRequiresDescription":     true,
        "API.FreezeProjectRequiresProperties":      true,
        "API.FreezeProjectRequiresProperties.*":    true,
-       "API.LockBeforeUpdate":                     false,
        "API.KeepServiceRequestTimeout":            false,
-       "API.MaxConcurrentRequests":                false,
+       "API.LockBeforeUpdate":                     false,
        "API.LogCreateRequestFraction":             false,
+       "API.MaxConcurrentRequests":                false,
        "API.MaxIndexDatabaseRead":                 false,
        "API.MaxItemsPerResponse":                  true,
        "API.MaxKeepBlobBuffers":                   false,
+       "API.MaxQueuedRequests":                    false,
        "API.MaxRequestAmplification":              false,
        "API.MaxRequestSize":                       true,
        "API.MaxTokenLifetime":                     false,
index 119d66191f889743de2f2407b423ca5f22663c71..1073f421dfa915e54dcb38ff9e3a02ecf7107413 100644 (file)
@@ -157,6 +157,7 @@ func (c *command) RunCommand(prog string, args []string, stdin io.Reader, stdout
                                                        &httpserver.RequestLimiter{
                                                                Handler:       handler,
                                                                MaxConcurrent: cluster.API.MaxConcurrentRequests,
+                                                               MaxQueue:      cluster.API.MaxQueuedRequests,
                                                                Registry:      reg}))))))
        srv := &httpserver.Server{
                Server: http.Server{
index 4da851763eb9d924235544c3454806fd11c52808..2e9abf2ecb4c36904e36da2dff15a4c8eea9ea2a 100644 (file)
@@ -100,6 +100,7 @@ type Cluster struct {
                MaxIndexDatabaseRead             int
                MaxItemsPerResponse              int
                MaxConcurrentRequests            int
+               MaxQueuedRequests                int
                LogCreateRequestFraction         float64
                MaxKeepBlobBuffers               int
                MaxRequestAmplification          int