From c8487c197320db087cb85eb12b63138fc4a9c9a7 Mon Sep 17 00:00:00 2001 From: Matt Rickard Date: Fri, 14 Oct 2016 11:20:34 -0700 Subject: [PATCH] Make map_hash_bucket_size configurable --- controllers/nginx/nginx.tmpl | 1 + controllers/nginx/nginx/config/config.go | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/controllers/nginx/nginx.tmpl b/controllers/nginx/nginx.tmpl index ebbe40a0e..b046cf601 100644 --- a/controllers/nginx/nginx.tmpl +++ b/controllers/nginx/nginx.tmpl @@ -59,6 +59,7 @@ http { types_hash_max_size 2048; server_names_hash_max_size {{ $cfg.serverNameHashMaxSize }}; server_names_hash_bucket_size {{ $cfg.serverNameHashBucketSize }}; + map_hash_bucket_size {{ $cfg.mapHashBucketSize }}; include /etc/nginx/mime.types; default_type text/html; diff --git a/controllers/nginx/nginx/config/config.go b/controllers/nginx/nginx/config/config.go index f346c39ae..066440bbd 100644 --- a/controllers/nginx/nginx/config/config.go +++ b/controllers/nginx/nginx/config/config.go @@ -141,6 +141,11 @@ type Configuration struct { // http://nginx.org/en/docs/ngx_core_module.html#worker_connections MaxWorkerConnections int `structs:"max-worker-connections,omitempty"` + // Sets the bucket size for the map variables hash tables. + // Default value depends on the processor’s cache line size. + // http://nginx.org/en/docs/http/ngx_http_map_module.html#map_hash_bucket_size + MapHashBucketSize int `structs:"map-hash-bucket-size,omitempty"` + // Defines a timeout for establishing a connection with a proxied server. // It should be noted that this timeout cannot usually exceed 75 seconds. // http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_connect_timeout @@ -279,6 +284,7 @@ func NewDefault() Configuration { GzipTypes: gzipTypes, KeepAlive: 75, MaxWorkerConnections: 16384, + MapHashBucketSize: 64, ProxyConnectTimeout: 5, ProxyRealIPCIDR: defIPCIDR, ProxyReadTimeout: 60,