Opened 10 years ago

Closed 10 years ago

#631 closed enhancement (wontfix)

server_names_hash_bucket_size seems too low by default

Reported by: Alexander Shtuchkin Owned by:
Priority: minor Milestone:
Component: nginx-core Version: 1.7.x
Keywords: Cc:
uname -a: Linux DigitalOcean1 3.2.0-23-virtual #36-Ubuntu SMP Tue Apr 10 22:29:03 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.7.5
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_spdy_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module --add-module=/build/buildd/nginx-1.7.5/debian/modules/nginx-auth-pam --add-module=/build/buildd/nginx-1.7.5/debian/modules/nginx-dav-ext-module --add-module=/build/buildd/nginx-1.7.5/debian/modules/nginx-echo --add-module=/build/buildd/nginx-1.7.5/debian/modules/nginx-upstream-fair --add-module=/build/buildd/nginx-1.7.5/debian/modules/ngx_http_substitutions_filter_module

Description

I'm using nginx on Digital Ocean with default Ubuntu distribution and nginx development ppa. I also saw the same behavior on multiple other cloud providers.

The problem is that even when serving small number of domains (~3-5), nginx gives me the [emerg] could not build the server_names_hash, you should increase server_names_hash_bucket_size: 32 error and I have to change otherwise perfect default configuration.

Can you make the size of server name hash larger by default, or, even better, calculate optimal size at runtime? Pretty annoying that the server cannot determine such things by itself.

This is probably related to #352.

$ cat /proc/cpuinfo
processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 2
model name  : QEMU Virtual CPU version 1.0
stepping    : 3
microcode   : 0x1
cpu MHz     : 2299.998
cache size  : 4096 KB
fpu     : yes
fpu_exception   : yes
cpuid level : 4
wp      : yes
flags       : fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pse36 clflush mmx fxsr sse sse2 syscall nx lm up rep_good nopl pni vmx cx16 popcnt hypervisor lahf_lm
bogomips    : 4599.99
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management:

Change History (1)

comment:1 by Maxim Dounin, 10 years ago

Resolution: wontfix
Status: newclosed

The name you are trying to use is likely larger than what fits into 32 bytes - which is the optimal size as calculated by nginx according to CPU ID.

Note: See TracTickets for help on using tickets.