Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-09-29 06:30:16 +02:00
Add support for io_uring
Dieser Commit ist enthalten in:
Ursprung
0993ce2f86
Commit
00c0f7d4d9
@ -51,6 +51,7 @@ netty-codec-haproxy = { module = "io.netty:netty-codec-haproxy", version.ref = "
|
||||
netty-codec-http = { module = "io.netty:netty-codec-http", version.ref = "netty" }
|
||||
netty-handler = { module = "io.netty:netty-handler", version.ref = "netty" }
|
||||
netty-transport-native-epoll = { module = "io.netty:netty-transport-native-epoll", version.ref = "netty" }
|
||||
netty-transport-native-iouring = { module = "io.netty.incubator:netty-incubator-transport-native-io_uring", version = "0.0.24.Final" }
|
||||
netty-transport-native-kqueue = { module = "io.netty:netty-transport-native-kqueue", version.ref = "netty" }
|
||||
nightconfig = "com.electronwill.night-config:toml:3.6.7"
|
||||
slf4j = "org.slf4j:slf4j-api:2.0.7"
|
||||
|
@ -107,6 +107,9 @@ dependencies {
|
||||
implementation(libs.netty.transport.native.epoll)
|
||||
implementation(variantOf(libs.netty.transport.native.epoll) { classifier("linux-x86_64") })
|
||||
implementation(variantOf(libs.netty.transport.native.epoll) { classifier("linux-aarch_64") })
|
||||
implementation(libs.netty.transport.native.iouring)
|
||||
implementation(variantOf(libs.netty.transport.native.iouring) { classifier("linux-x86_64") })
|
||||
implementation(variantOf(libs.netty.transport.native.iouring) { classifier("linux-aarch_64") })
|
||||
implementation(libs.netty.transport.native.kqueue)
|
||||
implementation(variantOf(libs.netty.transport.native.kqueue) { classifier("osx-x86_64") })
|
||||
implementation(variantOf(libs.netty.transport.native.kqueue) { classifier("osx-aarch_64") })
|
||||
|
@ -65,7 +65,7 @@ public final class ConnectionManager {
|
||||
private final HttpClient httpClient;
|
||||
|
||||
/**
|
||||
* Initalizes the {@code ConnectionManager}.
|
||||
* Initializes the {@code ConnectionManager}.
|
||||
*
|
||||
* @param server a reference to the Velocity server
|
||||
*/
|
||||
@ -104,7 +104,7 @@ public final class ConnectionManager {
|
||||
.childOption(ChannelOption.IP_TOS, 0x18)
|
||||
.localAddress(address);
|
||||
|
||||
if (server.getConfiguration().useTcpFastOpen()) {
|
||||
if (transportType != TransportType.NIO && server.getConfiguration().useTcpFastOpen()) {
|
||||
bootstrap.option(ChannelOption.TCP_FASTOPEN, 3);
|
||||
}
|
||||
|
||||
@ -167,7 +167,7 @@ public final class ConnectionManager {
|
||||
this.server.getConfiguration().getConnectTimeout())
|
||||
.group(group == null ? this.workerGroup : group)
|
||||
.resolver(this.resolver.asGroup());
|
||||
if (server.getConfiguration().useTcpFastOpen()) {
|
||||
if (transportType != TransportType.NIO && server.getConfiguration().useTcpFastOpen()) {
|
||||
bootstrap.option(ChannelOption.TCP_FASTOPEN_CONNECT, true);
|
||||
}
|
||||
return bootstrap;
|
||||
|
@ -37,6 +37,11 @@ import io.netty.channel.socket.SocketChannel;
|
||||
import io.netty.channel.socket.nio.NioDatagramChannel;
|
||||
import io.netty.channel.socket.nio.NioServerSocketChannel;
|
||||
import io.netty.channel.socket.nio.NioSocketChannel;
|
||||
import io.netty.incubator.channel.uring.IOUring;
|
||||
import io.netty.incubator.channel.uring.IOUringDatagramChannel;
|
||||
import io.netty.incubator.channel.uring.IOUringEventLoopGroup;
|
||||
import io.netty.incubator.channel.uring.IOUringServerSocketChannel;
|
||||
import io.netty.incubator.channel.uring.IOUringSocketChannel;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
@ -48,6 +53,10 @@ public enum TransportType {
|
||||
NioSocketChannel::new,
|
||||
NioDatagramChannel::new,
|
||||
(name, type) -> new NioEventLoopGroup(0, createThreadFactory(name, type))),
|
||||
IO_URING("io_uring", IOUringServerSocketChannel::new,
|
||||
IOUringSocketChannel::new,
|
||||
IOUringDatagramChannel::new,
|
||||
(name, type) -> new IOUringEventLoopGroup(0, createThreadFactory(name, type))),
|
||||
EPOLL("epoll", EpollServerSocketChannel::new,
|
||||
EpollSocketChannel::new,
|
||||
EpollDatagramChannel::new,
|
||||
@ -98,6 +107,10 @@ public enum TransportType {
|
||||
return NIO;
|
||||
}
|
||||
|
||||
if (Boolean.getBoolean("velocity.enable-iouring") && IOUring.isAvailable()) {
|
||||
return IO_URING;
|
||||
}
|
||||
|
||||
if (Epoll.isAvailable()) {
|
||||
return EPOLL;
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren