JVM heap pressure sentinel. Samples Runtime memory periodically, derives a 3-state pressure level (:normal :high :critical) with hysteresis, and publishes both to atoms that observers can read or subscribe to.
Does NOT enforce admission policy — that's the broker's job. The sentinel is the signal; consumers decide what to do with it.
JVM heap pressure sentinel. Samples Runtime memory periodically, derives a 3-state pressure level (:normal :high :critical) with hysteresis, and publishes both to atoms that observers can read or subscribe to. Does NOT enforce admission policy — that's the broker's job. The sentinel is the signal; consumers decide what to do with it.
(next-state prev fraction {:keys [low-mark high-mark critical-mark]})Pure: prev-state × fraction × watermarks → new-state.
Hysteresis bands: :normal --(>= high-mark)--> :high :normal --(>= critical-mark)--> :critical :high --(>= critical-mark)--> :critical :high --(< low-mark)--> :normal :critical --(< high-mark)--> :high :critical --(< low-mark)--> :normal
Pure: prev-state × fraction × watermarks → new-state. Hysteresis bands: :normal --(>= high-mark)--> :high :normal --(>= critical-mark)--> :critical :high --(>= critical-mark)--> :critical :high --(< low-mark)--> :normal :critical --(< high-mark)--> :high :critical --(< low-mark)--> :normal
(register-observer! s k f)Register an observer fn keyed by k. fn :: prev-state new-state sample → _. Returns the sentinel for chaining.
Register an observer fn keyed by k. fn :: prev-state new-state sample → _. Returns the sentinel for chaining.
(sample!)Read current JVM heap state. used = total - free; fraction = used / max.
Read current JVM heap state. used = total - free; fraction = used / max.
(snapshot s)Read current sample + state without waiting for next tick.
Read current sample + state without waiting for next tick.
(start-sentinel!)(start-sentinel! {:keys [name interval-ms watermarks start-state]
:or {name "default"
interval-ms 1000
watermarks default-watermarks
start-state :normal}})Start a daemon-thread sentinel that samples heap every :interval-ms.
Options: :name — diagnostic name (default "default") :interval-ms — sample interval (default 1000) :watermarks — {:low-mark :high-mark :critical-mark} (default 0.70/0.85/0.95) :start-state — initial state (default :normal)
Start a daemon-thread sentinel that samples heap every :interval-ms.
Options:
:name — diagnostic name (default "default")
:interval-ms — sample interval (default 1000)
:watermarks — {:low-mark :high-mark :critical-mark} (default 0.70/0.85/0.95)
:start-state — initial state (default :normal)cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |