wasm_socket_send_timeout

Defines the maximum time that NGINX will wait to send data over a WebAssembly socket connection.

Syntaxwasm_socket_send_timeout time;
Defaultnone
Contexthttp, server, location
Arguments1

Description

The wasm_socket_send_timeout directive sets a timeout value for sending data through a WebAssembly (Wasm) socket within NGINX. When this timeout is reached during the data transmission process, NGINX will terminate the connection and issue an error if the data could not be sent successfully within the specified time frame. This feature is particularly useful in scenarios where consistent and timely communication with back-end services is critical, and it can help prevent resources from being held up indefinitely if a downstream service is unresponsive.

The timeout value is specified in time format (e.g., "30s" for 30 seconds), and once defined, it applies to all associated socket connections established via the Wasm module within the specified http, server, or location context. The effectiveness of this directive is contingent on proper configuration of the Wasm environment and its ability to process messages within the given limits, ensuring that operations do not get bogged down by slow or stalled communications.

By tuning this value, administrators can optimize performance and resource management in systems that rely heavily on WebAssembly modules to extend their functionality. Adjusting the send timeout appropriately helps maintain control over the behavior of the application while mitigating potential bottlenecks from slow external connections.

Config Example

http {
    wasm_socket_send_timeout 30s;

    server {
        listen 9000;

        location / {
            proxy_wasm my_filter;
            proxy_pass http://backend;
        }
    }
}

If set too low, it may cause legitimate requests to timeout unnecessarily, leading to failed transactions.

Adjust the timeout with consideration of network latency; a low timeout in a high-latency environment could hinder performance.

← Back to all directives