Paper/Spigot-Server-Patches/0052-Configurable-Chunk-IO-Thread-Base-Count.patch

84 lines
3.7 KiB
Diff
Raw Normal View History

2016-03-25 05:59:37 +01:00
From f1b0c0d63bc065df7b20543cc458e6df0df2b4c5 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Wed, 2 Mar 2016 23:46:57 -0600
Subject: [PATCH] Configurable Chunk IO Thread Base Count
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
2016-03-25 05:59:37 +01:00
index f0ed051..67b9714 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
2016-03-25 05:59:37 +01:00
@@ -124,39 +124,6 @@ public class PaperConfig {
return config.getString(path, config.getString(path));
}
2016-03-25 05:59:37 +01:00
- private static void timings() {
- boolean timings = getBoolean("timings.enabled", true);
- boolean verboseTimings = getBoolean("timings.verbose", true);
- TimingsManager.privacy = getBoolean("timings.server-name-privacy", false);
- TimingsManager.hiddenConfigs = getList("timings.hidden-config-entries", Lists.newArrayList("database", "settings.bungeecord-addresses"));
- int timingHistoryInterval = getInt("timings.history-interval", 300);
- int timingHistoryLength = getInt("timings.history-length", 3600);
-
-
- Timings.setVerboseTimingsEnabled(verboseTimings);
- Timings.setTimingsEnabled(timings);
- Timings.setHistoryInterval(timingHistoryInterval * 20);
- Timings.setHistoryLength(timingHistoryLength * 20);
-
- Bukkit.getLogger().log(Level.INFO, "Spigot Timings: " + timings +
- " - Verbose: " + verboseTimings +
- " - Interval: " + timeSummary(Timings.getHistoryInterval() / 20) +
- " - Length: " + timeSummary(Timings.getHistoryLength() / 20));
- }
-
- protected static String timeSummary(int seconds) {
- String time = "";
- if (seconds > 60 * 60) {
- time += TimeUnit.SECONDS.toHours(seconds) + "h";
- seconds /= 60;
- }
-
- if (seconds > 0) {
- time += TimeUnit.SECONDS.toMinutes(seconds) + "m";
- }
- return time;
- }
-
public static boolean useInteractLimiter;
private static void useInteractLimiter() {
useInteractLimiter = getBoolean("settings.limit-player-interactions", true);
@@ -164,4 +131,9 @@ public class PaperConfig {
Bukkit.getLogger().log(Level.INFO, "Disabling player interaction limiter, your server may be more vulnerable to malicious users");
}
}
+
+ public static int minChunkLoadThreads = 2;
+ public static void chunkLoadThreads() {
+ minChunkLoadThreads = Math.min(6, getInt("settings.min-chunk-load-threads", 2)); // Keep people from doing stupid things with max of 6
+ }
2016-03-25 05:59:37 +01:00
}
diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java
index e4fd9bc..7b7a3d0 100644
--- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java
+++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java
@@ -1,5 +1,6 @@
package org.bukkit.craftbukkit.chunkio;
+import com.destroystokyo.paper.PaperConfig;
import net.minecraft.server.Chunk;
import net.minecraft.server.ChunkProviderServer;
import net.minecraft.server.ChunkRegionLoader;
@@ -7,7 +8,7 @@ import net.minecraft.server.World;
import org.bukkit.craftbukkit.util.AsynchronousExecutor;
public class ChunkIOExecutor {
- static final int BASE_THREADS = 1;
+ static final int BASE_THREADS = PaperConfig.minChunkLoadThreads; // Paper
static final int PLAYERS_PER_THREAD = 50;
private static final AsynchronousExecutor<QueuedChunk, Chunk, Runnable, RuntimeException> instance = new AsynchronousExecutor<QueuedChunk, Chunk, Runnable, RuntimeException>(new ChunkIOProvider(), BASE_THREADS);
--
2016-03-25 05:59:37 +01:00
2.7.1.windows.2