variables_hash_max_size

Sets the maximum size of the hash table used for storing variables in the SRT module.

Syntaxvariables_hash_max_size size;
Default1024
Context
Arguments1

Description

The variables_hash_max_size directive in the NGINX SRT (Secure Reliable Transfer) Module specifies the maximum size of the hash table used for storing SRT-related variables. The purpose of this configuration is to allocate enough memory for the efficient retrieval and management of variables that are utilized within the SRT context. When there are too many variables defined or the total size of the variables exceeds this limit, NGINX may encounter issues such as performance degradation or the inability to store new variables correctly. Consequently, it is crucial to set this directive to a value that reflects the anticipated workload and the number of variables in use.

The parameter for variables_hash_max_size requires a numerical value representing the desired maximum size for the hash table. It is advisable to ensure this value is aligned with the expected scope of your application to avoid the limitations in memory allocation which could arise from an insufficient size. Conversely, setting it too high could lead to unnecessary memory consumption. Testing different configurations in a staging environment is recommended to determine the ideal setting for your specific use case. Remember, this directive operates under the context of the SRT server configurations, making it relevant only when SRT modules are actively used.

In practical terms, if you find that your application is increasing the number of variables significantly or experiencing latency in variable lookups, tuning this directive can significantly enhance performance. Adjusting the variables_hash_max_size can enable more efficient variable management and lead to better overall responsiveness of your NGINX SRT configuration.

Config Example

srt {
    variables_hash_max_size 2048;
    server {
        listen 4321;
        proxy_pass tcp://127.0.0.1:5678;
    }
}

Setting this value too low may lead to a failure to store all necessary variables, impacting application functionality.

Over-allocating memory by setting a very high value can lead to inefficient memory usage in environments with multiple services running.

Make sure to test the impact of this setting in a staging environment before applying it in production.

← Back to all directives