From 46138f22707ee2bac40b292da6050ce19b3ffceb Mon Sep 17 00:00:00 2001 From: Haoming Meng Date: Fri, 19 Jan 2024 16:05:50 +0000 Subject: [PATCH] Add config params for `stat` --- docs/parameters.yaml | 30 ++++++++++++++++++++++++++++++ param/parameters.go | 4 ++++ param/parameters_struct.go | 9 ++++++++- 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/docs/parameters.yaml b/docs/parameters.yaml index 4935f57a5..0782a57b0 100644 --- a/docs/parameters.yaml +++ b/docs/parameters.yaml @@ -556,6 +556,36 @@ root_default: /var/cache/pelican/maxmind/GeoLite2-City.mmdb default: $ConfigBase/maxmind/GeoLite2-city.mmdb components: ["director"] --- +name: Director.MinStatResponse +description: >- + A positive integer indicating minimum number of origin's responses required for a `stat` call +type: int +default: 1 +components: ["director"] +--- +name: Director.MaxStatResponse +description: >- + A positive integer indicating maximum number of origin's responses required for a `stat` call. + `stat` call will cancel the rest of the ongoing query if max reponse is hit. +type: int +default: 1 +components: ["director"] +--- +name: Director.StatTimeout +description: >- + The timeout for a single `stat` request. +type: duration +default: 200ms +components: ["director"] +--- +name: Director.StatConcurrencyLimit +description: >- + The maximum number of concurrent `stat` request to a single origin server. + Additional requests are blocked until total requests for the origin is below limit +type: int +default: 100 +components: ["director"] +--- ############################ # Registry-level configs # ############################ diff --git a/param/parameters.go b/param/parameters.go index e793442f9..57545c9a1 100644 --- a/param/parameters.go +++ b/param/parameters.go @@ -151,6 +151,9 @@ var ( Client_SlowTransferRampupTime = IntParam{"Client.SlowTransferRampupTime"} Client_SlowTransferWindow = IntParam{"Client.SlowTransferWindow"} Client_StoppedTransferTimeout = IntParam{"Client.StoppedTransferTimeout"} + Director_MaxStatResponse = IntParam{"Director.MaxStatResponse"} + Director_MinStatResponse = IntParam{"Director.MinStatResponse"} + Director_StatConcurrencyLimit = IntParam{"Director.StatConcurrencyLimit"} MinimumDownloadSpeed = IntParam{"MinimumDownloadSpeed"} Monitoring_PortHigher = IntParam{"Monitoring.PortHigher"} Monitoring_PortLower = IntParam{"Monitoring.PortLower"} @@ -185,6 +188,7 @@ var ( ) var ( + Director_StatTimeout = DurationParam{"Director.StatTimeout"} Federation_TopologyReloadInterval = DurationParam{"Federation.TopologyReloadInterval"} Monitoring_TokenExpiresIn = DurationParam{"Monitoring.TokenExpiresIn"} Monitoring_TokenRefreshInterval = DurationParam{"Monitoring.TokenRefreshInterval"} diff --git a/param/parameters_struct.go b/param/parameters_struct.go index a5fdd0052..c2661e7c0 100644 --- a/param/parameters_struct.go +++ b/param/parameters_struct.go @@ -29,7 +29,11 @@ type config struct { DefaultResponse string GeoIPLocation string MaxMindKeyFile string + MaxStatResponse int + MinStatResponse int OriginResponseHostnames []string + StatConcurrencyLimit int + StatTimeout time.Duration } DisableHttpProxy bool DisableProxyFallback bool @@ -193,7 +197,11 @@ type configWithType struct { DefaultResponse struct { Type string; Value string } GeoIPLocation struct { Type string; Value string } MaxMindKeyFile struct { Type string; Value string } + MaxStatResponse struct { Type string; Value int } + MinStatResponse struct { Type string; Value int } OriginResponseHostnames struct { Type string; Value []string } + StatConcurrencyLimit struct { Type string; Value int } + StatTimeout struct { Type string; Value time.Duration } } DisableHttpProxy struct { Type string; Value bool } DisableProxyFallback struct { Type string; Value bool } @@ -332,4 +340,3 @@ type configWithType struct { SummaryMonitoringHost struct { Type string; Value string } } } -