-
-
Notifications
You must be signed in to change notification settings - Fork 4
Performance
This page covers the config that reduces load, smooths spikes, and spreads heavy work out over time.
- Config model:
sources/VintagestoryLib/Vintagestory/Server/StratumConfig.cs(StratumPerformanceConfig) - Runtime metrics/timings:
sources/VintagestoryLib/Vintagestory/Server/StratumPerformanceStats.cs,sources/VintagestoryLib/Vintagestory/Server/StratumTimings.cs - Behavior changes: performance-related files under
patches/
StratumRuntime owns the main performance systems:
PacketLimiterPacketBackPressurePerformanceStatsTimingsPregen
ServerSystemStratum.OnBeginConfiguration also uses the performance config to wire startup behavior like block-entity staggering and timer resolution.
StratumBlockEntityInitConfig beInit = StratumRuntime.Config.Performance.BlockEntityInit;
BlockEntity.StratumDefaultInitialDelaySpreadMs = (beInit != null && beInit.Enabled) ? beInit.MaxStaggerMs : 0;
StratumTimerResolutionConfig timerCfg = StratumRuntime.Config.Performance.TimerResolution;
if (timerCfg != null && timerCfg.Enabled && stratumActiveTimerPeriodMs == 0
&& RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
uint period = (uint)Math.Max(1, timerCfg.PeriodMs);
uint result = StratumTimeBeginPeriod(period);
}ChunkSending caps how many chunks are sent per server tick and per client tick.
ChunkGeneration caps chunk-column request throughput.
This keeps stale requests from sitting around forever and adds distance-aware prioritization for moving players.
This is the pre-generation throttle. It controls how much pregeneration can run per second, how big the queues can get, and whether pregeneration pauses when players are online.
This limits random ticks and block game tick listeners by distance.
This handles activation ranges, catch-up ticks, and overloaded tick behavior.
This is where far entity ticking, moving-entity skipping, and ambient fauna throttling live.
This spaces out save work and lets chunk pressure delay some of it.
This caps random ticks, main-thread block ticks, and overload scaling.
This is the Stratum timings system. It starts disabled unless EnabledOnStartup is set.
This adds slowdown thresholds and adaptive throttling for entity/block listeners.
This is the collision cap behind repulse-agents.
This spreads block-entity startup across time so a chunk load does not dump everything on the same tick.
This raises Windows timer resolution so the server can sleep accurately instead of getting stuck on the default scheduler tick.
The comment in StratumConfig says why this exists:
// Windows multimedia-timer resolution boost. Without this, Thread.Sleep() on Windows
// rounds up to the next ~15.6ms scheduler tick, capping the server's effective tickrate
// at ~25 tps regardless of how little work each tick does.These are the main patch files that use the performance config:
patches/VintagestoryLib/Vintagestory.Server/ServerMain.cs.patchpatches/VintagestoryLib/Vintagestory.Server/ServerSystemSendChunks.cs.patchpatches/VintagestoryLib/Vintagestory.Server/ServerSystemEntitySimulation.cs.patchpatches/VintagestoryLib/Vintagestory.Server/ServerSystemBlockSimulation.cs.patchpatches/VintagestoryLib/Vintagestory.Server/PhysicsManager.cs.patchpatches/VintagestoryLib/Vintagestory.Common/EventManager.cs.patchpatches/VintagestoryLib/Vintagestory.Server/BlockAccessorWorldGen.cs.patchpatches/VintagestoryLib/Vintagestory.Server/BlockAccessorWorldGenUpdateHeightmap.cs.patchpatches/VSEssentials/Systems/EntityPartitioning.cs.patchpatches/VSEssentials/Entity/Behavior/BehaviorRepulseAgents.cs.patchpatches/VSEssentials/Entity/Behavior/BehaviorDespawn.cs.patchpatches/VSEssentials/Entity/AI/AiTaskManager.cs.patchpatches/VSSurvivalMod/Entity/Behavior/BehaviorBodyTemperature.cs.patchpatches/VintagestoryApi/Common/BlockEntity.cs.patch
If someone wants to understand the performance config first, start with:
ChunkSendingPacketBackPressureEntityTickingPhysicsBlockTicksEventTick
Those are the settings that show up most clearly in the tick profile.
- Feature: Chunk Send and Request Management
- Feature: Packet Back-Pressure
- Feature: Entity Partition Reuse
- Feature: Physics Tracking and State Packet Batching
- Feature: Repulse-Agents Gate and Collision Cap
- Feature: Selection Raytrace Throttle
- Feature: AI Task Scan Throttle
- Feature: Body Temperature Tick Throttling
- Feature: Async Pathfinding Workers and Queue Bound
- Feature: Event Tick Adaptive Throttle
- Feature: Timed Despawn Stagger and Budget
- Feature: Block Tick Smoothing
- Feature: Incremental Autosave and Chunk IO Read Pool
- Feature: Startup Wiring and Timer Resolution