# 5-2：调整JVM启动参数

{% hint style="info" %}
**原文地址：**[**https://aikar.co/category/minecraft/**](https://aikar.co/category/minecraft/)
{% endhint %}

* **经过数周的学习JVM，参数和测试各种搭配，我总结出了一套高效的MineCraft垃圾收集系统。我已经在我的服务器上测试过这些，并且已经使用很多年了。然后我向大家宣布了我的研究，直到今天，许多服务器已经使用我建议的参数很多年了，并且帮助我改进了垃圾收集行为。**
* **这些参数是大量研究的结果，并且在各种规模的服务器，各种类型的服务器中反复证明了自己是有效的！**
* **我强烈建议使用这些参数来启动您的服务器，这些参数有助于你的服务器良好运行，不会出现大的垃圾回收高峰，CPU占用率可能过高，但是您的服务器TPS将会变得整体稳定。**

**使用这些参数仅仅需要更改 Xmx 和 Xms 。这些参数适用于任何大小的内存，即使是500MB也同样适用。**

```
java -Xms6G -Xmx6G -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:MaxGCPauseMillis=100 -XX:+DisableExplicitGC -XX:TargetSurvivorRatio=90 -XX:G1NewSizePercent=50 -XX:G1MaxNewSizePercent=80 -XX:G1MixedGCLiveThresholdPercent=35 -XX:+AlwaysPreTouch -XX:+ParallelRefProcEnabled -Dusing.aikars.flags=mcflags.emc.gs -jar paperclip.jar
```

* 如果你还没有使用Spigot的改进版Paperspigot,你真的需要换掉了！Paperspigot是一个比Spigot速度更快的版本，具有巨大的性能提升。它还有Bug和漏洞修复系统，许多新动能以及大量新的API供开发人员使用，具有更好的体验。
* Paperspigot是Spigot的替代品，每个Bukkit/Spigot插件的工作方式都相同，换用Paperspigot对你来说没有任何坏处！<br>
* 【 [下载Paperspigot](https://www.mcbbs.net/plugin.php?id=link_redirect\&target=https%3A%2F%2Fpapermc.io%2F) | [Paperspigot文档](https://www.mcbbs.net/plugin.php?id=link_redirect\&target=https%3A%2F%2Fpaper.readthedocs.io%2F) | [PaperspigotDiscord](https://www.mcbbs.net/plugin.php?id=link_redirect\&target=https%3A%2F%2Fdiscord.gg%2Fpapermc) |  [“你为什么应该切换到Paperspigot”](https://www.mcbbs.net/plugin.php?id=link_redirect\&target=https%3A%2F%2Fwhypaper.emc.gs%2F)】
* Paperspigot是唯一一个能够以高性能运行MineCraft1.13服务器的

{% hint style="info" %}
我建议使用10GB内存，无论你有多少玩家！如果你买不起10GB内存，你也要尽可能争取，但也要确保给你的系统留一些内存，G1GC在内存高的服务器上运行效果更好。超过10GB内存可能会有点多余，但应该没问题，实际上很少有服务器真正需要10GB内存以上。如果运行MC的内存为10GB或者更少，则不应该调整这些参数。
{% endhint %}

<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://logo.gitbook.io/server/5/5-2.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
