ames: remove num-live from pump-metrics

This commit is contained in:
yosoyubik 2022-11-12 11:15:16 +01:00 committed by Zach Alberico
parent 4b0c1fab3b
commit a3e8607cb1
2 changed files with 129 additions and 42 deletions

View File

@ -657,7 +657,6 @@
:: rto: retransmission timeout :: rto: retransmission timeout
:: rtt: roundtrip time estimate, low-passed using EWMA :: rtt: roundtrip time estimate, low-passed using EWMA
:: rttvar: mean deviation of .rtt, also low-passed with EWMA :: rttvar: mean deviation of .rtt, also low-passed with EWMA
:: num-live: how many packets sent, awaiting ack
:: ssthresh: slow-start threshold :: ssthresh: slow-start threshold
:: cwnd: congestion window; max unacked packets :: cwnd: congestion window; max unacked packets
:: ::
@ -667,7 +666,6 @@
rttvar=_~s1 rttvar=_~s1
ssthresh=_10.000 ssthresh=_10.000
cwnd=_1 cwnd=_1
num-live=@ud
counter=@ud counter=@ud
== ==
+$ live-packet +$ live-packet

View File

@ -607,9 +607,7 @@
:: life: our $life; how many times we've rekeyed :: life: our $life; how many times we've rekeyed
:: crypto-core: interface for encryption and signing :: crypto-core: interface for encryption and signing
:: bug: debug printing configuration :: bug: debug printing configuration
:: corks(STALE):wires for cork flows pending publisher update
:: ::
:: Note: .corks is only still present for unreleased migration reasons
:: ::
+$ ames-state +$ ames-state
$: peers=(map ship ship-state) $: peers=(map ship ship-state)
@ -617,7 +615,6 @@
=life =life
crypto-core=acru:ames crypto-core=acru:ames
=bug =bug
corks=(set wire) ::TODO unused, remove in next version of state
== ==
:: ::
+$ ames-state-4 ames-state-5 +$ ames-state-4 ames-state-5
@ -644,7 +641,7 @@
route=(unit [direct=? =lane]) route=(unit [direct=? =lane])
=qos =qos
=ossuary =ossuary
snd=(map bone message-pump-state) snd=(map bone message-pump-state-8)
rcv=(map bone message-sink-state) rcv=(map bone message-sink-state)
nax=(set [=bone =message-num]) nax=(set [=bone =message-num])
heeds=(set duct) heeds=(set duct)
@ -673,19 +670,86 @@
route=(unit [direct=? =lane]) route=(unit [direct=? =lane])
=qos =qos
=ossuary =ossuary
snd=(map bone message-pump-state) snd=(map bone message-pump-state-8)
rcv=(map bone message-sink-state) rcv=(map bone message-sink-state)
nax=(set [=bone =message-num]) nax=(set [=bone =message-num])
heeds=(set duct) heeds=(set duct)
== ==
:: ::
+$ ship-state-8
$% [%alien alien-agenda]
[%known peer-state-8]
==
::
+$ peer-state-8
$: $: =symmetric-key
=life
=rift
=public-key
sponsor=ship
==
route=(unit [direct=? =lane])
=qos
=ossuary
snd=(map bone message-pump-state-8)
rcv=(map bone message-sink-state)
nax=(set [=bone =message-num])
heeds=(set duct)
closing=(set bone)
corked=(set bone)
krocs=(set bone)
==
::
+$ message-pump-state-8
$: current=_`message-num`1
next=_`message-num`1
unsent-messages=(qeu message-blob)
unsent-fragments=(list static-fragment)
queued-message-acks=(map message-num ack)
packet-pump-state=packet-pump-state-8
==
::
+$ packet-pump-state-8
$: next-wake=(unit @da)
live=(tree [live-packet-key live-packet-val])
metrics=pump-metrics-8
==
::
+$ pump-metrics-8
$: rto=_~s1
rtt=_~s1
rttvar=_~s1
ssthresh=_10.000
cwnd=_1
num-live=@ud
counter=@ud
==
::
+$ ames-state-7 +$ ames-state-7
$: peers=(map ship ship-state) $: peers=(map ship ship-state-8)
=unix=duct =unix=duct
=life =life
crypto-core=acru:ames crypto-core=acru:ames
=bug =bug
== ==
::
+$ ames-state-8
$: peers=(map ship ship-state-8)
=unix=duct
=life
crypto-core=acru:ames
=bug
corks=(set wire)
==
::
+$ cached-state
%- unit
$% [%5 ames-state-5]
[%6 ames-state-6]
[%7 ames-state-7]
[%8 ames-state-8]
[%9 ames-state]
==
:: $bug: debug printing configuration :: $bug: debug printing configuration
:: ::
:: veb: verbosity toggles :: veb: verbosity toggles
@ -841,7 +905,7 @@
:: ::
=< =* adult-gate . =< =* adult-gate .
=| queued-events=(qeu queued-event) =| queued-events=(qeu queued-event)
=| cached-state=(unit $%([%5 ames-state-5] [%6 ames-state-6] [%7 ames-state-7] [%8 ^ames-state])) =| =cached-state
:: ::
|= [now=@da eny=@ rof=roof] |= [now=@da eny=@ rof=roof]
=* larval-gate . =* larval-gate .
@ -963,7 +1027,7 @@
:: lifecycle arms; mostly pass-throughs to the contained adult ames :: lifecycle arms; mostly pass-throughs to the contained adult ames
:: ::
++ scry scry:adult-core ++ scry scry:adult-core
++ stay [%8 %larva queued-events ames-state.adult-gate] ++ stay [%9 %larva queued-events ames-state.adult-gate]
++ load ++ load
|= $= old |= $= old
$% $: %4 $% $: %4
@ -995,6 +1059,13 @@
[%adult state=ames-state-7] [%adult state=ames-state-7]
== == == ==
$: %8 $: %8
$% $: %larva
events=(qeu queued-event)
state=ames-state-8
==
[%adult state=ames-state-8]
== ==
$: %9
$% $: %larva $% $: %larva
events=(qeu queued-event) events=(qeu queued-event)
state=_ames-state.adult-gate state=_ames-state.adult-gate
@ -1039,12 +1110,22 @@
=. queued-events events.old =. queued-events events.old
larval-gate larval-gate
:: ::
[%8 %adult *] (load:adult-core %8 state.old) [%8 %adult *]
=. cached-state `[%8 state.old]
~> %slog.0^leaf/"ames: larva reload"
larval-gate
:: ::
[%8 %larva *] [%8 %larva *]
~> %slog.1^leaf/"ames: larva: load" ~> %slog.1^leaf/"ames: larva: load"
=. queued-events events.old =. queued-events events.old
=. adult-gate (load:adult-core %8 state.old) larval-gate
::
[%9 %adult *] (load:adult-core %9 state.old)
::
[%9 %larva *]
~> %slog.1^leaf/"ames: larva: load"
=. queued-events events.old
=. adult-gate (load:adult-core %9 state.old)
larval-gate larval-gate
:: ::
== ==
@ -1063,7 +1144,9 @@
~> %slog.0^leaf/"ames: init daily recork timer" ~> %slog.0^leaf/"ames: init daily recork timer"
:- [[/ames]~ %pass /recork %b %wait `@da`(add now ~d1)]~ :- [[/ames]~ %pass /recork %b %wait `@da`(add now ~d1)]~
8+(state-7-to-8:load:adult-core +.u.cached-state) 8+(state-7-to-8:load:adult-core +.u.cached-state)
?> ?=(%8 -.u.cached-state) =? u.cached-state ?=(%8 -.u.cached-state)
9+(state-8-to-9:load:adult-core +.u.cached-state)
?> ?=(%9 -.u.cached-state)
=. ames-state.adult-gate +.u.cached-state =. ames-state.adult-gate +.u.cached-state
[moz larval-core(cached-state ~)] [moz larval-core(cached-state ~)]
-- --
@ -1138,15 +1221,15 @@
[moves ames-gate] [moves ames-gate]
:: +stay: extract state before reload :: +stay: extract state before reload
:: ::
++ stay [%8 %adult ames-state] ++ stay [%9 %adult ames-state]
:: +load: load in old state after reload :: +load: load in old state after reload
:: ::
++ load ++ load
=< |= $= old-state =< |= $= old-state
$% [%8 ^ames-state] $% [%9 ^ames-state]
== ==
^+ ames-gate ^+ ames-gate
?> ?=(%8 -.old-state) ?> ?=(%9 -.old-state)
ames-gate(ames-state +.old-state) ames-gate(ames-state +.old-state)
:: ::
|% |%
@ -1162,10 +1245,10 @@
ship-state ship-state
=. snd.ship-state =. snd.ship-state
%- ~(run by snd.ship-state) %- ~(run by snd.ship-state)
|= =message-pump-state |= pump=message-pump-state-8
=. num-live.metrics.packet-pump-state.message-pump-state =. num-live.metrics.packet-pump-state.pump
~(wyt in live.packet-pump-state.message-pump-state) ~(wyt in live.packet-pump-state.pump)
message-pump-state pump
ship-state ship-state
ames-state ames-state
:: +state-5-to-6 called from larval-ames :: +state-5-to-6 called from larval-ames
@ -1199,18 +1282,18 @@
:_ +.ames-state :_ +.ames-state
%- ~(run by peers.ames-state) %- ~(run by peers.ames-state)
|= ship-state=ship-state-6 |= ship-state=ship-state-6
^- ^ship-state ^- ship-state-8
?. ?=(%known -.ship-state) ?. ?=(%known -.ship-state)
ship-state ship-state
:- %known :- %known
^- peer-state ^- peer-state-8
:- +<.ship-state :- +<.ship-state
[route qos ossuary snd rcv nax heeds ~ ~ ~]:ship-state [route qos ossuary snd rcv nax heeds ~ ~ ~]:ship-state
:: +state-7-to-8 called from larval-ames :: +state-7-to-8 called from larval-ames
:: ::
++ state-7-to-8 ++ state-7-to-8
|= ames-state=ames-state-7 |= ames-state=ames-state-7
^- ^^ames-state ^- ames-state-8
:* peers.ames-state :* peers.ames-state
unix-duct.ames-state unix-duct.ames-state
life.ames-state life.ames-state
@ -1218,6 +1301,28 @@
bug.ames-state bug.ames-state
*(set wire) *(set wire)
== ==
:: +state-8-to-9 called from larval-ames
::
++ state-8-to-9
|= ames-state=ames-state-8
^- ^^ames-state
:_ [unix-duct life crypto-core bug]:ames-state
%- ~(run by peers.ames-state)
|= ship-state=ship-state-8
^- ^ship-state
?. ?=(%known -.ship-state)
ship-state
%= ship-state
snd
%- ~(run by snd.ship-state)
|= pump=message-pump-state-8
^- message-pump-state
=* packet packet-pump-state.pump
%= pump
metrics.packet-pump-state
[rto rtt rttvar ssthresh cwnd counter]:metrics.packet
==
==
-- --
:: +scry: dereference namespace :: +scry: dereference namespace
:: ::
@ -1331,9 +1436,6 @@
=/ res =/ res
u.mps u.mps
``noun+!>(!>(res)) ``noun+!>(!>(res))
::
[%corks ~]
``noun+!>(~(tap in corks.ames-state))
== ==
-- --
:: |per-event: inner event-handling core :: |per-event: inner event-handling core
@ -3313,7 +3415,6 @@
:: update .live and .metrics :: update .live and .metrics
:: ::
=. live.state (gas:packet-queue live.state send-list) =. live.state (gas:packet-queue live.state send-list)
=. metrics.state (on-sent:gauge (lent send-list)) :: TODO remove
:: TMI :: TMI
:: ::
=> .(sent `(list static-fragment)`sent) => .(sent `(list static-fragment)`sent)
@ -3494,8 +3595,7 @@
:: +make-pump-gauge: construct |pump-gauge congestion control core :: +make-pump-gauge: construct |pump-gauge congestion control core
:: ::
++ make-pump-gauge ++ make-pump-gauge
|= [pump-metrics live-packets=@ud now=@da =ship =bug] |= [pump-metrics num-live=@ud now=@da =ship =bug]
:: TODO rename live-packets num-live
=* veb veb.bug =* veb veb.bug
=* metrics +<- =* metrics +<-
|% |%
@ -3517,16 +3617,7 @@
:: ::
++ num-slots ++ num-slots
^- @ud ^- @ud
(sub-safe cwnd live-packets) (sub-safe cwnd num-live)
:: +on-sent: adjust metrics based on sending .num-sent fresh packets
:: TODO remove
::
++ on-sent
|= num-sent=@ud
^- pump-metrics
::
=. num-live (add num-live num-sent)
metrics
:: +on-ack: adjust metrics based on a packet getting acknowledged :: +on-ack: adjust metrics based on a packet getting acknowledged
:: ::
++ on-ack ++ on-ack
@ -3534,7 +3625,6 @@
^- pump-metrics ^- pump-metrics
:: ::
=. counter +(counter) =. counter +(counter)
=. num-live (dec num-live) :: TODO remove
:: if below congestion threshold, add 1; else, add avg. 1 / cwnd :: if below congestion threshold, add 1; else, add avg. 1 / cwnd
:: ::
=. cwnd =. cwnd
@ -3605,7 +3695,7 @@
:: ::
++ in-recovery ++ in-recovery
^- ? ^- ?
(gth live-packets cwnd) (gth num-live cwnd)
:: +sub-safe: subtract with underflow protection :: +sub-safe: subtract with underflow protection
:: ::
++ sub-safe ++ sub-safe
@ -3622,7 +3712,6 @@
rttvar=(div rttvar ms) rttvar=(div rttvar ms)
ssthresh=ssthresh ssthresh=ssthresh
cwnd=cwnd cwnd=cwnd
num-live=live-packets :: TODO remove
num-live=num-live num-live=num-live
counter=counter counter=counter
== ==