Make Chunk IO Thread Base count configurable

This commit is contained in:
Aikar 2016-03-21 23:51:58 -04:00
parent 816fccea08
commit 17a08203ed
6 changed files with 60 additions and 37 deletions

View file

@ -1,22 +0,0 @@
From 8ca16a403ce9416e0907f986bd35b2eca18dab53 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] Bump thread count for chunk loading
diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java
index e4fd9bc..729641e 100644
--- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java
+++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java
@@ -7,7 +7,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 = 2; // Paper - Bumped value
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);
--
2.7.2

View file

@ -0,0 +1,45 @@
From 7707854fbaf56c5e8f1df04be18b0dbfdd33db69 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
index 0ffa733..37ae817 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -120,6 +120,11 @@ public class PaperConfig {
return config.getString(path, config.getString(path));
}
+ 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
+ }
+
public static boolean useInteractLimiter;
private static void useInteractLimiter() {
useInteractLimiter = getBoolean("settings.limit-player-interactions", true);
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);
--
2.7.4

View file

@ -1,4 +1,4 @@
From 9f7f98e15f55f83febc8e32b4e98f89f516109b2 Mon Sep 17 00:00:00 2001
From ffac4a5563222eaf4d5c0b32f3ebfa77498f52cb Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 3 Mar 2016 04:00:11 -0600
Subject: [PATCH] Timings v2
@ -196,7 +196,7 @@ index 0000000..9ebc710
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 0ffa733..62f4631 100644
index 37ae817..5a14627 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -10,13 +10,17 @@ import java.lang.reflect.Modifier;
@ -217,7 +217,7 @@ index 0ffa733..62f4631 100644
public class PaperConfig {
@@ -127,4 +131,37 @@ public class PaperConfig {
@@ -132,4 +136,37 @@ public class PaperConfig {
Bukkit.getLogger().log(Level.INFO, "Disabling player interaction limiter, your server may be more vulnerable to malicious users");
}
}
@ -328,7 +328,7 @@ index cf58f74..38bc9c0 100644
public void recalcPosition() {
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index d24987b..1d5ea58 100644
index 37ea367..46a9e50 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -24,7 +24,7 @@ import org.bukkit.event.entity.EntityRegainHealthEvent;

View file

@ -1,4 +1,4 @@
From 3f15c4026c0860a835923d5c3acd6f93e06ddf8b Mon Sep 17 00:00:00 2001
From 7ca1fafedb5682419b3f08d68309d12359f36645 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 4 Mar 2016 18:18:37 -0600
Subject: [PATCH] Chunk save queue improvements
@ -26,10 +26,10 @@ Then finally, Sleeping will by default be removed, but due to known issues with
But if sleeps are to remain enabled, we at least lower the sleep interval so it doesn't have as much negative impact.
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 62f4631..ed49d83 100644
index 5a14627..66a97c4 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -164,4 +164,10 @@ public class PaperConfig {
@@ -169,4 +169,10 @@ public class PaperConfig {
}
return time;
}
@ -170,5 +170,5 @@ index 4733f94..113aea2 100644
if (this.b.isEmpty()) {
--
2.7.3
2.7.4

View file

@ -1,4 +1,4 @@
From a3aaf71e3a2304bfc6b4d3f805f8a7d76b0975a1 Mon Sep 17 00:00:00 2001
From 00f906fd849af93f888b67a66d8c07ac4ce74ed1 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 18 Mar 2016 13:17:38 -0400
Subject: [PATCH] Default loading permissions.yml before plugins
@ -16,10 +16,10 @@ modify that. Under the previous logic, plugins were unable (cleanly) override pe
A config option has been added for those who depend on the previous behavior, but I don't expect that.
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index ed49d83..de5d945 100644
index 66a97c4..8829cea 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -170,4 +170,9 @@ public class PaperConfig {
@@ -175,4 +175,9 @@ public class PaperConfig {
enableFileIOThreadSleep = getBoolean("settings.sleep-between-chunk-saves", false);
if (enableFileIOThreadSleep) Bukkit.getLogger().info("Enabled sleeping between chunk saves, beware of memory issues");
}
@ -51,5 +51,5 @@ index cb9906a..2493a23 100644
CraftDefaultPermissions.registerCorePermissions();
helpMap.initializeCommands();
--
2.7.3
2.7.4

View file

@ -1,14 +1,14 @@
From 06c57c6d719e95aae1a4e88a3b7fb19f387a24d6 Mon Sep 17 00:00:00 2001
From 19506e55557403bbf0f8e9b71a7e9e60b54b9d6d Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com>
Date: Sun, 19 Jul 2015 16:51:38 -0400
Subject: [PATCH] Set health before death event
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index de5d945..ab86ab6 100644
index 8829cea..c1ee93f 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -175,4 +175,9 @@ public class PaperConfig {
@@ -180,4 +180,9 @@ public class PaperConfig {
private static void loadPermsBeforePlugins() {
loadPermsBeforePlugins = getBoolean("settings.load-permissions-yml-before-plugins", true);
}