reduce sleep rate if file io thread sleep is enabled

so we will still give it time to sleep to avoid the issue, but reduce the
known negative effects of that sleeping.
This commit is contained in:
Aikar 2016-03-18 13:40:46 -04:00
parent 4d317d0ebe
commit 9da9b3a9d0

View file

@ -16,9 +16,14 @@ This has multiple impacts:
elevated memory usage, and then the objects used in the serialization sit around longer than needed,
resulting in promotion to Old Generation instead of dying young.
If there is work to do, then the thread should be doing its work, and only sleep when it is done.
To optimize this, we change the entire unload queue to be a proper queue. This improves the behavior of popping
the first queued chunk off, instead of abusing iterators like Mojang was doing.
Additionally, optimize the ChunkRegionLoader queue to reduce lock contention (issue with 1.9)
This also improves reliability of chunk saving, as the previous hack job had a race condition that could
fail to save some chunks.
Then finally, Sleeping will by default be removed, but due to known issues with 1.9, a config option was added.
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@ -155,7 +160,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - Add toggle
+ if (com.destroystokyo.paper.PaperConfig.enableFileIOThreadSleep) {
+ try {
+ Thread.sleep(this.e ? 0L : 10L);
+ Thread.sleep(this.e ? 0L : 2L);
+ } catch (InterruptedException interruptedexception) {
+ interruptedexception.printStackTrace();
+ }