[JAVA] About vanilla continent optimization

Overview

The challenge is how stable it can be by locally reproducing the environment of Minecraft's public multi-server Vanilla Continent and optimizing it as much as possible. No permission has been obtained from the vanilla continent management team. It is a personal hobby.

environment

OS Windows10Home

Start bat

java -jar -Xmx7168M -Dfile.encoding=utf-8 paperclip-605.jar

Database

MariaDB for convenience of using XAMPP. I haven't confirmed whether the vanilla continent is MySQL or MariaDB.


# mysql --version
mysql  Ver 15.1 Distrib 10.1.38-MariaDB, for Win64 (AMD64)

memory

7GB allocation It seems that the vanilla continent allocates 15GB out of 32GB (see unofficial Wiki, old information and may be different now), but this is the limit because my PC has only 16GB.

Try

Well, I tried things

Try to reproduce

Plugin name version
CoreProtect 2.16.3
dynmap 3.0-beta-3-160
WorldEdit 1.13.105
MorkazSk 1.2
ColoredSigns 2.2
Skript 2.3.6
Essentials 2.16.1.154
ClearLag 3.0.3
ArmorStandEditor 1.13-21
goBrush 2.0
skDragon 0.14.999
Chairs 5.0
Test(Self-made PL for verification) 1.0-SNAPSHOT
SkQuery 3.6.4
WorldBorder 1.9.0
LWC 2.1.2-dd8c289
Votifier 1.9
ConsoleSpamFix 1.6.2
PowerNBT 0.8.9.3
Multiverse-Core 3.0.0-SNAPSHOT-b760
WorldGuard 7.0.0-beta-03;e51a220
SK-NBeeT 2.3.0
Citizens 2.0.25-SNAPSHOT (build 1669)
Sentinel 1.8.5 (build 242)
FastAsyncWorldEdit 1.13-breaking
skRayFall 1.9.15
LunaChat 2.8.9
Skematic 2.2b
PermissionsEx 1.23.4
skUtilities 0.9.2
EssentialsSpawn 2.16.1.154
UndineMailer 1.8.1
WorldEditSelectionVisualizer 1.6.5
SharpSK 1.6.3
MCBans 4.4.4
SkUniversal 2.6
WarpPortals 5.6.3
Skellett 1.9.6b
TuSKe 1.8.2-Pikachu-IronApollo-Patch-4

