Describe the feature
HttpServerResponse.sendFile(...) can use different internal paths depending on the protocol and connection capabilities.
When the native file-region/sendfile path is available, the file can be transferred efficiently by the OS. However, when this path is not available, for example with TLS, HTTP/2, HTTP/3, traffic shaping, or unsupported transports, Vert.x falls back to streaming the file through userspace.
Today these fallback paths use a fixed 8 KiB chunk/read size, for example in ChunkedNioFile and the AsyncFile-based fallback path. This value is conservative, but it can be suboptimal for larger files.
In a local benchmark serving a 1 MiB file, increasing the fallback chunk size to 32 KiB, 64 KiB, or 128 KiB significantly reduced overhead compared to the current 8 KiB default.
It would be useful to expose an option for configuring the fallback send-file chunk size, while keeping the current default behavior unchanged. The option should be ignored when the native file-region/sendfile path is used.
Contribution
(#6159)
Describe the feature
HttpServerResponse.sendFile(...)can use different internal paths depending on the protocol and connection capabilities.When the native file-region/sendfile path is available, the file can be transferred efficiently by the OS. However, when this path is not available, for example with TLS, HTTP/2, HTTP/3, traffic shaping, or unsupported transports, Vert.x falls back to streaming the file through userspace.
Today these fallback paths use a fixed 8 KiB chunk/read size, for example in
ChunkedNioFileand theAsyncFile-based fallback path. This value is conservative, but it can be suboptimal for larger files.In a local benchmark serving a 1 MiB file, increasing the fallback chunk size to 32 KiB, 64 KiB, or 128 KiB significantly reduced overhead compared to the current 8 KiB default.
It would be useful to expose an option for configuring the fallback send-file chunk size, while keeping the current default behavior unchanged. The option should be ignored when the native file-region/sendfile path is used.
Contribution
(#6159)