Class MemoryPressure
- Namespace
- McServerLauncher.Services
- Assembly
- McServerLauncher.dll
Decides from the GC log whether a server is short of memory. Pure, with the time given by the caller.
public sealed class MemoryPressure
- Inheritance
-
MemoryPressure
- Inherited Members
Remarks
What the process holds says nothing here: a healthy Java process looks full. What matters is what survives a collection and how much of the time the collector costs, which is what the GC log gives. Nothing is judged for Grace after the server is ready (loading a world is a burst every server has), except running out of memory, which is judged at once.
Pressure is any of these, once the grace has passed:
- for two minutes, with at least three collections, what is alive after each is over 75 % of the ceiling;
- the paused time is over 10 % of the last two minutes;
- a full collection nobody asked for, which counts for FullGcHold;
- the server reports running out of memory, which counts until the next Ready(DateTime, long).
A collection somebody forced (System.gc()) says nothing about need and is ignored.
Fields
FullGcHold
How long a full collection keeps the pressure on.
public static readonly TimeSpan FullGcHold
Field Value
Grace
How long after "Done" nothing is judged.
public static readonly TimeSpan Grace
Field Value
Sustained
How long a condition has to hold.
public static readonly TimeSpan Sustained
Field Value
Methods
AddGc(DateTime, GcEvent)
Takes in one collection from the GC log.
public void AddGc(DateTime now, GcEvent e)
Parameters
Evaluate(DateTime)
Why the server counts as short of memory at now, or none.
public MemoryPressureReason Evaluate(DateTime now)
Parameters
nowDateTime
Returns
OutOfMemory()
The server reported running out of memory.
public void OutOfMemory()
Ready(DateTime, long)
The server is ready: starts the grace period and forgets the last run.
public void Ready(DateTime now, long ceilingMb)
Parameters
Stopped()
The server stopped.
public void Stopped()