Class MemoryAgentPolicy
- Namespace
- McServerLauncher.Services
- Assembly
- McServerLauncher.dll
Decides, from how much memory the machine has free, whether the agent should hold a server's heap tighter. Pure: the app decides, the agent only carries it out.
public static class MemoryAgentPolicy
- Inheritance
-
MemoryAgentPolicy
- Inherited Members
Remarks
With the machine's free memory under 15 %, servers with nobody on tighten first: giving back what an empty server holds costs nobody anything. A server with players waits until it is under 10 %, when the machine is about to start swapping and a slightly busier collector is the lesser evil. Everything goes back to the relaxed margins only above 25 %: the gap is what keeps it from flapping when free memory hovers around one threshold.
The margins are the ones the lab found to give back the most without costing tick time; they are applied at run time because they cost a little collection time, which is worth paying only while the machine needs the memory.
Fields
Relax
Above this share every server goes back to the relaxed margins.
public const double Relax = 0.25
Field Value
RelaxedValues
The margins the app gives a server at start (they match MemoryProfile).
public static readonly (int MinFree, int MaxFree, int PeriodicMs) RelaxedValues
Field Value
TightValues
The tight margins.
public static readonly (int MinFree, int MaxFree, int PeriodicMs) TightValues
Field Value
TightenEmpty
Below this share of free memory a server with nobody on is tightened.
public const double TightenEmpty = 0.15
Field Value
TightenWithPlayers
Below this share a server with players is tightened too.
public const double TightenWithPlayers = 0.1
Field Value
Methods
ControlText(HeapMargins)
The text of the control file for a set of margins, as the agent reads it.
public static string ControlText(HeapMargins margins)
Parameters
marginsHeapMargins
Returns
Decide(HeapMargins, double, int)
The margins to hold now.
public static HeapMargins Decide(HeapMargins current, double freeShare, int players)
Parameters
currentHeapMarginsWhat the server has now.
freeSharedoubleThe machine's free memory as a share of its total, 0 to 1; negative when unknown.
playersintPlayers on the server.