Update BungeeCord

Dieser Commit ist enthalten in:
Lixfel 2024-05-12 09:38:00 +02:00
Ursprung 53a01ba68c
Commit b179a18a0d
3 geänderte Dateien mit 2 neuen und 133 gelöschten Zeilen

1
.gitmodules vendored
Datei anzeigen

@ -1,3 +1,4 @@
[submodule "BungeeCord"]
path = BungeeCord
url = https://github.com/SpigotMC/BungeeCord.git
branch = master

@ -1 +1 @@
Subproject commit 6e1751733f6b3dafe824dcd7f00d5ed86572ba37
Subproject commit 18eae8a1a67b8e4478413f908be154baa0a2406a

Datei anzeigen

@ -1,132 +0,0 @@
From c1622d8e01110098b056e7484a6f77c9750153bf Mon Sep 17 00:00:00 2001
From: Lixfel <agga-games@gmx.de>
Date: Wed, 6 Dec 2023 15:48:56 +0100
Subject: [PATCH] Use IO_Uring backend for better write and kernel time
performance
diff --git a/proxy/pom.xml b/proxy/pom.xml
index 18d02b09..f2f44d28 100644
--- a/proxy/pom.xml
+++ b/proxy/pom.xml
@@ -41,6 +41,12 @@
<artifactId>netty-codec-http</artifactId>
<scope>compile</scope>
</dependency>
+ <dependency>
+ <groupId>io.netty.incubator</groupId>
+ <artifactId>netty-incubator-transport-native-io_uring</artifactId>
+ <version>0.0.24.Final</version>
+ <classifier>linux-x86_64</classifier>
+ </dependency>
<dependency>
<groupId>me.steinborn</groupId>
<artifactId>libdeflate-java-core</artifactId>
diff --git a/proxy/src/main/java/net/md_5/bungee/netty/PipelineUtils.java b/proxy/src/main/java/net/md_5/bungee/netty/PipelineUtils.java
index 6a045d16..424e5d06 100644
--- a/proxy/src/main/java/net/md_5/bungee/netty/PipelineUtils.java
+++ b/proxy/src/main/java/net/md_5/bungee/netty/PipelineUtils.java
@@ -26,6 +26,7 @@ import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.channel.unix.DomainSocketAddress;
import io.netty.handler.codec.haproxy.HAProxyMessageDecoder;
import io.netty.handler.timeout.ReadTimeoutHandler;
+import io.netty.incubator.channel.uring.*;
import io.netty.util.AttributeKey;
import io.netty.util.internal.PlatformDependent;
import java.net.SocketAddress;
@@ -119,7 +120,8 @@ public class PipelineUtils
public static final String LEGACY_DECODER = "legacy-decoder";
public static final String LEGACY_KICKER = "legacy-kick";
- private static boolean epoll;
+ private static final boolean iouring;
+ private static final boolean epoll;
// Waterfall start: netty reflection -> factory
private static final ChannelFactory<? extends ServerChannel> serverChannelFactory;
private static final ChannelFactory<? extends ServerChannel> serverChannelDomainFactory;
@@ -129,28 +131,36 @@ public class PipelineUtils
static
{
- if ( !PlatformDependent.isWindows() && Boolean.parseBoolean( System.getProperty( "bungee.epoll", "true" ) ) )
+ if(iouring = IOUring.isAvailable())
{
- ProxyServer.getInstance().getLogger().info( "Not on Windows, attempting to use enhanced EpollEventLoop" );
-
- if ( epoll = Epoll.isAvailable() )
- {
- ProxyServer.getInstance().getLogger().info( "Epoll is working, utilising it!" );
- } else
- {
- ProxyServer.getInstance().getLogger().log( Level.WARNING, "Epoll is not working, falling back to NIO: {0}", Util.exception( Epoll.unavailabilityCause() ) );
- }
+ ProxyServer.getInstance().getLogger().info( "IOUring is working, utilising it!" );
+ epoll = false;
+ serverChannelFactory = IOUringServerSocketChannel::new;
+ serverChannelDomainFactory = null;
+ channelFactory = IOUringSocketChannel::new;
+ channelDomainFactory = null;
+ } else if ( epoll = Epoll.isAvailable() )
+ {
+ ProxyServer.getInstance().getLogger().info( "Epoll is working, utilising it! " );
+ serverChannelFactory = EpollServerSocketChannel::new;
+ serverChannelDomainFactory = EpollServerDomainSocketChannel::new;
+ channelFactory = EpollSocketChannel::new;
+ channelDomainFactory = EpollDomainSocketChannel::new;
+ } else
+ {
+ ProxyServer.getInstance().getLogger().log( Level.WARNING, "Epoll is not working, falling back to NIO: {0}", Util.exception( Epoll.unavailabilityCause() ) );
+ serverChannelFactory = NioServerSocketChannel::new;
+ serverChannelDomainFactory = null;
+ channelFactory = NioSocketChannel::new;
+ channelDomainFactory = null;
}
- // Waterfall start: netty reflection -> factory
- serverChannelFactory = epoll ? EpollServerSocketChannel::new : NioServerSocketChannel::new;
- serverChannelDomainFactory = epoll ? EpollServerDomainSocketChannel::new : null;
- channelFactory = epoll ? EpollSocketChannel::new : NioSocketChannel::new;
- channelDomainFactory = epoll ? EpollDomainSocketChannel::new : null;
- // Waterfall end
}
public static EventLoopGroup newEventLoopGroup(int threads, ThreadFactory factory)
{
+ if(iouring)
+ return new IOUringEventLoopGroup(threads, factory);
+
return epoll ? new EpollEventLoopGroup( threads, factory ) : new NioEventLoopGroup( threads, factory );
}
@@ -162,6 +172,9 @@ public class PipelineUtils
return EpollServerDomainSocketChannel.class;
}
+
+ if(iouring)
+ return IOUringServerSocketChannel.class;
return epoll ? EpollServerSocketChannel.class : NioServerSocketChannel.class;
}
@@ -174,6 +187,9 @@ public class PipelineUtils
return EpollDomainSocketChannel.class;
}
+
+ if(iouring)
+ return IOUringSocketChannel.class;
return epoll ? EpollSocketChannel.class : NioSocketChannel.class;
}
@@ -208,6 +224,9 @@ public class PipelineUtils
public static Class<? extends DatagramChannel> getDatagramChannel()
{
+ if(iouring)
+ return IOUringDatagramChannel.class;
+
return epoll ? EpollDatagramChannel.class : NioDatagramChannel.class;
}
--
2.43.0