sysguard_rt

The `sysguard_rt` directive is used to monitor and control request processing times, triggering actions based on response time thresholds.

Syntaxsysguard_rt rt=number period=time [method=string] [action=URI];
Defaultnone
Contexthttp, server, location
Arguments1-4

Description

The sysguard_rt directive in the NGINX sysguard module is designed to help manage the performance of web applications by monitoring response times for requests. By specifying one or more parameters, you can set thresholds that, when breached, will trigger defined actions. The directive takes up to four arguments: rt (the response time threshold), period (the time period over which to calculate the average response time), method (the statistical method for computing averages), and an optional action to dictate what to do when the threshold is exceeded.

The rt parameter specifies the maximum allowable response time, while the period defines how frequently these measurements are taken (e.g., every 5 seconds). The method parameter allows you to select the type of calculation used for determining the average response time, with options like AMM (Average Moving Method) and WMA (Weighted Moving Average). The action can typically point to a location that handles exceeding traffic, such as redirecting to an error page or limiting further requests. When the average response time surpasses the declared threshold, the specified action is triggered, enabling administrators to take preventive measures against overloads.

This directive provides a crucial layer of dynamic control over web server performance, particularly for high-traffic environments, by effectively regulating request handling based on server load metrics.

Config Example

server {
    sysguard on;
    sysguard_mode or;
    sysguard_rt rt=2.0 period=10s method=WMA:10 action=/slowrequest;

    location /slowrequest {
        return 503;
    }
}

Ensure the specified period is appropriate for your application's load; too short may lead to frequent state changes.

Make sure the action URI is correctly configured to handle load control, as misconfigurations may result in unintended responses for users.

Utilizing aggressive thresholds may lead to excessive 503 responses, impacting user experience. Carefully calibrate rt limits.

← Back to all directives