Optimize Metric Collection to Reduce Server CPU Usage
Controlling What Gets Measured
Not every metric is equally important. Disabling unnecessary telemetry reduces CPU overhead and keeps your server responsive.
Configuring Metric Sampling
1. Open your mod configuration file.
2. Use metrics.enabled-only to restrict monitoring to essential metrics like TPS, MSPT, and player count.
3. Disable player-detail samplers with metrics.enable-player-details-samplers: false if you don't need individual experience or level tracking.
4. Add metrics.disabled entries for any metrics you don't monitor in Grafana.
5. Enable metrics.freeze-when-server-paused to stop sampling when the server is idle, saving CPU power during downtime.
Fine-Tuning Performance
Start with minimal metrics enabled, then gradually add more as needed:
- Essential: TPS, MSPT, player count, loaded chunks.
- Useful: Entity counts by type, network activity, chunk generation.
- Optional: Individual player statistics, detailed dimension breakdowns.
Test your server's CPU usage after each change. The goal is meaningful monitoring without performance cost.