(The above list wrote the plugin in 1 minute just for that, because it's surprisingly annoying to tabulate the installed versions.) In addition, Citizens has a paid version and a free version, but this time I used the free version for verification only. (There is no difference in functionality. To maintain motivation, I would like you to use the paid version if possible.)

I will start it for the time being

I prepared the above environment, agreed with the EULA, and started it for the time being. Since MCBans etc. are included, I know that it will not start up in one shot. However… image.png ClearLag, a plugin that reduces lag by collecting dropped items and regularly clearing mobs (which is probably disabled on the vanilla continent), spewed errors and couldn't be launched obediently. Does java.lang.IllegalArgumentException: Collection is empty mean that the required items in the configuration file cannot be read? → As a result of replacing it with the following fork, it disappeared before I knew it.

AlsoImage.png The NBT editing plug-in called PowerNBT also threw an error at the command called at startup. Considering java.lang.RuntimeException: no such method and the sources below it, it seems that it is failing to access the server program directly using the function called reflection. This method is not the recommended method and must be rewritten for each version upgrade, so it occurs when the 1.12.2 plug-in is installed in 1.13.2. This plugin seems to have stopped updating in 1.12.1, so it seems that this error is occurring. As a result of searching a little, it was discovered that the fork of this plugin seems to support 1.13.2, so I will replace it there. Borrowed fork: https://github.com/steakteam/PowerNBT/releases Now the Power NBT error is gone. The plug-in called TuSKe doesn't seem to be supported by the head family, so I replaced it with fork. Borrowed fork: https://github.com/IronApollo/TuSKe/releases

The result of the above workImage.png A portal plugin called WarpPortals is throwing some errors (ignored because there is no problem in the stats collection part of the plugin), but it was confirmed that the others can be started without problems. This time, this is the reproduction environment.

By saying that

Since the database is not used at all in the above-mentioned started state, set it as close as possible to the environment of the vanilla continent. image.png

Changed to save CoreProtect and Modern LWC in MariaDB. Dynmap also supports MySQL (MariaDB), but since there was no evidence that it was saved in MySQL, it will be omitted at the reproduction stage.

Also, there are usually 9 worlds, nethers, 5 reset worlds, and event worlds on the vanilla continent (as far as I know). Therefore, even in this verification, only the number of these worlds will be prepared. (World generation is moderate because the specifications of the PC cannot withstand it.) image.png (I deleted rimokko because I remembered later that Rimokko was the world name "world")

Let's measure the current situation for the time being

Startup time: 1 minute 36 seconds It is measured by the / memory command of Essential. image.png

optimisation

I will try to optimize various things from the above reproduction environment.

Paper Spigot version update

Updated to 626

Remove Skript plugins

Since the Skript system is famous for being heavy, it is removed, and the functions implemented by these are implemented by plug-ins such as Java / Kotlin to reduce the weight.

Migrate PermissionEx to LuckPerms

Since the development of PermissionEx has already been completed, no future optimization can be expected and security is not good, so we will move to LuckPerms.

For the time being, try to measure up to here

Startup time: 1 minute 28 seconds image.png Free memory increased as the number of plugins decreased.

I tried to make Dynmap MySQL

image.png MySQL consumes more memory, but IO is faster.

Replacing Warp Portals (not done this time)

WarpPortals is an old plugin that doesn't stop working in 1.13.2, but there's no guarantee that it will work in the future, so I think you should consider replacing it.

Conclusion / Discussion

Skript is not a plugin to use with large mackerel

Since Skript describes its contents in a text file, IO takes time. Also, the more extension plug-ins are installed, the more memory is consumed. If you want to implement with Skript and write a plugin, the plugin has a higher degree of freedom such as optimization and there are many things you can do, so if there is no particular reason for Skript, it is better to implement it with a plugin. I think (this is my opinion. If you have any objections or suggestions, please leave a comment). Also, when implementing a combination of distributed plug-ins, it should be considered because it will not change if the number becomes too large.

Stop PermissionEx

It's been about a year and a half since the end of development, so let's stop it.

About mackerel drop

Recently, in the vanilla continent, mackerel fall may occur many times in a day, but in this verification, it was not possible to reproduce the mackerel fall, probably because the server startup time was short, so the details of the cause Is not known. I considered starting it for a long time and verifying it, but I couldn't because of the convenience of carrying around the PC.

Considering the introduction of a reverse proxy

There is a reverse proxy that can reduce the load on the server or serve as a shield against DDoS by inserting another server between the server and the player. In the vanilla continent, DNS is currently directed directly to the server, making it very easy to attack, so I think you should consider introducing a reverse proxy.

About OS

Given that it has 32GB of memory, I think the 15GB allocation gives the OS too much memory. As long as the OS is Windows, it can't be helped, but by changing the OS to Windows Server or Linux (CentOS, etc.), the memory occupied by the OS can be reduced, the memory that can be allocated to the server increases, and Linux is used. In that case, you can get more detailed information such as memory usage and CPU usage than Windows. If you have someone who can handle Linux, you should use Linux. (Low priority)

Finally

The owner of the vanilla continent, especially Mr. Tama, the owner of the mackerel, forgive me for writing such a thing as I like, even though I usually manage the server. Thank you for your continued support in server management.

Addition / correction

2019/5/28 It was pointed out on Twitter that it would be misleading, so I revised it. Also clarified that it is the author's opinion.

Recommended Posts

About vanilla continent optimization
Think about transformation rock-paper-scissors by optimization
Think about menus by combinatorial optimization
About calculation graph optimization processing inside tf.function
[Deep Learning from scratch] About hyperparameter optimization