grpc_ssl_session_reuse

Enables or disables the reuse of SSL sessions for gRPC connections in NGINX.

Syntaxgrpc_ssl_session_reuse on | off;
Defaultoff
Contexthttp, server, location
Argumentsflag

Description

The grpc_ssl_session_reuse directive configures SSL session reuse for gRPC connections established through the NGINX server. It can be set to a flag value; when enabled, gRPC clients can reuse existing SSL sessions for establishing new connections to optimize resource utilization and enhance performance. When this directive is set to 'on', NGINX will potentially reduce the time needed for the SSL handshake process on subsequent connections because the handshake can be skipped if an existing session is reused. Conversely, setting it to 'off' disables this functionality, which may lead to higher latency on repeated connections due to the need for a full SSL handshake each time.

The directive is applicable in various contexts including http, server, and location, providing flexibility depending on the scope of gRPC services needing session reuse. Note that while session reuse can significantly improve performance, it requires appropriate configuration and compatibility between server and clients to function correctly. SSL session IDs must be shared between the server and clients for successful reuse, which sometimes necessitates additional considerations on session caching between multiple server instances if needed.

Config Example

server {
    listen 443 ssl;
    grpc_ssl_session_reuse on;
    ssl_certificate /path/to/cert;
    ssl_certificate_key /path/to/key;
    # other configurations...
}

Ensure that SSL session IDs are correctly managed and shared between server instances for proper session reuse.

Not all gRPC clients support SSL session reuse; verify client compatibility before enabling this feature.

Performance benefits might be negligible if the SSL sessions are not reused frequently; testing is recommended.

← Back to all directives