监控 JVM 堆内存压力,在低内存状况演变为紧急故障之前,分阶段减少高开销的服务器工作。
Free Server Saver 旨在解决因低内存服务器上堆占用率高而导致的卡顿问题。它不能修复网络延迟或所有导致 TPS(每秒刻数)低下的原因;其作用范围仅限于当测量的堆内存压力升高时所能减少的工作量。
自适应限流
经过 20 秒的启动预热后,模组大约每两秒检查一次堆内存使用情况。其默认阈值如下:
| 堆内存使用率 |
等级 |
干预措施 |
| 低于 60% |
正常 |
无干预 |
| 60–70% |
L1 |
降低远处生物的刻数速度;拒绝 50% 的自然生成 |
| 70–80% |
L2 |
加强远处生物限流;拒绝自然生成 |
| 80–85% |
L3 |
将渲染距离降至 6,模拟距离降至 4 |
| 85% 或以上 |
L4 |
将渲染距离降至 4,模拟距离降至 3,一次性丢弃符合条件的远处生物,并将服务器运行在 10 TPS |
每个等级在堆内存使用率下降到其进入阈值以下五个百分点后解除,这可以防止在边界附近频繁切换。各个干预模块可以在 serverconfig/freeserversaver-server.toml 中单独禁用。
受保护的活动
Boss、命名生物、拴绳或驯服的生物以及其他持久性实体不会被纳入破坏性干预。战斗、寻路、投射物、可见的定时状态以及移动中的实体仍以全速率运行。新生成的实体享有五秒的宽限期。作物、树叶、雪和火的随机刻数不会改变。
操作员工具
所有 /fss 命令需要权限等级 2。主要命令包括:
/fss status 和 /fss metrics — 显示当前等级、堆内存使用率、玩家数量、已加载区块数和渲染距离。
/fss history 和 /fss lagspikes — 显示最近的等级变化和超过 100 毫秒的刻数。
/fss top entities 和 /fss inspect chunks — 帮助定位实体密集或负载过重的区域。
/fss storage 和 /fss prune — 报告世界大小并识别孤立加载的区块。它们不会删除世界文件。
/fss pregen [radius] — 在命令来源周围生成区块;如果安装了 Chunky,则会让出控制权。
/fss quarantine — 列出因反复抛出刻异常而被移除的生物或方块实体。
还提供元空间(Metaspace)监控、启动时历史记录、空闲计时器通知以及 Discord 警报。Discord Webhook、自动阈值调整和生物密度扫描默认处于禁用状态。
兼容性与限制
在启动时,Free Server Saver 在检测到支持的性能或恢复模组时会禁用特定的重叠模块。例如,它会将区块预生成让给 Chunky,将异常隔离让给 Neruina、Bug Fix Mod 或 Failsafe。启动日志会记录每个被禁用的模块。
紧急等级可以移除符合条件的远处生物,异常隔离可以在反复失败后移除有缺陷的生物数据。在使用这些功能之前,请备份世界。当前版本包含构建和自动化检查,但尚未在真实生产服务器上验证。

接受视频、直播和服务器的付费委托。发送你的想法至:kuronami.mods@gmail.com

保留所有权利。整合包无需许可或署名即可包含此模组。这是一个非官方的社区模组,不与任何托管提供商关联。
错误和问题:请在 CurseForge 页面评论,或在 X 上私信 @kuronami333。
源码
Watch JVM heap pressure and scale back expensive server work in stages before low-memory conditions become an emergency.
Free Server Saver targets slowdowns caused by high heap occupancy on low-memory servers. It does not fix network latency or every source of low TPS; its scope is the work it can reduce when measured heap pressure rises.
Adaptive throttling
After a 20-second startup warm-up, the mod checks heap use about every two seconds. Its default thresholds are:
| Heap use |
Tier |
Intervention |
| Below 60% |
Normal |
No intervention |
| 60–70% |
L1 |
Slower ticks for far mobs; rejects 50% of natural spawns |
| 70–80% |
L2 |
Stronger distant-mob throttling; rejects natural spawns |
| 80–85% |
L3 |
Reduces view distance to 6 and simulation distance to 4 |
| 85% or more |
L4 |
Reduces view distance to 4 and simulation distance to 3, discards eligible distant mobs once, and runs the server at 10 TPS |
Each tier is released after heap use falls five percentage points below its entry threshold, which prevents rapid switching near a boundary. Individual intervention modules can be disabled in serverconfig/freeserversaver-server.toml.
Protected activity
Bosses, named mobs, leashed or tamed mobs, and other persistent entities are excluded from destructive intervention. Combat, pathfinding, projectiles, visible timed states, and moving entities continue at full rate. Newly spawned entities receive a five-second grace period. Random ticks for crops, leaves, snow, and fire are not changed.
Operator tools
All /fss commands require permission level 2. Key commands include:
/fss status and /fss metrics — show the current tier, heap use, player count, loaded chunks, and view distance.
/fss history and /fss lagspikes — show recent tier changes and ticks longer than 100 ms.
/fss top entities and /fss inspect chunks — help locate entity-heavy or heavily loaded areas.
/fss storage and /fss prune — report world size and identify isolated loaded chunks. They do not delete world files.
/fss pregen [radius] — generates chunks around the command source; it yields when Chunky is installed.
/fss quarantine — lists entities or block entities removed after repeatedly throwing tick exceptions.
Metaspace monitoring, boot-time history, an idle-timer notice, and Discord alerts are also available. The Discord webhook, automatic threshold tuning, and mob-density scan are disabled by default.
Compatibility and limits
At startup, Free Server Saver disables specific overlapping modules when it detects supported performance or recovery mods. For example, it yields chunk pre-generation to Chunky and exception quarantine to Neruina, Bug Fix Mod, or Failsafe. The startup log records each disabled module.
The emergency tier can remove eligible distant mobs, and exception quarantine can remove faulty entity data after repeated failures. Back up the world before using these features. The current release has build and automated checks but has not yet been validated on a live production server.

Paid commissions for videos, streams and servers. Send me your idea: kuronami.mods@gmail.com

All Rights Reserved. Modpack inclusion is allowed without permission or credit. This is an unofficial community mod and is not affiliated with any hosting provider.
Bugs and questions: comment on the CurseForge page, or DM @kuronami333 on X.
Source
评论 0
登录后参与评分
还没有评论,来抢沙发吧