From 709d95ae00695cfb1c4a93fa68313d5a22769291 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 4 Mar 2018 20:20:27 -0500 Subject: [PATCH] Add max-player-auto-save-per-tick setting to spread out saves more This will force the saves to spread over multiple ticks even when many players auto save interval is aligned, avoiding spikes on large servers. Closes #1021 --- .../0153-Auto-Save-Improvements.patch | 20 +++++++++++++------ ...-option-to-remove-invalid-statistics.patch | 12 +++++------ .../0190-Enforce-Sync-Player-Saves.patch | 10 +++++----- ...le-async-calls-to-restart-the-server.patch | 10 +++++----- ...n-option-to-prevent-player-names-fro.patch | 10 +++++----- ...-a-custom-authentication-servers-dow.patch | 8 ++++---- 6 files changed, 39 insertions(+), 31 deletions(-) diff --git a/Spigot-Server-Patches/0153-Auto-Save-Improvements.patch b/Spigot-Server-Patches/0153-Auto-Save-Improvements.patch index 0711e3e0b..c8b440cd7 100644 --- a/Spigot-Server-Patches/0153-Auto-Save-Improvements.patch +++ b/Spigot-Server-Patches/0153-Auto-Save-Improvements.patch @@ -1,4 +1,4 @@ -From 17ca76593dd05a5c7ce88279f57a00b498bac4db Mon Sep 17 00:00:00 2001 +From 7c51a79d0c5b06020ba93772ff3f3c558e7133b9 Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 19 Sep 2016 23:16:39 -0400 Subject: [PATCH] Auto Save Improvements @@ -12,17 +12,23 @@ Re-introduce a cap per tick for auto save (Spigot disabled the vanilla cap) and Adds incremental player auto saving too diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 621c585e7..da0984a35 100644 +index 621c585e7..459c86bce 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -251,4 +251,9 @@ public class PaperConfig { +@@ -251,4 +251,15 @@ public class PaperConfig { flyingKickPlayerMessage = getString("messages.kick.flying-player", flyingKickPlayerMessage); flyingKickVehicleMessage = getString("messages.kick.flying-vehicle", flyingKickVehicleMessage); } + + public static int playerAutoSaveRate = -1; ++ public static int maxPlayerAutoSavePerTick = 10; + private static void playerAutoSaveRate() { + playerAutoSaveRate = getInt("settings.player-auto-save-rate", -1); ++ maxPlayerAutoSavePerTick = getInt("settings.max-player-auto-save-per-tick", -1); ++ if (maxPlayerAutoSavePerTick == -1) { // -1 Automatic / "Recommended" ++ // 10 should be safe for everyone unless your mass spamming player auto save ++ maxPlayerAutoSavePerTick = (playerAutoSaveRate == -1 || playerAutoSaveRate > 100) ? 10 : 20; ++ } + } } diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -155,7 +161,7 @@ index ab7933079..5c09c6ff7 100644 this.methodProfiler.a("tallying"); // Spigot start diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index ed5852ef4..0e82c16b7 100644 +index ed5852ef4..efea22c92 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -343,6 +343,7 @@ public abstract class PlayerList { @@ -166,7 +172,7 @@ index ed5852ef4..0e82c16b7 100644 this.playerFileData.save(entityplayer); ServerStatisticManager serverstatisticmanager = (ServerStatisticManager) entityplayer.getStatisticManager(); // CraftBukkit -@@ -1242,13 +1243,23 @@ public abstract class PlayerList { +@@ -1242,13 +1243,25 @@ public abstract class PlayerList { } @@ -178,11 +184,13 @@ index ed5852ef4..0e82c16b7 100644 + public void savePlayers(Integer interval) { + long now = MinecraftServer.currentTick; MinecraftTimings.savePlayers.startTiming(); // Paper ++ int numSaved = 0; // Paper for (int i = 0; i < this.players.size(); ++i) { - this.savePlayerFile((EntityPlayer) this.players.get(i)); + EntityPlayer entityplayer = this.players.get(i); + if (interval == null || now - entityplayer.lastSave >= interval) { + this.savePlayerFile(entityplayer); ++ if (interval != null && ++numSaved <= com.destroystokyo.paper.PaperConfig.maxPlayerAutoSavePerTick) { break; } // Paper + } } MinecraftTimings.savePlayers.stopTiming(); // Paper @@ -215,5 +223,5 @@ index f2ddc22dd..8493dccee 100644 timings.worldSaveChunks.startTiming(); // Paper chunkproviderserver.a(flag); -- -2.16.1 +2.16.2 diff --git a/Spigot-Server-Patches/0181-Add-option-to-remove-invalid-statistics.patch b/Spigot-Server-Patches/0181-Add-option-to-remove-invalid-statistics.patch index c60e03587..7bd1828e3 100644 --- a/Spigot-Server-Patches/0181-Add-option-to-remove-invalid-statistics.patch +++ b/Spigot-Server-Patches/0181-Add-option-to-remove-invalid-statistics.patch @@ -1,16 +1,16 @@ -From 9645473bc0f79de0b3d578f53afb4c1bc42a8094 Mon Sep 17 00:00:00 2001 +From eb0e0d138fb18e6ecb794916ee2a251cd0a63fb9 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 20 Dec 2016 23:09:21 -0600 Subject: [PATCH] Add option to remove invalid statistics diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index da0984a35..28917f63d 100644 +index 459c86bce..ea6fcb39f 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -256,4 +256,13 @@ public class PaperConfig { - private static void playerAutoSaveRate() { - playerAutoSaveRate = getInt("settings.player-auto-save-rate", -1); +@@ -262,4 +262,13 @@ public class PaperConfig { + maxPlayerAutoSavePerTick = (playerAutoSaveRate == -1 || playerAutoSaveRate > 100) ? 10 : 20; + } } + + public static boolean removeInvalidStatistics = false; @@ -53,5 +53,5 @@ index 14af226f3..e3d2c0ff7 100644 } } -- -2.16.1 +2.16.2 diff --git a/Spigot-Server-Patches/0190-Enforce-Sync-Player-Saves.patch b/Spigot-Server-Patches/0190-Enforce-Sync-Player-Saves.patch index 2217720c0..5c7cb21c7 100644 --- a/Spigot-Server-Patches/0190-Enforce-Sync-Player-Saves.patch +++ b/Spigot-Server-Patches/0190-Enforce-Sync-Player-Saves.patch @@ -1,4 +1,4 @@ -From 343eb898d9c46caa258cda53eaf90c5c17495256 Mon Sep 17 00:00:00 2001 +From 174bd0c894d7197b386a677450d20b15d1b7d0e5 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 7 Jan 2017 15:41:58 -0500 Subject: [PATCH] Enforce Sync Player Saves @@ -7,7 +7,7 @@ Saving players async is extremely dangerous. This will force it to main the same way we handle async chunk loads. diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 0e82c16b7..4080ed26c 100644 +index efea22c92..91136a8d8 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -1249,6 +1249,7 @@ public abstract class PlayerList { @@ -17,8 +17,8 @@ index 0e82c16b7..4080ed26c 100644 + MCUtil.ensureMain("Save Players", () -> { // Paper - ensure main long now = MinecraftServer.currentTick; MinecraftTimings.savePlayers.startTiming(); // Paper - for (int i = 0; i < this.players.size(); ++i) { -@@ -1258,6 +1259,7 @@ public abstract class PlayerList { + int numSaved = 0; // Paper +@@ -1260,6 +1261,7 @@ public abstract class PlayerList { } } MinecraftTimings.savePlayers.stopTiming(); // Paper @@ -27,5 +27,5 @@ index 0e82c16b7..4080ed26c 100644 // Paper end -- -2.16.1 +2.16.2 diff --git a/Spigot-Server-Patches/0204-Properly-handle-async-calls-to-restart-the-server.patch b/Spigot-Server-Patches/0204-Properly-handle-async-calls-to-restart-the-server.patch index 2d2f23c5b..2f97ba8c6 100644 --- a/Spigot-Server-Patches/0204-Properly-handle-async-calls-to-restart-the-server.patch +++ b/Spigot-Server-Patches/0204-Properly-handle-async-calls-to-restart-the-server.patch @@ -1,4 +1,4 @@ -From ff7f3e57d17fc5b364048efaa4541921c101d43c Mon Sep 17 00:00:00 2001 +From cad241a6391082af16b0a6472617360477d07168 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Fri, 12 May 2017 23:34:11 -0500 Subject: [PATCH] Properly handle async calls to restart the server @@ -78,10 +78,10 @@ index 13c6b5ccd..908a5d273 100644 return this.serverThread; } diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 4080ed26c..ff01bbff5 100644 +index 91136a8d8..cc6a209ea 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -1373,10 +1373,15 @@ public abstract class PlayerList { +@@ -1375,10 +1375,15 @@ public abstract class PlayerList { entityplayer.playerInteractManager.b(world.getWorldData().getGameType()); } @@ -98,7 +98,7 @@ index 4080ed26c..ff01bbff5 100644 } // CraftBukkit end // Paper start - Remove collideRule team if it exists -@@ -1387,6 +1392,7 @@ public abstract class PlayerList { +@@ -1389,6 +1394,7 @@ public abstract class PlayerList { } // Paper end } @@ -306,5 +306,5 @@ index 947c43a5d..f15fd9f37 100644 } } -- -2.16.1 +2.16.2 diff --git a/Spigot-Server-Patches/0207-Add-configuration-option-to-prevent-player-names-fro.patch b/Spigot-Server-Patches/0207-Add-configuration-option-to-prevent-player-names-fro.patch index cc02f50ac..05c09165c 100644 --- a/Spigot-Server-Patches/0207-Add-configuration-option-to-prevent-player-names-fro.patch +++ b/Spigot-Server-Patches/0207-Add-configuration-option-to-prevent-player-names-fro.patch @@ -1,4 +1,4 @@ -From a5c6c730527c0d813e4f3095153a41b1f114e4ef Mon Sep 17 00:00:00 2001 +From 92072faa8f876e43559b99eb36df6767dae5369e Mon Sep 17 00:00:00 2001 From: kashike Date: Fri, 9 Jun 2017 07:24:34 -0700 Subject: [PATCH] Add configuration option to prevent player names from being @@ -6,10 +6,10 @@ Subject: [PATCH] Add configuration option to prevent player names from being diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 28917f63d..f4b237034 100644 +index ea6fcb39f..dbafef023 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -265,4 +265,9 @@ public class PaperConfig { +@@ -271,4 +271,9 @@ public class PaperConfig { } removeInvalidStatistics = getBoolean("settings.remove-invalid-statistics", false); } @@ -20,7 +20,7 @@ index 28917f63d..f4b237034 100644 + } } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 701c90679..50341ae6e 100644 +index 41357cb0e..27c6caddc 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1908,5 +1908,10 @@ public final class CraftServer implements Server { @@ -35,5 +35,5 @@ index 701c90679..50341ae6e 100644 // Paper end } -- -2.16.1 +2.16.2 diff --git a/Spigot-Server-Patches/0232-Allow-specifying-a-custom-authentication-servers-dow.patch b/Spigot-Server-Patches/0232-Allow-specifying-a-custom-authentication-servers-dow.patch index 16b569fa3..3005bd303 100644 --- a/Spigot-Server-Patches/0232-Allow-specifying-a-custom-authentication-servers-dow.patch +++ b/Spigot-Server-Patches/0232-Allow-specifying-a-custom-authentication-servers-dow.patch @@ -1,4 +1,4 @@ -From bbb692b7756b3d884e75521c79edcda46e5ae5cc Mon Sep 17 00:00:00 2001 +From e0ee9656360c7d8bd856a2eb60321b04d83241e7 Mon Sep 17 00:00:00 2001 From: kashike Date: Thu, 17 Aug 2017 16:08:20 -0700 Subject: [PATCH] Allow specifying a custom "authentication servers down" kick @@ -6,7 +6,7 @@ Subject: [PATCH] Allow specifying a custom "authentication servers down" kick diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index f4b237034..f5cb9799b 100644 +index dbafef023..ec89ecfca 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -1,5 +1,6 @@ @@ -16,7 +16,7 @@ index f4b237034..f5cb9799b 100644 import com.google.common.base.Throwables; import java.io.File; -@@ -270,4 +271,9 @@ public class PaperConfig { +@@ -276,4 +277,9 @@ public class PaperConfig { private static void suggestPlayersWhenNull() { suggestPlayersWhenNullTabCompletions = getBoolean("settings.suggest-player-names-when-null-tab-completions", suggestPlayersWhenNullTabCompletions); } @@ -42,5 +42,5 @@ index c5434e6ba..75df92836 100644 LoginListener.c.error("Couldn\'t verify username because servers are unavailable"); } -- -2.16.1 +2.16.2