Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@pkova
Copy link
Collaborator

@pkova pkova commented Jul 24, 2023

As discussed with @yosoyubik and @joemfb out of band.

I tested this with 50 000 dead flows. Without consolidation these flows resulted in a constant 30 % cpu usage. Consolidating the timers led to a CPU usage of almost 0 with a 100 % spike for a few seconds every two minutes.

The retry interval is the normal ~m2, we can make it configurable later.

Copy link
Collaborator

@joemfb joemfb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice, simple approach, and should dramatically reduce the number of retry timers we have to maintain (and therefore the events logged for retry). At some point, I think we should develop "offline" heuristics for a peer and backoff even further.

A couple things:

=^ moz u.cached-state
?. ?=(%15 -.u.cached-state) [~ u.cached-state]
~> %slog.0^leaf/"ames: init dead flow consolidation timer"
:- [[/ames]~ %pass /dead-flow %b %wait `@da`(add now ~m2)]~
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to duplicate this timer initialization somewhere else to catch fresh boot?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see no better way of doing this than state and +on-born. See a75a083 for how I decided to implement it. Note that the recork timer a few lines above this suffers from the same problem: it never gets initialized on new ships.

:: set new timer if non-null and not at max-backoff
::
=? peer-core ?=(^ new-wake)
?: =(~m2 rto.metrics.state)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth noting here (and above) that the ~m2 literal is important, we don't want to actually use max-backoff and accidentally consolidate the :ping app flow.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment in a3e7595

@pkova pkova force-pushed the pkova/dead-flow-consolidation branch from fb47490 to b7354eb Compare July 25, 2023 16:32
Comment on lines 2409 to 2417
|= [[=ship =ship-state] core=_event-core]
^+ event-core
=/ peer-state=(unit peer-state) (get-peer-state:core ship)
?~ peer-state core
%- ~(rep by snd.u.peer-state)
|= [[=bone =message-pump-state] cor=_core]
?. =(~m2 rto.metrics.packet-pump-state.message-pump-state)
cor
abet:(on-wake:(abed-peer:pe:cor ship u.peer-state) bone error)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style nit: there are a couple extraneous layers of indentation here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@pkova pkova force-pushed the pkova/dead-flow-consolidation branch 3 times, most recently from 2178c75 to 27fe522 Compare July 26, 2023 10:42
@pkova pkova force-pushed the pkova/dead-flow-consolidation branch from a3e7595 to 82d4e2a Compare July 28, 2023 13:33
Copy link
Collaborator

@joemfb joemfb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will do

@pkova pkova merged commit 19d7fe0 into next/kelvin/412 Jul 28, 2023
@pkova pkova deleted the pkova/dead-flow-consolidation branch July 28, 2023 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants