kqueue_changes

The `kqueue_changes` directive configures the number of changes that can be added to a kqueue instance for monitoring events on macOS systems.

Syntaxkqueue_changes number;
Default128
Contextevents
Arguments1

Description

The kqueue_changes directive is utilized in the context of event handling in NGINX and specifically optimizes performance when utilizing the kqueue event mechanism, which is specific to BSD-style operating systems including macOS. This directive allows users to set the maximum number of changes that can be queued when monitoring file descriptors, helping to fine-tune the responsiveness of the NGINX server under high load conditions. The parameter specifies the limit on how many pending changes to file descriptors can be processed at once, which can affect the efficiency of handling connections during peak traffic.

When setting this directive, it is essential to consider the types of applications running on the server and the expected load. A lower value might lead to dropped events under heavy traffic, while a higher value could consume more memory and processing resources. It is crucial to balance these aspects to ensure optimal performance. For example, if your application frequently adds or removes file descriptors to/from monitoring, you may want to increase this value to accommodate higher rates of incoming connection demands. The effective management of this parameter can result in improved performance, particularly for applications experiencing bursts of connection requests that exceed typical load.

NGINX defaults to a sensible value that is suitable for many use cases, but administrators can adjust the kqueue_changes value based on their application's specific behavior and requirements, leading to either enhanced performance or a mitigated risk of event queue saturation.

Config Example

events {
    kqueue_changes 256;
}

Setting a very high value may lead to increased memory usage.

Ensure that your application requires a higher value; otherwise, it may lead to unnecessary resource consumption.

Not applicable on non-BSD systems, as kqueue is specific to BSD-style operating systems.

← Back to all directives