Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor broker overlay for topology flexibility #4474

Merged
merged 8 commits into from
Aug 9, 2022

Conversation

garlick
Copy link
Member

@garlick garlick commented Aug 8, 2022

Problem: the broker overlay network code assumes a "complete" k-ary tree topology.

This PR prepares the broker to support a custom configured tree topology as discussed in #3799 by removing assumptions about the topology from the overlay code and pushing the details into a new class. Later, we can add support to that class for setting up trees that are wired any way we like, for example with all interior nodes (overlay message routers) mapped to cluster service nodes that are less likely to be destabilized by running resource intensive user applications.

The most user-visible change here is that the tbon.fanout broker attribute has changed:

  • it now may be set to a value of 0 on the command line to select a flat topology, regardless of instance size
  • it is reset after the topology is instantiated to reflect the number of direct child peers at each broker

In addition, the default topology is now flat for an instance bootstrapped from configuration (normally the system instance).

@lgtm-com
Copy link

lgtm-com bot commented Aug 8, 2022

This pull request introduces 1 alert when merging 4b18b51 into 92921b3 - view on LGTM.com

new alerts:

  • 1 for Comparison result is always the same

@garlick
Copy link
Member Author

garlick commented Aug 8, 2022

Pushed fixups to various ci failures...

@grondo
Copy link
Contributor

grondo commented Aug 8, 2022

it is reset after the topology is instantiated to reflect the number of direct child peers at each broker

I don't necessarily have a problem with this change, but I wondered if you considered adding an attribute to track the current number of broker tbon children and keeping tbon.fanout as a constant reflection of the chosen configuration?

@garlick
Copy link
Member Author

garlick commented Aug 8, 2022

I don't necessarily have a problem with this change, but I wondered if you considered adding an attribute to track the current number of broker tbon children and keeping tbon.fanout as a constant reflection of the chosen configuration?

Now that you raise the question, the change does seem unjustified since this is likely to only affect the system instance. I just didn't know what to set it to when the tree shape is arbitrary. Maybe we should just leave it unset if the tree is not a complete k-ary.

I didn't have a particular use case for an attribute containing the number of direct peers, so I'd vote we add that later if needed (it would be easy).

@grondo
Copy link
Contributor

grondo commented Aug 8, 2022

Now that you raise the question, the change does seem unjustified since this is likely to only affect the system instance. I just didn't know what to set it to when the tree shape is arbitrary. Maybe we should just leave it unset if the tree is not a complete k-ary.

That seems reasonable to me.

I didn't have a particular use case for an attribute containing the number of direct peers, so I'd vote we add that later if needed (it would be easy).

That was my main thought. If there isn't a use case, keep tbon.fanout set to what was configured. If there is a use case later, then we could add a tbon.nchildren or whatever.

@garlick
Copy link
Member Author

garlick commented Aug 8, 2022

Ok, pushed that change, as well as a fix for a ci failure in the topology test that I missed in the last round.

@garlick
Copy link
Member Author

garlick commented Aug 8, 2022

oops, I realized I need to update the flux-broker-attributes(7) man page and fix a couple commit message errors. Force pushing again - hope that doesn't mess up any reviews in progress.

Copy link
Contributor

@grondo grondo left a comment

Choose a reason for hiding this comment

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

LGTM. Just spotted one commit message typo

@@ -406,7 +406,7 @@ static void update_torpid_children (struct overlay *ov)
}
}

