-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[nginx-ingress-controller]: Adapt nginx hash sizes to the number of ingress #1596
[nginx-ingress-controller]: Adapt nginx hash sizes to the number of ingress #1596
Conversation
@@ -64,6 +64,27 @@ func (ngx *Manager) loadTemplate() error { | |||
} | |||
|
|||
func (ngx *Manager) writeCfg(cfg config.Configuration, ingressCfg IngressConfig) (bool, error) { | |||
var longestName int | |||
var serverNames int | |||
for _, srv := range ingressCfg.Servers { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the tradeoff in being so precise vs just defaulting it to something high, documenting the limit, and not writing this code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the tradeoff in being so precise
Using a small value means nginx cannot start or be restarted. This is an example of the error:
[emerg] 17617#0: could not build the server_names_hash, you should increase server_names_hash_bucket_size: 32
just defaulting it to something high
This depends on the amount of hostnames and FQDN length
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah i mean just start off with it set to 16384, what do we lose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do we lose?
Nothing, but for instance I need at least 48K :)
@aledbf PR needs rebase |
e69033c
to
760562f
Compare
@bprashanth ping |
LGTM |
Automatic merge from submit-queue |
Automatic merge from submit-queue [nginx-ingress-controller]: Adapt nginx hash sizes to the number of ingress This change allows the tuning of 2 important NGINX variables: - server_names_hash_max_size - server_names_hash_bucket_size The default values should be enough for most of the users but after +300 Ingress rules or long hostnames as FQDN NGINX requires tuning of this values or it will not start. The introduced change allows the self-tuning using the Ingress information Using `--v=3` it's possible to see the changes: ``` ... I0822 21:42:10.517778 1 template.go:84] adjusting ServerNameHashMaxSize variable from 4096 to 16384 ... ``` fixes kubernetes-retired#1487
This change allows the tuning of 2 important NGINX variables:
The default values should be enough for most of the users but after +300 Ingress rules or long hostnames as FQDN NGINX requires tuning of this values or it will not start.
The introduced change allows the self-tuning using the Ingress information
Using
--v=3
it's possible to see the changes:fixes #1487
This change is