resource_silo (faber_neuroevolution v1.2.4)

View Source

Resource Silo - System stability controller for neuroevolution.

Part of the Liquid Conglomerate v2 architecture. The Resource Silo monitors system resources and provides recommended parameters to maintain stability.

Operating Modes

The Resource Silo can operate in two modes:

training: Full control with aggressive resource management (default) - 1 second sample interval - Can pause training on critical memory pressure - Can trigger GC on high memory usage

inference: Lightweight monitoring for production inference - 5 second sample interval (reduced overhead) - Never pauses (should_pause always returns false) - No forced GC (prioritizes latency) - Still publishes events for observability

Hierarchical Levels

L0 (Emergency): Hard limits, GC triggers, pause if critical - ALWAYS ACTIVE L1 (Reactive): Adjust concurrency based on current pressure L2 (Predictive): Learn resource patterns, anticipate needs (future)

Time Constant

tau = 5 (fast adaptation for system stability)

Summary

Functions

Force garbage collection on all processes.

Get the current operating mode.

Get recommendations from the registered server.

Get recommended parameters based on current resource state.

Get current silo state from the registered server.

Get current silo state for debugging/monitoring.

Set which levels are enabled.

Set the operating mode (training or inference).

Check pause status from registered server.

Check if evolution should pause due to resource pressure.

Start the resource silo with default configuration.

Start the resource silo with custom configuration.

Functions

code_change(OldVsn, State, Extra)

force_gc()

-spec force_gc() -> ok.

Force garbage collection on all processes.

get_mode()

-spec get_mode() -> training | inference.

Get the current operating mode.

get_recommendations()

-spec get_recommendations() -> map().

Get recommendations from the registered server.

get_recommendations(Pid)

-spec get_recommendations(pid()) -> map().

Get recommended parameters based on current resource state.

Returns a map with: - max_concurrent: Recommended max concurrent evaluations - action: continue | throttle | pause - memory_pressure: Current memory pressure (0.0-1.0) - cpu_pressure: Current CPU pressure (0.0-1.0) - reason: Explanation for the recommendation

get_state()

-spec get_state() -> map().

Get current silo state from the registered server.

get_state(Pid)

-spec get_state(pid()) -> map().

Get current silo state for debugging/monitoring.

handle_call(Request, From, State)

handle_cast(Msg, State)

handle_info(Info, State)

init(Config)

set_enabled_levels(Pid, Levels)

-spec set_enabled_levels(pid(), [l0 | l1 | l2]) -> ok.

Set which levels are enabled.

set_mode(Mode)

-spec set_mode(training | inference) -> ok.

Set the operating mode (training or inference).

In inference mode: - should_pause() always returns false (never block inference) - Longer sample interval (5s vs 1s) - force_gc has no effect (don't interfere with inference latency) - Still publishes monitoring events for observability

should_pause()

-spec should_pause() -> boolean().

Check pause status from registered server.

should_pause(Pid)

-spec should_pause(pid()) -> boolean().

Check if evolution should pause due to resource pressure.

start_link()

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

Start the resource silo with default configuration.

start_link(Config)

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

Start the resource silo with custom configuration.

Options: - enabled_levels: [l0, l1, l2] (default: [l0, l1]) - base_concurrency: Base concurrent evaluations (default: 10) - memory_high_threshold: Memory pressure for throttling (default: 0.7) - memory_critical_threshold: Memory pressure for pausing (default: 0.9) - cpu_high_threshold: CPU pressure for throttling (default: 0.9) - sample_interval: Metrics sample interval in ms (default: 1000)

terminate(Reason, State)