Use dedicated thread for main thread blocking chunk loads

In most cases, this change won't benefit much. However, there
exists the possibility that your Chunk Task threads are all busy
doing super slow work such as converting chunks.

If this occurs, the main thread blocking tasks, even at highest priority,
has to wait for some thread to become available.

This change gives us a waiting thread used only for main thread blocking
tasks, as well as an increased thread priority level, so that the OS
will give priority to this thread over the other threads.

This is more about guarantees, and won't be any real performanc boost
to anyone who has low or fast activity on their chunk tasks anyways.

But not all of us force upgrade our worlds, and this can be a life saver.

also reordered some patches because multiple PR's were merged.
This commit is contained in:
Aikar
2020-04-11 04:40:00 -04:00
parent c8367bb129
commit 98218db96f
4 changed files with 90 additions and 28 deletions

View File

@@ -6,7 +6,7 @@ Subject: [PATCH] Add tick times API and /mspt command
diff --git a/src/main/java/com/destroystokyo/paper/MSPTCommand.java b/src/main/java/com/destroystokyo/paper/MSPTCommand.java
new file mode 100644
index 000000000..d0211d4f3
index 0000000000..d0211d4f39
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/MSPTCommand.java
@@ -0,0 +0,0 @@
@@ -75,7 +75,7 @@ index 000000000..d0211d4f3
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 6916ed30c..1c4cd3635 100644
index 6916ed30c4..1c4cd36351 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -0,0 +0,0 @@ public class PaperConfig {
@@ -87,7 +87,7 @@ index 6916ed30c..1c4cd3635 100644
version = getInt("config-version", 20);
set("config-version", 20);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index c9deaffc4..9e5d569f7 100644
index 936434110c..2686874f26 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -147,7 +147,7 @@ index c9deaffc4..9e5d569f7 100644
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index b9a398bc5..53b71b791 100644
index b9a398bc57..53b71b7915 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {