timer_resolution

Sets the resolution of the timer in milliseconds.

Syntaxtimer_resolution milliseconds;
Defaultnone
Contextmain
Arguments1

Description

The timer_resolution directive in NGINX allows you to specify the resolution of the event timer in milliseconds. This directive is defined in the core module and is crucial for optimizing timing operations within NGINX's event processing system. By adjusting the timer resolution, users can influence how events are handled, potentially leading to enhanced performance for applications with specific timing requirements.

The argument for the timer_resolution directive is a single value representing the timer resolution in milliseconds. It is particularly important for applications that have high-frequency events, where a finer timer resolution may improve the execution timing of those events. However, setting it too low may increase CPU overhead due to more frequent timer checks. Therefore, it is essential to find a balance that suits the workload of the server.

Note that this directive must be set in the main context, meaning it should only appear at the top level of the NGINX configuration (e.g., within the main configuration block and not inside events or http blocks). Understanding your application’s need for precision in timing will help you effectively utilize this directive to enhance overall performance.

Config Example

timer_resolution 100;

Be cautious when setting very low values as they may lead to higher CPU usage.

This directive is only effective in the main context and can cause errors if placed elsewhere.

← Back to all directives