Skip to content

Commit b35fddc

Browse files
committed
THREESCALE-7941: Review warning displayed in apicast logs about variables_hash_max_size & variables_hash_bucket_size
Increasing the limit of [variables_hash_bucket_size](http://nginx.org/en/docs/http/ngx_http_core_module.html#variables_hash_bucket_size) make the warning message disapear. This message is a warning that NGiNX display when the used variables didn't fit the buffer. Increasing will also increase performance and will not show this warning. The NGiNX documenation about hashes says: ``` To quickly process static sets of data such as server names, map directive’s values, MIME types, names of request header strings, nginx uses hash tables. During the start and each re-configuration nginx selects the minimum possible sizes of hash tables such that the bucket size that stores keys with identical hash values does not exceed the configured parameter (hash bucket size). The size of a table is expressed in buckets. The adjustment is continued until the table size exceeds the hash max size parameter. Most hashes have the corresponding directives that allow changing these parameters, for example, for the server names hash they are server_names_hash_max_size and server_names_hash_bucket_size. The hash bucket size parameter is aligned to the size that is a multiple of the processor’s cache line size. This speeds up key search in a hash on modern processors by reducing the number of memory accesses. If hash bucket size is equal to one processor’s cache line size then the number of memory accesses during the key search will be two in the worst case — first to compute the bucket address, and second during the key search inside the bucket. Therefore, if nginx emits the message requesting to increase either hash max size or hash bucket size then the first parameter should first be increased. ``` Reference: [NGiNX: Setting up hashes](http://nginx.org/en/docs/hash.html) Also, to check the processor's cache line size, use: `cat /sys/devices/system/cpu/cpu*/cache/index*/coherency_line_size | head -n 1` Source: [https://stackoverflow.com/questions/794632/programmatically-get-the-cache-line-size] This commit fix the Jira issue THREESCALE-7941. [https://issues.redhat.com/browse/THREESCALE-7941]
1 parent 00f9831 commit b35fddc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

gateway/conf/nginx.conf.liquid

+2-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ http {
4343
tcp_nodelay on;
4444
server_tokens off;
4545

46-
46+
variables_hash_bucket_size 128;
47+
variables_hash_max_size 1024;
4748

4849
proxy_cache_path /tmp/cache levels=1:2 keys_zone=apicast_cache:10m;
4950
# Enabling the Lua code cache is strongly encouraged for production use

0 commit comments

Comments
 (0)