/* N.B. overlay_child_status_update() ensures child_lookup() only
/* N.B. overlay_child_status_update() ensures child_lookup_online() only
Copy link
Contributor

Choose a reason for hiding this comment

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

typo in commit message: "Problen:"

@garlick
Copy link
Member Author

garlick commented Aug 8, 2022

Fixed that typo and rebased on current master - i'll set mwp.

garlick added 8 commits August 9, 2022 00:18
Problem: kary.h is included by broker.c but that class is not
used there.

Drop include directive.
Problem: overlay function comment refers to itself using the name
of another function, potentially creating confusion.

Correct comment.
Problem: the kary class used by the overlay network to calculate
routes and peers is limited to complete k-ary trees, but soon
non-complete tree topologies will be required.

Add a new topology class which represents arbitrary tree topologies.

The default topology is flat.  A complete k-ary topology may be set
with topology_set_kary().

Methods are added to support the queries needed by the broker overlay
network.

Add unit test.
Problem: the broker overlay code uses the kary class to calculate
peers and routes, but this will not work once the topology is allowed
to have a non-complete tree shape.

Switch to the topology class, which supports any tree shape.  The topology
is created in the bootstrap methods and passed to the overlay using
overlay_set_topology(), which replaces overlay_set_geometry().

Use the topology_set_kary() method to enact a complete topology as
before, but never call the kary_*() functions directly and remove
all assuptions about complete trees from the code.

Note that formerly the fact that child peers had contiguous ranks
was used to directly index into the array of children when selecting
a route.  To avoid slowing down that critical path, use the topology
aux container to store a pointer to the child peer struct.  The
container is accessed in O(1), and its items in O(N) where N is the
item's position in the container.

Update the overlay unit test.
Problem: strtol() and strtoul() are not being checked properly
in the broker attribute code.

Fix the code to conform to recommendations in strtoul(3), which
involves clearing errno before the call and testing it afterwards.
Problem: code for fetching a u32 attribute will be duplicated
in boot_pmi.c and boot_config.c.

Add attr_get_uint32() to attrs.[ch].
Problem: in the future, the broker bootstrap methods (config file
and PMI) will handle the tbon.fanout broker attribute differently,
but the attribute is currently managed in shared code in overlay.c.

Move the handling of the attribute to the bootstrap methods where
the code can be allowed to diverge.

Drop tbon.fanout test from overlay unit test, since this is no longer
a feature that belongs to the overlay abstraction.

Allow a fanout value of 0 to indicate "flat", regardless of the
instance size, since the topology class supports that.  Update
t0001-basic.t sharness test to allow that value to succeed.
Update flux-broker-attributes(7) to say what a value of 0 means.
Problem: the systemd unit file has to specify a large value for
the tbon.fanout attribute to make the default system instance
use a flat TBON topology.

Make the default TBON fanout 0 (flat) when Flux is booted from
config files.

Drop the tbon.fanout=256 setting in the systemd unit file.
@codecov
Copy link

codecov bot commented Aug 9, 2022

Codecov Report

Merging #4474 (54db2c9) into master (f9bc5da) will increase coverage by 0.01%.
The diff coverage is 92.51%.

❗ Current head 54db2c9 differs from pull request most recent head f004baf. Consider uploading reports for the commit f004baf to get more accurate results

@@            Coverage Diff             @@
##           master    #4474      +/-   ##
==========================================
+ Coverage   83.35%   83.36%   +0.01%     
==========================================
  Files         400      401       +1     
  Lines       67342    67501     +159     
==========================================
+ Hits        56132    56273     +141     
- Misses      11210    11228      +18     
Impacted Files Coverage Δ
src/broker/broker.c 78.36% <ø> (ø)
src/broker/overlay.c 86.39% <78.57%> (-0.30%) ⬇️
src/broker/attr.c 85.12% <78.94%> (-0.03%) ⬇️
src/broker/topology.c 95.74% <95.74%> (ø)
src/broker/boot_pmi.c 67.61% <96.00%> (+1.08%) ⬆️
src/broker/boot_config.c 81.74% <100.00%> (+0.47%) ⬆️
src/common/libsubprocess/local.c 82.92% <0.00%> (-1.47%) ⬇️
src/modules/job-archive/job-archive.c 62.62% <0.00%> (-0.70%) ⬇️
src/modules/job-info/guest_watch.c 76.21% <0.00%> (-0.55%) ⬇️
... and 4 more

@mergify mergify bot merged commit 23beb76 into flux-framework:master Aug 9, 2022
@garlick garlick deleted the overlay_topo branch August 9, 2022 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants