CPU affinity for netty I/O threads

This commit is contained in:
MrHua269
2026-07-10 21:51:55 +08:00
parent 354879ea76
commit 1084b4aa3b
2 changed files with 36 additions and 2 deletions
@@ -17,3 +17,17 @@ index 5a72fa0d72bfdb927293abe921c57f6ae964a6ec..913161732b0affa70fb114dd4087a610
ret.setUncaughtExceptionHandler(TickRegionScheduler.this::uncaughtException);
return ret;
}
diff --git a/net/minecraft/server/network/EventLoopGroupHolder.java b/net/minecraft/server/network/EventLoopGroupHolder.java
index 9544eaee7e02d00226d957ea0b79cd1a1fb0c4d0..4e138fe36aa0bc519482990b60543b17ee2f388f 100644
--- a/net/minecraft/server/network/EventLoopGroupHolder.java
+++ b/net/minecraft/server/network/EventLoopGroupHolder.java
@@ -98,7 +98,8 @@ public abstract class EventLoopGroupHolder {
}
private ThreadFactory createThreadFactory() {
- return new ThreadFactoryBuilder().setNameFormat("Netty " + this.type + " IO #%d").setDaemon(true).setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(net.minecraft.server.MinecraftServer.LOGGER)).build(); // Paper
+ var origin = new ThreadFactoryBuilder().setNameFormat("Netty " + this.type + " IO #%d").setDaemon(true).setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(net.minecraft.server.MinecraftServer.LOGGER)).build(); // Paper // Camellia - Add config for cpu affinity
+ return run -> origin.newThread(moe.monnairealms.camellia.config.modules.optimizations.CpuAffinityConfig.wrapForNettyIo(run)); // Camellia - Add config for cpu affinity
}
protected abstract IoHandlerFactory ioHandlerFactory();