evoq_memory_monitor (evoq v1.5.0)

View Source

Memory pressure monitor for adaptive TTL.

Monitors system memory usage and adjusts aggregate TTLs to prevent unbounded memory growth.

Pressure Levels:

  • normal - Memory below 70 percent, TTL factor 1.0x
  • elevated - Memory 70-85 percent, TTL factor 0.5x
  • critical - Memory above 85 percent, TTL factor 0.1x

Summary

Functions

Get the current memory pressure level.

Get memory monitor statistics.

Get the current TTL factor (0.0 - 1.0).

Start the memory monitor with default config.

Start the memory monitor with custom config. Options: - check_interval: Milliseconds between checks (default: 10000) - elevated_threshold: Memory % for elevated level (default: 0.70) - critical_threshold: Memory % for critical level (default: 0.85)

Types

pressure_level/0

-type pressure_level() :: normal | elevated | critical.

Functions

get_pressure_level()

-spec get_pressure_level() -> pressure_level().

Get the current memory pressure level.

get_stats()

-spec get_stats() -> map().

Get memory monitor statistics.

get_ttl_factor()

-spec get_ttl_factor() -> float().

Get the current TTL factor (0.0 - 1.0).

start_link()

-spec start_link() -> {ok, pid()} | {error, term()}.

Start the memory monitor with default config.

start_link(Config)

-spec start_link(map()) -> {ok, pid()} | {error, term()}.

Start the memory monitor with custom config. Options: - check_interval: Milliseconds between checks (default: 10000) - elevated_threshold: Memory % for elevated level (default: 0.70) - critical_threshold: Memory % for critical level (default: 0.85)