PulseNet
高性能网络的心跳 - Fabric 版,由 BorisShoes 制作
PulseNet 是一款 Fabric 模组,为 Minecraft 服务器带来高性能的数据包批处理功能。通过将标准的逐数据包网络刷新替换为智能批处理机制,PulseNet 在保持关键数据包低延迟传输的同时,减少了系统调用开销和 CPU 使用率。
项目概述
PulseNet 是一款 Fabric 模组,用智能批处理系统替代了 Minecraft 默认的逐数据包网络刷新机制。出站数据包被分组并统一刷新,大幅降低了内核系统调用开销和事件循环任务调度,同时确保战斗、聊天和其他对延迟敏感的数据包能够即时传输。通过 Mixin 兼容性设计,该模组可与其他 Fabric 模组无缝协同工作。
安装
PulseNet 是一款仅服务端的 Fabric 模组。将其放入 mods/ 文件夹中,与 Fabric API 一同放置即可。
要求:
功能特性
| 功能 |
描述 |
| 智能数据包批处理 |
将单个 tick 内的出站数据包进行分组,并在单次内核系统调用中统一刷新,而非逐个发送。支持三种模式:smart_execution(智能执行)、strict_tick(严格 tick)和 interval(间隔)。 |
| 写入队列 |
将逐数据包的事件循环任务提交替换为单一的批量写入任务,消除 lambda 表达式分配和跨线程调度的开销。 |
| 数据包合并 |
将类似的低优先级数据包(粒子效果、音效)打包为 BundlePacket,减少客户端接收到的数据包数量。 |
| 爆炸优化 |
检测爆炸导致的批量方块变化,当超过可配置阈值时,用完整的区块重传替换单独的方块更新数据包。 |
| 数据包分类 |
自动将数据包分类为关键(Critical)、即时(Instant)、聊天(Chat)、忽略(Ignored)或合并(Coalesce)——确保对延迟敏感的数据包(心跳、断开连接、战斗)始终绕过缓冲区。Fabric 基础设施数据包(minecraft:register、minecraft:unregister)在 Connection 级别处理,以防止模组握手失败。 |
| 实时指标 |
内置指标系统,跟踪逻辑/物理 PPS(每秒数据包数)、带宽、CPU 使用率、内存节省情况以及写入队列效率。可通过命令或游戏内 Boss 栏查看。 |
| Mixin 兼容性 |
采用 @WrapOperation 方法,在所有其他 Mixin(如 Polymer、服务端翻译等)之后运行,确保与 Fabric 模组生态系统的完全兼容。 |
| 热重载配置 |
所有设置均可通过 pulse.properties 文件和游戏内命令(/pulse config、/pulse reload)进行配置,无需重启服务器。 |
命令
| 命令 |
描述 |
/pulse |
显示当前 PulseNet 版本。 |
/pulse reload |
从磁盘重新加载配置文件。 |
/pulse config |
在游戏内查看和修改所有配置设置。 |
/pulse netstats [network|cpu|ram|all] |
显示实时的网络、CPU 和内存统计信息。 |
/pulse netstats bar |
切换指标 Boss 栏叠加层。 |
/pulse netstats reset |
将所有指标计数器重置为零。 |
/pulse packetNames |
列出所有观察到的数据包类名和通道 ID。 |
/pulse packetNames classes |
仅列出观察到的数据包类名。 |
/pulse packetNames channels |
仅列出观察到的自定义负载通道 ID。 |
/pulse packetNames reset |
清除已观察到的数据包名称列表。 |
配置命令
以下命令可用于在不重启服务器的情况下调整 pulse.properties 文件中的可配置设置(运行这些命令后,请使用 /pulse reload 热重载更改)。这些命令可以附加一个值来设置该选项,或者不带值以查看当前设置。
/pulse config batchingEnabled 智能数据包批处理系统的主开关。当为 true 时,出站数据包会被缓冲并按批次刷新,而不是逐个发送。(默认:true)
/pulse config batchingMode 批处理模式:smart_execution(在刻 + 限制条件下刷新)、strict_tick(仅在刻结束时刷新)、interval(按计时器刷新)。(默认:smart_execution)
/pulse config batchingMaxBatchSize 强制刷新前缓冲的最大数据包数量。(默认:1024)
/pulse config batchingMaxBatchBytes 强制刷新前缓冲的最大字节数。(默认:32000)
/pulse config batchingFlushInterval INTERVAL 批处理模式的刷新间隔(毫秒)。(默认:25)
/pulse config batchingSafetyMarginBytes 从最大批次字节限制中减去的字节安全余量,以防止溢出。(默认:64)
/pulse config batchingInstantPackets 应在发送时立即刷新缓冲区的类名列表。(默认:ClientboundHurtAnimationPacket, ClientboundDamageEventPacket, ClientboundBlockEntityDataPacket)
/pulse config batchingIgnoredPackets 应始终完全绕过缓冲区的数据包类名列表。(默认:[])
/pulse config batchingInstantChannels 自定义负载数据包应在发送时立即刷新缓冲区的插件频道 ID 列表(例如 axiom:hello)。使用 /pulse packetNames channels 发现频道 ID。(默认:[])
/pulse config batchingIgnoredChannels 其自定义负载数据包应始终完全绕过缓冲区的插件频道 ID 列表。使用 /pulse packetNames channels 发现频道 ID。注意:minecraft:register 和 minecraft:unregister 在 Connection 级别处理,并且无论此列表如何,都会始终绕过缓冲区。(默认:[])
/pulse config batchingChatPacketsBypass 当为 true 时,与聊天相关的数据包将绕过缓冲区以实现即时传输。(默认:true)
/pulse config batchingOffThreadBypass 当为 true 时,来自服务器线程之外的数据包将绕过缓冲区。(默认:true)
/pulse config batchingWriteQueue 当为 true 时,缓冲的数据包会被排队并在单个事件循环任务中写入,而不是每个数据包调用 Connection.send(),从而消除每数据包的 lambda 分配和跨线程任务调度。(默认:true)
/pulse config batchingPacketCoalescing 当为 true 时,合并列表中的数据包会在刷新时捆绑到 BundlePackets 中,减少客户端接收的数据包数量。(默认:true)
/pulse config batchingCoalescePackets 要合并到 BundlePackets 中的数据包类名列表(例如粒子、声音)。支持使用点语法表示内部类 (Foo.Bar)。(默认:ClientboundLevelParticlesPacket, ClientboundSoundPacket, ClientboundSoundEntityPacket)
/pulse config batchingCoalesceBundleLimit 每个 BundlePacket 的最大子数据包数量。Vanilla 客户端强制执行 4096 的硬限制。(默认:4000)
/pulse config optExplosionsEnabled 当为 true 时,爆炸产生的方块更新会按区块分组,如果超过阈值则替换为整个区块的重发。(默认:true)
/pulse config optExplosionsBlockChangeThreshold 单个区块内需要触发整个区块重发而非单独更新的方块变化数量。(默认:512)
/pulse config optExplosionsLogOptimizations 当为 true 时,每次爆炸优化用区块重发替换方块更新时记录一条消息。(默认:false)
/pulse config metricsEnabled 当为 true 时,指标收集系统处于活动状态并计算网络统计信息。(默认:true)
/pulse config metricsUpdateInterval 指标系统重新计算衍生统计信息的频率(秒)。(默认:1)
/pulse config metricsModuleNetwork 启用网络指标模块(PPS、带宽)。(默认:true)
/pulse config metricsModuleCpu 启用 CPU 指标模块(进程 CPU 使用率估算)。(默认:true)
/pulse config metricsModuleMemory 启用内存指标模块(保存的分配估算)。(默认:true)
/pulse config metricsModuleWriteQueue 启用写入队列指标模块(事件循环任务节省跟踪)。(默认:true)
权限节点
PulseNet 使用 Fabric Permissions API 进行命令权限管理。每个节点都有一个回退的 Vanilla 权限等级,适用于没有安装权限模组的服务器。
通用
| 节点 |
默认值 |
描述 |
pulsenet.pulse |
ALL |
访问 /pulse 基础命令(显示版本) |
pulsenet.reload |
GAMEMASTERS |
重载 PulseNet 配置文件 |
pulsenet.netstats |
GAMEMASTERS |
查看网络、CPU 和内存统计信息 |
pulsenet.netstats.bar |
GAMEMASTERS |
切换指标 Boss Bar 覆盖层 |
pulsenet.netstats.reset |
GAMEMASTERS |
将所有指标计数器重置为零 |
pulsenet.packetnames |
GAMEMASTERS |
列出观察到的数据包类名和频道 ID |
配置
配置命令会根据每个配置值动态生成。下面的 <name> 对应驼峰式命名的配置键(例如 batchingEnabled、metricsUpdateInterval)。
| 节点 |
默认值 |
描述 |
pulsenet.config |
GAMEMASTERS |
列出所有配置值 |
pulsenet.config.<name>.get |
GAMEMASTERS |
读取特定配置值 |
pulsenet.config.<name>.set |
GAMEMASTERS |
更改特定配置值 |
试试我的其他模组!
所有服务端 Fabric 模组 —— 无需安装客户端。
|
模组 |
描述 |
链接 |
 |
