nginx - could not build optimal variables_hash

10,156

You mentioned...

and checked if these keys were set to a different value, which they were not!

Was that just spot-checking that declarative, or did you grep the config files? I would do the latter to ensure it isn't declared somewhere else as well.

Paste the results of nginx -V.

Do you have any extra modules enabled? How high a value did you try? It's possible that you either have modules adding to the variable weight or you have a lot (or lengthy values) declared.

Share:
10,156

Related videos on Youtube

BrainStone
Author by

BrainStone

Love programming <3

Updated on September 18, 2022

Comments

  • BrainStone
    BrainStone almost 2 years

    For quite some time now nginx gives me this warning:

    nginx: [warn] could not build optimal variables_hash, you should increase either variables_hash_max_size: 1024 or variables_hash_bucket_size: 64; ignoring variables_hash_bucket_size
    

    However in the http block of my config I have this:

    http {
      # More config...
    
      variables_hash_max_size 1024;
      variables_hash_bucket_size 64;
    
      # More config...
    }
    

    (Increasing to higher values doesn't solve it either! Also I ran nginx -T and checked if these keys were set to a different value, which they were not!)
    How do I solve this?

    (If required I will post more of the config. I'm just not sure which parts are relevant.)

  • BrainStone
    BrainStone almost 7 years
    nginx -T print the entire config. So grepping that I am certain that it is not influenced by another value.
  • Ulfy
    Ulfy almost 7 years
    -t checks for syntactical correctness. I just wanted to verify your grepped the config to ensure it isn't elsewhere. Can you paste the -V results? I wanted to see that to get a feel for how many modules were being loaded.
  • Ulfy
    Ulfy almost 7 years
    That's fine, I was just asking for clarity since you never said if you grepped the config in the first place, only that "you checked". At any rate, the error you're getting can be legit if your variable load is too great, which can happen with extra modules.
  • BrainStone
    BrainStone almost 7 years
    Increasing the values further soved the issue. Thanks for pointing me in this direction!
  • Community
    Community about 2 years
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.