From cf1c2c4ee2e2cea6a5283ed287d9e1fed9ebb874 Mon Sep 17 00:00:00 2001 From: William Blake Galbreath Date: Thu, 23 May 2019 00:01:39 -0500 Subject: [PATCH] Add tick loop config options --- docs/source/configuration.rst | 9 +++ .../0019-Tick-loop-config-options.patch | 81 +++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 patches/server/0019-Tick-loop-config-options.patch diff --git a/docs/source/configuration.rst b/docs/source/configuration.rst index 222a5b7a0..7bd2c3749 100644 --- a/docs/source/configuration.rst +++ b/docs/source/configuration.rst @@ -33,6 +33,15 @@ verbose * **default**: false * **description**: Sets whether the server should dump all configuration values to the server log on startup. +* enable-tick-overload + - **default**: false + - **description**: Enable/disable the vanilla tick overload detection ("Can't keep up! Is the server overloaded?") + +* enable-tps-catchup + - **default**: false + - **description**: Enable/disable Spigot's TPS catchup (makes everything tick faster than 20 tps after + lag spikes, which can cause more lag - also skews /tps reports by ruining the average with above 20 tps entries) + logger ~~~~~~ * show-duplicate-entity-uuid-errors diff --git a/patches/server/0019-Tick-loop-config-options.patch b/patches/server/0019-Tick-loop-config-options.patch new file mode 100644 index 000000000..02625c30a --- /dev/null +++ b/patches/server/0019-Tick-loop-config-options.patch @@ -0,0 +1,81 @@ +From 6732e24262020bd428a3591bbd4eba7bfb0d96b7 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +Date: Wed, 22 May 2019 22:30:08 -0500 +Subject: [PATCH] Tick loop config options + +--- + .../net/minecraft/server/MinecraftServer.java | 31 +++++++++++++------ + .../java/net/pl3x/purpur/PurpurConfig.java | 7 +++++ + 2 files changed, 28 insertions(+), 10 deletions(-) + +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index d3316a6ac..21ad507f9 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -852,16 +852,21 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 5000L && this.nextTick - this.lastOverloadTime >= 30000L) { // CraftBukkit +- long j = i / 50L; +- +- if (server.getWarnOnOverload()) // CraftBukkit +- MinecraftServer.LOGGER.warn("Can't keep up! Is the server overloaded? Running {}ms or {} ticks behind", i, j); +- this.nextTick += j * 50L; +- this.lastOverloadTime = this.nextTick; ++ // Purpur start - tick overload ++ curTime = System.nanoTime(); ++ if (net.pl3x.purpur.PurpurConfig.enableTickOverload) { ++ long i = ((curTime) / (1000L * 1000L)) - this.nextTick; // Paper ++ ++ if (i > 5000L && this.nextTick - this.lastOverloadTime >= 30000L) { // CraftBukkit ++ long j = i / 50L; ++ ++ if (server.getWarnOnOverload()) // CraftBukkit ++ MinecraftServer.LOGGER.warn("Can't keep up! Is the server overloaded? Running {}ms or {} ticks behind", i, j); ++ this.nextTick += j * 50L; ++ this.lastOverloadTime = this.nextTick; ++ } + } ++ // Purpur end - tick overload + + if ( ++MinecraftServer.currentTick % SAMPLE_INTERVAL == 0 ) + { +@@ -892,7 +897,13 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant