Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UseNoopMemMonitor ¶
func UseNoopMemMonitor()
UseNoopMemMonitor creates a noop implementation of mem-monitor if we want to fully disable it with minimal penalty
Types ¶
type MemMonitor ¶
type MemMonitor interface { // Increment adds the mem used by the given MemAccountable to the internal counter // Call this when initializing a new instance of that MemAccountable Increment(Sizeable) // Decrement subtracts the mem used by the given MemAccountable from the internal counter // Call this when the last ref to that MemAccountable is given up Decrement(Sizeable) // Fence blocks while mem usage accounted by MemManager is above the watermark // Multiple goroutines can call and be blocked by Fence Fence() // Breached returns true if mem usage is currently above the watermark and hasn't gone below recoveryWatermark yet Breached() bool }
MemMonitor watches memory usages and provides alarms when usage breaches watermark Users of the monitor should call Fence() to stall operations while alarms are breached Fence blocks till accounted memory usage falls below the recovery watermark which is lower than the actual threshold to enable some breathing room It is safe to call methods on MemMonitor from multiple goroutines
func GetMemMonitor ¶
func GetMemMonitor() MemMonitor
GetMemMonitor returns a ready mem monitor - Call ConfigureMemMonitor before this otherwise this method will panic
Click to show internal directories.
Click to hide internal directories.