Skip to content

Commit e71b307

Browse files
Allow disabling io_uring sendfile support via a system property.
1 parent f6823bc commit e71b307

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

vertx-core/src/main/java/io/vertx/core/impl/SysProps.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,17 @@ public String get() {
116116
JACKSON_DEFAULT_READ_MAX_NAME_LEN("vertx.jackson.defaultReadMaxNameLength"),
117117
JACKSON_DEFAULT_READ_MAX_TOKEN_COUNT("vertx.jackson.defaultMaxTokenCount"),
118118

119+
/**
120+
* Disable {@code sendfile} support for the io_uring transport.
121+
* <p>
122+
* When this system property is set to {@code true}, Vert.x will avoid using the
123+
* io_uring splice path.
124+
* <p>
125+
* This is useful because io_uring splice can be slower than the
126+
* epoll {@code sendfile} in some workloads.
127+
* See <a href="https://github.com/netty/netty/issues/15747">Netty issue 15747</a>.
128+
*/
129+
DISABLE_IO_URING_SENDFILE("vertx.disableIoUringSendfile"),
119130
;
120131

121132
public final String name;

vertx-core/src/main/java/io/vertx/core/impl/transports/IoUringTransport.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import io.netty.channel.unix.DomainSocketAddress;
1919
import io.netty.channel.uring.*;
2020
import io.vertx.core.datagram.DatagramSocketOptions;
21+
import io.vertx.core.impl.SysProps;
2122
import io.vertx.core.net.TcpOptions;
2223
import io.vertx.core.net.impl.SocketAddressImpl;
2324
import io.vertx.core.spi.transport.Transport;
@@ -29,6 +30,8 @@
2930
*/
3031
public class IoUringTransport implements Transport {
3132

33+
private static final boolean DISABLE_SENDFILE = SysProps.DISABLE_IO_URING_SENDFILE.getBoolean();
34+
3235
private static volatile int pendingFastOpenRequestsThreshold = 256;
3336

3437
/**
@@ -62,7 +65,7 @@ public boolean supportsDomainSockets() {
6265

6366
@Override
6467
public boolean supportFileRegion() {
65-
return IoUring.isSpliceSupported();
68+
return IoUring.isSpliceSupported() && !DISABLE_SENDFILE;
6669
}
6770

6871
@Override

0 commit comments

Comments
 (0)