Merge branch 'trim-vanes' (#1782)

* trim-vanes:
  updates solid pill
  arvo: clear caches in response to (high) memory pressure
  gall: clear caches in response to memory pressure
  eyre: close channels in response to memory pressure
  ford: clear caches in response to memory pressure

Signed-off-by: Jared Tobin <jared@tlon.io>
This commit is contained in:
Jared Tobin 2019-10-02 12:21:56 +04:00
commit aa8baa367c
No known key found for this signature in database
GPG Key ID: 0E4647D58F8A69E4
5 changed files with 69 additions and 7 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:31ca4bd0c41fbe176093b81e08a942d5d0b8cebb6c797ea7c96ddc5fb7600583
size 15901599
oid sha256:b216f4a1f018c0c4e3494bbb8c557ff8e16762edfeff11e3953e00f72c425e0a
size 16014429

View File

@ -782,9 +782,14 @@
:: notifications, spammed to every vane
::
?: ?=(%trim -.q.ovo)
=> .(ovo ;;((pair wire [%trim @ud]) ovo))
=> .(ovo ;;((pair wire [%trim p=@ud]) ovo))
=^ zef vanes
(~(spam (is our vil eny bud vanes) now) lac ovo)
:: clear compiler caches if high-priority
::
=? vanes =(0 p.q.ovo)
~> %slog.[0 leaf+"arvo: trim: clearing caches"]
(turn vanes |=([a=@tas =vane] [a vase.vane *worm]))
[zef +>.$]
::
:: Normal events are routed to a single vane

View File

@ -1910,8 +1910,42 @@
[~ http-server-gate]
:: %trim: in response to memory pressure
::
:: Cancel all inactive channels
:: XX cancel active too if =(0 trim-priority) ?
::
?: ?=(%trim -.task)
[~ http-server-gate]
=/ event-args [[our eny duct now scry-gate] server-state.ax]
=* by-channel by-channel:(per-server-event event-args)
=* channel-state channel-state.server-state.ax
::
=/ inactive=(list @t)
=/ full=(set @t) ~(key by session.channel-state)
=/ live=(set @t)
(~(gas in *(set @t)) ~(val by duct-to-key.channel-state))
~(tap in (~(dif in full) live))
::
?: =(~ inactive)
[~ http-server-gate]
::
=/ len=tape (scow %ud (lent inactive))
~> %slog.[0 leaf+"eyre: trim: closing {len} inactive channels"]
::
=| moves=(list (list move))
|- ^- [(list move) _http-server-gate]
=* channel-id i.inactive
?~ inactive
[(zing (flop moves)) http-server-gate]
:: discard channel state, and cancel any active gall subscriptions
::
=^ mov server-state.ax (on-channel-timeout:by-channel channel-id)
:: cancel channel timer
::
=/ channel (~(got by session.channel-state) channel-id)
=? mov ?=([%& *] state.channel)
:_ mov
(cancel-timeout-move:by-channel channel-id p.state.channel)
$(moves [mov moves], inactive t.inactive)
::
:: %vega: notifies us of a completed kernel upgrade
::
?: ?=(%vega -.task)

View File

@ -6171,10 +6171,27 @@
::
:: %trim: in response to memory pressure
::
:: XX clear cache
::
%trim
::
?. =(0 p.task)
:: low-priority: remove 50% of cache/stored-builds
::
~> %slog.[0 leaf+"ford: trim: pruning caches"]
=. state.ax (wipe:this-event 50)
[~ ford-gate]
::
:: high-priority: remove 100% of cache/stored-builds
::
:: We use %keep to ensure that cache-keys are also purged,
:: then restore original limits to allow future caching.
::
:: XX cancel in-progress builds?
::
~> %slog.[0 leaf+"ford: trim: clearing caches"]
=/ b-max max-size.queue.build-cache.state.ax
=/ c-max max-size.compiler-cache.state.ax
=. state.ax (keep:this-event 0 0)
=. state.ax (keep:this-event c-max b-max)
[~ ford-gate]
::
:: %vega: learn of kernel upgrade

View File

@ -2478,7 +2478,13 @@
[~ payload]
::
%trim
[~ gall-payload]
:: reuse %wash task to clear caches on memory-pressure
::
:: XX cancel subscriptions if =(0 trim-priority) ?
::
~> %slog.[0 leaf+"gall: trim: clearing caches"]
=/ =move [duct %pass / %g [%wash ~]]
[[move ~] gall-payload]
::
%vega
[~ gall-payload]