Arcana Novum |
Minecraft 最大的仅限服务器的全功能魔法模组!添加了强大的物品、多方块结构和首领! |
|
 |
Ancestral Archetypes |
一个高度可配置的 Origins 风格模组,允许玩家选择一种生物以获得独特能力! |
|
 |
Ender Nexus |
将高度可配置的 /home、/spawn、/warp、/tpa 和 /rtp 命令合而为一,且支持单独禁用。 |
|
 |
Fabric Mail |
用于在在线和离线玩家之间发送包裹和消息的游戏内虚拟邮箱系统。 |
|
 |
Fabric Trade |
添加 /trade 命令,提供安全的玩家间交易界面。 |
|
 |
Limited AFK |
闲置检测与管理,为服务器配置踢出阈值。 |
|
|
| 聊天中的链接 | 使在聊天中发布的 URL 可点击。 | |
支持与贡献
PulseNet 是 PulseMC 开发的开源项目。我们欢迎关于 Netty、Mixin 以及协议层面优化的贡献。
PulseNet:高性能网络的心脏。
PulseNet
The Heartbeat of High-Performance Networking - Fabric Edition by BorisShoes
PulseNet is a Fabric mod that brings high-performance packet batching to your Minecraft server. By replacing standard per-packet network flushes with intelligent batching, PulseNet reduces system call overhead and CPU usage while maintaining low-latency delivery of critical packets.
Project Overview
PulseNet is a Fabric mod that replaces Minecraft's default per-packet network flushing with a smart batching system. Outgoing packets are grouped and flushed together, drastically reducing kernel syscall overhead and event loop task scheduling while keeping combat, chat, and other latency-sensitive packets instant. Designed to work seamlessly alongside other Fabric mods via Mixin compatibility.
Installation
PulseNet is a server-side Fabric mod. Drop it into your mods/ folder alongside Fabric API.
Requirements:
Features
| Feature |
Description |
| Smart Packet Batching |
Groups outgoing packets within a tick and flushes them in a single kernel syscall instead of one per packet. Supports three modes: smart_execution, strict_tick, and interval. |
| Write Queue |
Replaces per-packet event loop task submissions with a single batched write task, eliminating lambda allocations and cross-thread scheduling overhead. |
| Packet Coalescing |
Bundles similar low-priority packets (particles, sounds) into BundlePackets, reducing the client's received packet count. |
| Explosion Optimization |
Detects mass block changes from explosions and replaces individual block update packets with a full chunk resend when a configurable threshold is exceeded. |
| Packet Classification |
Automatically classifies packets as Critical, Instant, Chat, Ignored, or Coalesce — ensuring latency-sensitive packets (keepalive, disconnect, combat) always bypass the buffer. Fabric infrastructure packets (minecraft:register, minecraft:unregister) are handled at the Connection level to prevent mod handshake failures. |
| Real-Time Metrics |
Built-in metrics system tracking logical/physical PPS, bandwidth, CPU usage, memory savings, and write queue efficiency. Viewable via commands or an in-game boss bar. |
| Mixin Compatibility |
Uses a @WrapOperation approach that runs after all other mixins (Polymer, server-side translations, etc.), ensuring full compatibility with the Fabric mod ecosystem. |
| Hot-Reloadable Config |
All settings are configurable via pulse.properties and in-game commands (/pulse config, /pulse reload) with no restart required. |
Commands
| Command |
Description |
/pulse |
Displays the current PulseNet version. |
/pulse reload |
Reloads the configuration from disk. |
/pulse config |
View and modify all configuration settings in-game. |
/pulse netstats [network|cpu|ram|all] |
Displays real-time network, CPU, and memory statistics. |
/pulse netstats bar |
Toggles the metrics boss bar overlay. |
/pulse netstats reset |
Resets all metrics counters to zero. |
/pulse packetNames |
Lists all observed packet class names and channel IDs. |
/pulse packetNames classes |
Lists only observed packet class names. |
/pulse packetNames channels |
Lists only observed custom payload channel IDs. |
/pulse packetNames reset |
Clears the observed packet name lists. |
Config Commands
The following commands can be used to adjust configurable settings in the pulse.properties file without a server reboot (Use /pulse reload after running these commands to hotswap changes). These commands can be suffixed with a value to set the setting, or used without a value to view the current setting.
/pulse config batchingEnabled Master toggle for the smart packet batching system. When true, outgoing packets are buffered and flushed in batches instead of individually. (default: true)
/pulse config batchingMode Batching mode: smart_execution (flush on tick + limits), strict_tick (flush only on tick end), interval (flush on a timer). (default: smart_execution)
/pulse config batchingMaxBatchSize Maximum number of packets to buffer before forcing a flush. (default: 1024)
/pulse config batchingMaxBatchBytes Maximum bytes to buffer before forcing a flush. (default: 32000)
/pulse config batchingFlushInterval Interval in milliseconds for the INTERVAL batching mode. (default: 25)
/pulse config batchingSafetyMarginBytes Safety margin in bytes subtracted from the max batch bytes limit to prevent overflow. (default: 64)
/pulse config batchingInstantPackets List of packet class names that should flush the buffer immediately when sent. (default: ClientboundHurtAnimationPacket, ClientboundDamageEventPacket, ClientboundBlockEntityDataPacket)
/pulse config batchingIgnoredPackets List of packet class names that should always bypass the buffer entirely. (default: [])
/pulse config batchingInstantChannels List of plugin channel IDs (e.g. axiom:hello) whose custom payload packets should flush the buffer immediately when sent. Use /pulse packetNames channels to discover channel IDs. (default: [])
/pulse config batchingIgnoredChannels List of plugin channel IDs whose custom payload packets should always bypass the buffer entirely. Use /pulse packetNames channels to discover channel IDs. Note: minecraft:register and minecraft:unregister are handled at the Connection level and always bypass the buffer regardless of this list. (default: [])
/pulse config batchingChatPacketsBypass When true, chat-related packets bypass the buffer for instant delivery. (default: true)
/pulse config batchingOffThreadBypass When true, packets sent from off the server thread bypass the buffer. (default: true)
/pulse config batchingWriteQueue When true, buffered packets are queued and written in a single event loop task instead of calling Connection.send() per packet, eliminating per-packet lambda allocations and cross-thread task scheduling. (default: true)
/pulse config batchingPacketCoalescing When true, packets in the coalesce list are bundled together into BundlePackets on flush, reducing the client's received packet count. (default: true)
/pulse config batchingCoalescePackets List of packet class names to coalesce into BundlePackets (e.g. particles, sounds). Supports inner classes with dot syntax (Foo.Bar). (default: ClientboundLevelParticlesPacket, ClientboundSoundPacket, ClientboundSoundEntityPacket)
/pulse config batchingCoalesceBundleLimit Maximum number of sub-packets per BundlePacket. Vanilla client enforces a hard limit of 4096. (default: 4000)
/pulse config optExplosionsEnabled When true, block updates from explosions are grouped by chunk and replaced with full chunk resends if they exceed the threshold. (default: true)
/pulse config optExplosionsBlockChangeThreshold Number of block changes in a single chunk required to trigger a full chunk resend instead of individual updates. (default: 512)
/pulse config optExplosionsLogOptimizations When true, logs a message each time the explosion optimization replaces block updates with a chunk resend. (default: false)
/pulse config metricsEnabled When true, the metrics collection system is active and computes network statistics. (default: true)
/pulse config metricsUpdateInterval How often (in seconds) the metrics system recomputes derived statistics. (default: 1)
/pulse config metricsModuleNetwork Enables the network metrics module (PPS, bandwidth). (default: true)
/pulse config metricsModuleCpu Enables the CPU metrics module (process CPU usage estimation). (default: true)
/pulse config metricsModuleMemory Enables the memory metrics module (saved allocation estimation). (default: true)
/pulse config metricsModuleWriteQueue Enables the write queue metrics module (event loop task savings tracking). (default: true)
Permission Nodes
PulseNet uses the Fabric Permissions API for command permissions. Each node has a fallback vanilla permission level for servers without a permissions mod.
General
| Node |
Default |
Description |
pulsenet.pulse |
ALL |
Access the /pulse base command (shows version) |
pulsenet.reload |
GAMEMASTERS |
Reload the PulseNet config file |
pulsenet.netstats |
GAMEMASTERS |
View network, CPU, and memory statistics |
pulsenet.netstats.bar |
GAMEMASTERS |
Toggle the metrics boss bar overlay |
pulsenet.netstats.reset |
GAMEMASTERS |
Reset all metrics counters to zero |
pulsenet.packetnames |
GAMEMASTERS |
List observed packet class names and channel IDs |
Config
Config commands are generated dynamically per config value. The <name> below corresponds to the camelCase config key (e.g. batchingEnabled, metricsUpdateInterval).
| Node |
Default |
Description |
pulsenet.config |
GAMEMASTERS |
List all config values |
pulsenet.config.<name>.get |
GAMEMASTERS |
Read a specific config value |
pulsenet.config.<name>.set |
GAMEMASTERS |
Change a specific config value |
Try My Other Mods!
All server-side Fabric mods — no client installation required.
|
Mod |
Description |
Links |
 |
Arcana Novum |
Minecraft's biggest server-only full-feature Magic Mod! Adds powerful items, multiblocks and bosses! |
|
 |
Ancestral Archetypes |
A highly configurable, Origins-style mod that lets players pick a mob to gain unique abilities! |
|
 |
Ender Nexus |
Highly configurable /home, /spawn, /warp, /tpa and /rtp commands all in one, and individually disablable. |
|
 |
Fabric Mail |
An in-game virtual mailbox system for sending packages and messages between online and offline players. |
|
 |
Fabric Trade |
Adds /trade, a secure player-to-player trading interface. |
|
 |
Limited AFK |
AFK detection and management with configurable kick thresholds for servers. |
|
 |
Links in Chat |
Makes URLs posted in chat clickable. |
|
Support and Contributions
PulseNet is an open-source project by PulseMC. We welcome contributions regarding Netty, Mixin, and protocol-level optimizations.
PulseNet: The Heartbeat of High-Performance Networking.
评论 0
登录后参与评分
还没有评论,来抢沙发吧