Skip to content

Make sendFile fallback chunk size configurable #6160

Description

@doxlik

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)

Metadata

Metadata

Assignees

No one assigned

    Fields

    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions