From 8837cf93e202b330b5bb99faa80100f928b23a56 Mon Sep 17 00:00:00 2001 From: Manuel de Brito Fontes Date: Sun, 28 May 2017 16:05:49 -0400 Subject: [PATCH] Allow customization of variables hash tables --- controllers/nginx/configuration.md | 2 ++ controllers/nginx/pkg/config/config.go | 10 ++++++++++ controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl | 3 +++ 3 files changed, 15 insertions(+) diff --git a/controllers/nginx/configuration.md b/controllers/nginx/configuration.md index eb4a8c0d34..d7d4b2c460 100644 --- a/controllers/nginx/configuration.md +++ b/controllers/nginx/configuration.md @@ -469,6 +469,8 @@ The following table shows the options, the default value and a description. |ssl-session-timeout|10m| |use-gzip|"true"| |use-http2|"true"| +|variables-hash-bucket-size|64| +|variables-hash-max-size|2048| |vts-status-zone-size|10m| |whitelist-source-range|permit all| |worker-processes|number of CPUs| diff --git a/controllers/nginx/pkg/config/config.go b/controllers/nginx/pkg/config/config.go index 9829876eb2..a1f00401b2 100644 --- a/controllers/nginx/pkg/config/config.go +++ b/controllers/nginx/pkg/config/config.go @@ -275,6 +275,14 @@ type Configuration struct { // Defines the load balancing algorithm to use. The deault is round-robin LoadBalanceAlgorithm string `json:"load-balance,omitempty"` + + // Sets the bucket size for the variables hash table. + // http://nginx.org/en/docs/http/ngx_http_map_module.html#variables_hash_bucket_size + VariablesHashBucketSize int `json:"variables-hash-bucket-size,omitempty"` + + // Sets the maximum size of the variables hash table. + // http://nginx.org/en/docs/http/ngx_http_map_module.html#variables_hash_max_size + VariablesHashMaxSize int `json:"variables-hash-max-size,omitempty"` } // NewDefault returns the default nginx configuration @@ -315,6 +323,8 @@ func NewDefault() Configuration { WorkerProcesses: strconv.Itoa(runtime.NumCPU()), LoadBalanceAlgorithm: defaultLoadBalancerAlgorithm, VtsStatusZoneSize: "10m", + VariablesHashBucketSize: 64, + VariablesHashMaxSize: 2048, UseHTTP2: true, Backend: defaults.Backend{ ProxyBodySize: bodySize, diff --git a/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl b/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl index ed68b65d2c..fde14e14cd 100644 --- a/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl +++ b/controllers/nginx/rootfs/etc/nginx/template/nginx.tmpl @@ -71,6 +71,9 @@ http { server_names_hash_bucket_size {{ $cfg.ServerNameHashBucketSize }}; map_hash_bucket_size {{ $cfg.MapHashBucketSize }}; + variables_hash_bucket_size {{ $cfg.VariablesHashBucketSize }}; + variables_hash_max_size {{ $cfg.VariablesHashMaxSize }}; + underscores_in_headers {{ if $cfg.EnableUnderscoresInHeaders }}on{{ else }}off{{ end }}; ignore_invalid_headers {{ if $cfg.IgnoreInvalidHeaders }}on{{ else }}off{{ end }};