Set cap on JDK per-thread native byte buffer cache
See: https://www.evanjones.ca/java-bytebuffer-leak.html This is potentially a source of lots of native memory usage. We are clearly seeing native usage upwards to 1-4GB which doesn't make sense. Region File usage fixed in previous patch should of tecnically only been somewhat temporary until GC finally gets it some time later, but between all the various plugins doing IO on various threads, this hidden detail of the JDK could be keeping long lived large direct buffers in cache. Set system properly at server startup if not set already to help protect from this.
This commit is contained in:
parent
b5101f4f97
commit
55e3501967
1 changed files with 33 additions and 0 deletions
|
@ -0,0 +1,33 @@
|
|||
From 5932b5ecbc0822f05b671372c6e58ac8e14d5bb4 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 4 May 2020 01:08:56 -0400
|
||||
Subject: [PATCH] Set cap on JDK per-thread native byte buffer cache
|
||||
|
||||
See: https://www.evanjones.ca/java-bytebuffer-leak.html
|
||||
|
||||
This is potentially a source of lots of native memory usage.
|
||||
|
||||
We are clearly seeing native usage upwards to 1-4GB which doesn't make sense.
|
||||
|
||||
Region File usage fixed in previous patch should of tecnically only been somewhat
|
||||
temporary until GC finally gets it some time later, but between all the various
|
||||
plugins doing IO on various threads, this hidden detail of the JDK could be
|
||||
keeping long lived large direct buffers in cache.
|
||||
|
||||
Set system properly at server startup if not set already to help protect from this.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index 093dbeae27..93340e9470 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -21,6 +21,7 @@ public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
// Todo: Installation script
|
||||
+ if (System.getProperty("jdk.nio.maxCachedBufferSize") == null) System.setProperty("jdk.nio.maxCachedBufferSize", "262144"); // Paper - cap per-thread NIO cache size
|
||||
OptionParser parser = new OptionParser() {
|
||||
{
|
||||
acceptsAll(asList("?", "help"), "Show the help");
|
||||
--
|
||||
2.26.2
|
||||
|
Loading…
Reference in a new issue